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

# Claim a guest cart after signing in

**Published**: 2026-11-30
**Category**: Commerce

## `POST /cart/claim`

**Claim a guest cart after signing in**

Moves the guest cart of `cartToken` to the signed-in customer. Requires a customer
session, else 401.

A customer without a cart takes the guest cart whole. Otherwise the guest lines merge
into the customer's cart, summing a shared variant's quantities up to 999, and the
guest cart is closed. Unsellable lines are removed and reported in `removedLines`.

Always returns the customer's cart, created empty if needed. A wrong, used or
other-site token claims nothing.

Errors: 422 `OUT_OF_STOCK` when a sum exceeds the stock where overselling is refused,
422 `CART_LINES_LIMIT_REACHED` past the line limit. Both keep the token valid.

> **Note:** Available only on sites with e-commerce enabled.

### 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 or customer session token |
| `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 |


### SDK

```typescript
import { createClient } from 'lynkow'

const lynkow = createClient({
  siteId: process.env.LYNKOW_SITE_ID!,
  publishableKey: process.env.LYNKOW_PK,
})

await lynkow.cart.addLine({ variantId: 'var_9f2c...', quantity: 2 })
await lynkow.customers.login({ email, password })
const cart = await lynkow.cart.claim()
```

---