For the complete documentation index, see llms.txt. This page is also available as Markdown.

Carts

Add an overview of the Carts API here. This block is preserved across regenerations.

Endpoints

POST /api/v1/carts

Create a cart for a session. If an existing cart is already keyed to the session, it is returned instead of creating a duplicate.

post
/carts
Authorizations
X-API-KeystringRequired

Scoped API key. Scopes: read, commerce, admin.

Body
sessionIdstringRequired

Caller-chosen session identifier to key the cart to

Responses
200

Existing cart for this session returned

application/json

A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.

idstring · uuidOptional
sessionIdstringOptional

Caller-supplied session identifier the cart is keyed to

userIdstring · uuid · nullableOptional
statusstringOptionalExample: active
offerIdstring · uuid · nullableOptional

Offer currently applied to the cart (via promo code or auto-apply), null when none

subtotalCentsintegerOptional

Sum of line totals before discounts

discountCentsintegerOptional

Discount from the applied offer

totalCentsintegerOptional

subtotalCents − discountCents (never negative)

currencystringOptional
createdAtstring · date-timeOptional
updatedAtstring · date-timeOptional
post/carts

Notes, examples, or caveats for POST /carts go here.

GET /api/v1/carts/{id}

Get a cart with its items and totals

get
/carts/{id}
Authorizations
X-API-KeystringRequired

Scoped API key. Scopes: read, commerce, admin.

Path parameters
idstringRequired

Cart ID

Responses
200

Cart details

application/json

A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.

idstring · uuidOptional
sessionIdstringOptional

Caller-supplied session identifier the cart is keyed to

userIdstring · uuid · nullableOptional
statusstringOptionalExample: active
offerIdstring · uuid · nullableOptional

Offer currently applied to the cart (via promo code or auto-apply), null when none

subtotalCentsintegerOptional

Sum of line totals before discounts

discountCentsintegerOptional

Discount from the applied offer

totalCentsintegerOptional

subtotalCents − discountCents (never negative)

currencystringOptional
createdAtstring · date-timeOptional
updatedAtstring · date-timeOptional
get/carts/{id}

Notes, examples, or caveats for GET /carts/{id} go here.

POST /api/v1/carts/{id}/items

Add an item to a cart. Cart totals are recalculated and any auto-apply offer that improves the discount is applied.

post
/carts/{id}/items
Authorizations
X-API-KeystringRequired

Scoped API key. Scopes: read, commerce, admin.

Path parameters
idstringRequired

Cart ID

Body
productIdstring · uuidOptional

Catalog product this line maps to

offerIdstring · uuidOptional
namestring · min: 1Required
descriptionstringOptional
quantityinteger · min: 1OptionalDefault: 1
unitPriceCentsintegerRequired
Responses
201

Item added — returns the updated cart with recalculated totals

application/json

A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.

idstring · uuidOptional
sessionIdstringOptional

Caller-supplied session identifier the cart is keyed to

userIdstring · uuid · nullableOptional
statusstringOptionalExample: active
offerIdstring · uuid · nullableOptional

Offer currently applied to the cart (via promo code or auto-apply), null when none

subtotalCentsintegerOptional

Sum of line totals before discounts

discountCentsintegerOptional

Discount from the applied offer

totalCentsintegerOptional

subtotalCents − discountCents (never negative)

currencystringOptional
createdAtstring · date-timeOptional
updatedAtstring · date-timeOptional
post/carts/{id}/items

Notes, examples, or caveats for POST /carts/{id}/items go here.

DELETE /api/v1/carts/{id}/items/{itemId}

Remove an item from a cart. Cart totals and offer discounts are recalculated.

delete
/carts/{id}/items/{itemId}
Authorizations
X-API-KeystringRequired

Scoped API key. Scopes: read, commerce, admin.

Path parameters
idstringRequired

Cart ID

itemIdstringRequired

Cart item ID

Responses
200

Item removed — returns the updated cart with recalculated totals

application/json

A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.

idstring · uuidOptional
sessionIdstringOptional

Caller-supplied session identifier the cart is keyed to

userIdstring · uuid · nullableOptional
statusstringOptionalExample: active
offerIdstring · uuid · nullableOptional

Offer currently applied to the cart (via promo code or auto-apply), null when none

subtotalCentsintegerOptional

Sum of line totals before discounts

discountCentsintegerOptional

Discount from the applied offer

totalCentsintegerOptional

subtotalCents − discountCents (never negative)

currencystringOptional
createdAtstring · date-timeOptional
updatedAtstring · date-timeOptional
delete/carts/{id}/items/{itemId}

Notes, examples, or caveats for DELETE /carts/{id}/items/{itemId} go here.

DELETE /api/v1/carts/{id}/promo

Remove the applied offer (promo) from a cart and recalculate totals

delete
/carts/{id}/promo
Authorizations
X-API-KeystringRequired

Scoped API key. Scopes: read, commerce, admin.

Path parameters
idstringRequired

Cart ID

Responses
200

Offer removed — returns the updated cart

application/json

A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.

idstring · uuidOptional
sessionIdstringOptional

Caller-supplied session identifier the cart is keyed to

userIdstring · uuid · nullableOptional
statusstringOptionalExample: active
offerIdstring · uuid · nullableOptional

Offer currently applied to the cart (via promo code or auto-apply), null when none

subtotalCentsintegerOptional

Sum of line totals before discounts

discountCentsintegerOptional

Discount from the applied offer

totalCentsintegerOptional

subtotalCents − discountCents (never negative)

currencystringOptional
createdAtstring · date-timeOptional
updatedAtstring · date-timeOptional
delete/carts/{id}/promo

Notes, examples, or caveats for DELETE /carts/{id}/promo go here.

POST /api/v1/carts/{id}/promo

Apply an offer (promo) code to a cart. The offer is validated against the cart contents before it is applied.

post
/carts/{id}/promo
Authorizations
X-API-KeystringRequired

Scoped API key. Scopes: read, commerce, admin.

Path parameters
idstringRequired

Cart ID

Body
codestringRequired

Offer code to apply

Responses
200

Offer applied — returns the updated cart plus an offer summary with the discount amount

application/json

A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.

idstring · uuidOptional
sessionIdstringOptional

Caller-supplied session identifier the cart is keyed to

userIdstring · uuid · nullableOptional
statusstringOptionalExample: active
offerIdstring · uuid · nullableOptional

Offer currently applied to the cart (via promo code or auto-apply), null when none

subtotalCentsintegerOptional

Sum of line totals before discounts

discountCentsintegerOptional

Discount from the applied offer

totalCentsintegerOptional

subtotalCents − discountCents (never negative)

currencystringOptional
createdAtstring · date-timeOptional
updatedAtstring · date-timeOptional
post/carts/{id}/promo

Notes, examples, or caveats for POST /carts/{id}/promo go here.

Last updated

Was this helpful?