> For the complete Lynkow documentation index in agent-friendly format, see [llms.txt](/llms.txt).

# Claim a guest cart after signing in

**Publié le** : 2026-08-19
**Catégorie** : Commerce

## `POST /cart/claim`

**Claim a guest cart after signing in**

Transfers the cart built as a guest to the now-authenticated buyer, so a
shopper who signs in keeps what they had assembled. Authenticated-only: the
destination is always the calling customer and can never be named in the body.
The guest cart is identified solely by the `cartToken` the client already
holds.

When the buyer has no cart of their own the guest cart is adopted in place,
keeping its id, its items, and every price captured when those items were
added. When they already have one, the guest items are folded into it: a
variant present in both has its quantities summed and clamped at the per-line
cap while keeping the existing line's captured price, a variant present only
in the guest cart is carried over with its own captured price, and the guest
cart is then closed. Totals are recomputed server-side. The whole transfer is
one transaction, so it never leaves a half-merged cart.

The claim also SELF-HEALS the surviving cart (Phase 5): a folded or adopted line
whose variant is no longer sellable is auto-removed and reported in `removedLines`,
so the buyer never signs in to a cart total carrying an item that cannot be sold.

The response is ALWAYS the caller's own cart, with an identical shape whether
anything was claimed or not. A wrong, absent, already-claimed, or other-site
token transfers nothing and is reported as nothing: there is no status flag,
no reason, and no error branch, because distinguishing those cases would tell
a caller about carts that are not theirs. A token can be claimed once;
replaying it is a no-op.

> **Note:** This endpoint requires the e-commerce feature to be enabled on your site.

### Request Body

Content-Type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cartToken` | string | Yes | Required. 43-43 characters |


### Responses

| Status | Description |
| --- | --- |
| `200` | Successful response |
| `401` | Missing or invalid storefront publishable key |
| `402` | The site subscription does not currently permit this operation |
| `403` | The storefront key origin is not allowed |
| `404` | Site, resource, or commerce feature not found |
| `422` | Validation error |


---