Skip to content
Browse documentation

API reference

Carts

Create an anonymous cart, add and update line items, and read the current cart with computed totals. Carts are identified by the X-Cart-Token returned when the cart is created.

Feature requirement: the project must have the commerce feature enabled, or these endpoints return 404.

  • Send X-Cart-Token on every cart and checkout request after the cart is created.
  • Totals, taxes and discounts are computed server-side — do not calculate them in the client.
POST/api/v1/storefront/projects/{project_slug}/carts

Create Cart

Parameters
NameTypeInDescription
project_slugstringpathRequired.
Request body · CartCreate
FieldTypeDescription
emailstring (nullable)optional—
Response 201 (list) · CartItemRead[]
FieldTypeDescription
idstringrequired—
variant_idstringrequired—
product_idstringrequired—
product_namestringrequired—
variant_titlestringrequired—
skustringrequired—
quantityintegerrequired—
unit_price_minorintegerrequired—
line_total_minorintegerrequired—
currencystringrequired—
Example request
curl -X POST "https://api.webtools.ng/api/v1/storefront/projects/your-project/carts" \
  -H "X-Project-Key: wt_pk_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "email": "…" }'
GET/api/v1/storefront/projects/{project_slug}/carts/current

Get Cart

Parameters
NameTypeInDescription
project_slugstringpathRequired.
x-cart-tokenstring (nullable)headerOptional.
Response 200 (list) · CartItemRead[]
FieldTypeDescription
idstringrequired—
variant_idstringrequired—
product_idstringrequired—
product_namestringrequired—
variant_titlestringrequired—
skustringrequired—
quantityintegerrequired—
unit_price_minorintegerrequired—
line_total_minorintegerrequired—
currencystringrequired—
Example request
curl "https://api.webtools.ng/api/v1/storefront/projects/your-project/carts/current" \
  -H "X-Project-Key: wt_pk_your_key"
POST/api/v1/storefront/projects/{project_slug}/carts/current/items

Add Item

Parameters
NameTypeInDescription
project_slugstringpathRequired.
x-cart-tokenstring (nullable)headerOptional.
Request body · CartItemCreate
FieldTypeDescription
variant_idstringrequired—
quantityintegerrequired—
Response 200 (list) · CartItemRead[]
FieldTypeDescription
idstringrequired—
variant_idstringrequired—
product_idstringrequired—
product_namestringrequired—
variant_titlestringrequired—
skustringrequired—
quantityintegerrequired—
unit_price_minorintegerrequired—
line_total_minorintegerrequired—
currencystringrequired—
Example request
curl -X POST "https://api.webtools.ng/api/v1/storefront/projects/your-project/carts/current/items" \
  -H "X-Project-Key: wt_pk_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "variant_id": "…", "quantity": 0 }'
PATCH/api/v1/storefront/projects/{project_slug}/carts/current/items/{item_id}

Update Item

Parameters
NameTypeInDescription
project_slugstringpathRequired.
item_idstringpathRequired.
x-cart-tokenstring (nullable)headerOptional.
Request body · CartItemUpdate
FieldTypeDescription
quantityintegerrequired—
Response 200 (list) · CartItemRead[]
FieldTypeDescription
idstringrequired—
variant_idstringrequired—
product_idstringrequired—
product_namestringrequired—
variant_titlestringrequired—
skustringrequired—
quantityintegerrequired—
unit_price_minorintegerrequired—
line_total_minorintegerrequired—
currencystringrequired—
Example request
curl -X PATCH "https://api.webtools.ng/api/v1/storefront/projects/your-project/carts/current/items/{item_id}" \
  -H "X-Project-Key: wt_pk_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "quantity": 0 }'

← All resource groups