Create a cart
POST
/cart
Creates a new empty cart for the resolved account, defaulting currency to TND and expiry to 7 days. Optionally links a customerId/sessionId. Soft auth.
Auth: Bearer JWT optional (guest-friendly).
Authorizations
bearerAuth
Jeton client obtenu par POST /auth/login (ou /auth/register), renouvelé par POST /auth/refresh.
Type
HTTP (bearer)
or
Parameters
Header Parameters
x-account-id
Account id fallback when tenant context is not resolved
Type
string
Request Body
application/json
JSON "customerId": "string", "sessionId": "string", "currency": "TND"
{
}
Responses
Cart created
application/json
JSON "ok": true, "data": { "cartId": "123e4567-e89b-12d3-a456-426614174000", "accountId": "string", "customerId": "string", "sessionId": "string", "currency": "string", "notes": "string", "expiresAt": "2024-01-01T00:00:00Z", "createdAt": "2024-01-01T00:00:00Z", "updatedAt": "2024-01-01T00:00:00Z", "items": [ { "itemId": "string", "productId": "string", "variantId": "string", "quantity": 0, "unitPrice": 0, "addedAt": "2024-01-01T00:00:00Z" } ], "subtotal": 0 }
{
}