Storefront API
Cart
Carts and their lines.
Start a cart
POST/storefront/2026-11/carts
storefront tokenIdempotency-Key required
Headers
Idempotency-KeystringrequiredUnique key for this request. Retries with the same key return the first response.
At least 1 characters · Up to 255 characters
Request body
linesarray of objectUp to 100 items
lines[].variant_idID (var_...)requiredlines[].quantityintegerrequired1 to 1000
buyer_statestring or nullsourcestringpage:<slug> when the cart starts on a payment page.
Response 201
idID (crt_...)requiredstatusenumrequiredOne of
openconvertedabandonedcurrencystringrequiredbuyer_statestring or nullrequiredlinesarray of objectrequiredlines[].idID (cln_...)requiredlines[].variant_idID (var_...)requiredlines[].product_idID (prd_...) or nullrequiredlines[].titlestringrequiredlines[].variant_titlestringrequiredlines[].quantityintegerrequiredlines[].unit_priceintegerrequiredlines[].totalintegerrequiredlines[].taxintegerrequiredlines[].requires_shippingbooleanrequiredlines[].availablebooleanrequiredFalse when the product is no longer on sale; such lines are left out of the totals.
lines[].price_changedobject or nullrequiredlines[].price_changed.fromintegerrequiredlines[].price_changed.tointegerrequiredsubtotalintegerrequiredLines total minus the discount.
discountobject or nullrequireddiscount.codestringrequireddiscount.amountintegerrequiredshippingintegerrequiredtaxobjectrequiredtax.totalintegerrequiredtax.cgstinteger or nullrequiredtax.sgstinteger or nullrequiredtax.igstinteger or nullrequiredtotalintegerrequirednoticesarray of stringrequiredPlain sentences for the buyer, for example a changed price.
Errors
| 400 | idempotency_key_required | Every POST needs an Idempotency-Key header. |
| 400 | validation_failed | A field in the request is missing or invalid. See param. |
| 401 | authentication_required | Send a valid access token or session. |
| 409 | idempotency_in_progress | A request with this Idempotency-Key is still running. |
| 422 | idempotency_key_reused | This Idempotency-Key was used with a different request. |
| 429 | rate_limited | Too many requests. Wait for the time in RateLimit-Reset. |
| 500 | internal_error | Something went wrong on our side. Quote the trace_id to support. |
curl -X POST https://api.storelyne.com/storefront/2026-11/carts \
-H "Storefront-Token: <storefront token>" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"lines": [
{
"variant_id": "var_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"quantity": 1
}
],
"buyer_state": "string",
"source": ""
}'const res = await fetch('https://api.storelyne.com/storefront/2026-11/carts', {
method: 'POST',
headers: {
'Storefront-Token': process.env.STORELYNE_STOREFRONT_TOKEN,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"lines": [
{
"variant_id": "var_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"quantity": 1
}
],
"buyer_state": "string",
"source": ""
}),
});
const data = await res.json();{
"id": "crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"status": "open",
"currency": "INR",
"buyer_state": "string",
"lines": [
{
"id": "cln_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"variant_id": "var_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"product_id": "prd_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"title": "Festive saree",
"variant_title": "Festive saree",
"quantity": 1,
"unit_price": 49900,
"total": 49900,
"tax": 1,
"requires_shipping": false,
"available": false,
"price_changed": {
"from": 1,
"to": 1
}
}
],
"subtotal": 49900,
"discount": {
"code": "string",
"amount": 49900
},
"shipping": 1,
"tax": {
"total": 49900,
"cgst": 1,
"sgst": 1,
"igst": 1
},
"total": 49900,
"notices": [
"string"
]
}A cart with current prices and totals
GET/storefront/2026-11/carts/{id}
storefront token
Path parameters
idID (crt_...)required
Response 200
idID (crt_...)requiredstatusenumrequiredOne of
openconvertedabandonedcurrencystringrequiredbuyer_statestring or nullrequiredlinesarray of objectrequiredlines[].idID (cln_...)requiredlines[].variant_idID (var_...)requiredlines[].product_idID (prd_...) or nullrequiredlines[].titlestringrequiredlines[].variant_titlestringrequiredlines[].quantityintegerrequiredlines[].unit_priceintegerrequiredlines[].totalintegerrequiredlines[].taxintegerrequiredlines[].requires_shippingbooleanrequiredlines[].availablebooleanrequiredFalse when the product is no longer on sale; such lines are left out of the totals.
lines[].price_changedobject or nullrequiredlines[].price_changed.fromintegerrequiredlines[].price_changed.tointegerrequiredsubtotalintegerrequiredLines total minus the discount.
discountobject or nullrequireddiscount.codestringrequireddiscount.amountintegerrequiredshippingintegerrequiredtaxobjectrequiredtax.totalintegerrequiredtax.cgstinteger or nullrequiredtax.sgstinteger or nullrequiredtax.igstinteger or nullrequiredtotalintegerrequirednoticesarray of stringrequiredPlain sentences for the buyer, for example a changed price.
Errors
| 400 | validation_failed | A field in the request is missing or invalid. See param. |
| 401 | authentication_required | Send a valid access token or session. |
| 404 | resource_not_found | The object does not exist or belongs to another store. |
| 429 | rate_limited | Too many requests. Wait for the time in RateLimit-Reset. |
| 500 | internal_error | Something went wrong on our side. Quote the trace_id to support. |
curl https://api.storelyne.com/storefront/2026-11/carts/crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R \
-H "Storefront-Token: <storefront token>"const res = await fetch('https://api.storelyne.com/storefront/2026-11/carts/crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R', {
method: 'GET',
headers: {
'Storefront-Token': process.env.STORELYNE_STOREFRONT_TOKEN,
},
});
const data = await res.json();{
"id": "crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"status": "open",
"currency": "INR",
"buyer_state": "string",
"lines": [
{
"id": "cln_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"variant_id": "var_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"product_id": "prd_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"title": "Festive saree",
"variant_title": "Festive saree",
"quantity": 1,
"unit_price": 49900,
"total": 49900,
"tax": 1,
"requires_shipping": false,
"available": false,
"price_changed": {
"from": 1,
"to": 1
}
}
],
"subtotal": 49900,
"discount": {
"code": "string",
"amount": 49900
},
"shipping": 1,
"tax": {
"total": 49900,
"cgst": 1,
"sgst": 1,
"igst": 1
},
"total": 49900,
"notices": [
"string"
]
}Set the buyer state (for the GST split)
PATCH/storefront/2026-11/carts/{id}
storefront token
Path parameters
idID (crt_...)required
Request body
buyer_statestring or nulldiscount_codestring or nullA discount code; null removes it.
Response 200
idID (crt_...)requiredstatusenumrequiredOne of
openconvertedabandonedcurrencystringrequiredbuyer_statestring or nullrequiredlinesarray of objectrequiredlines[].idID (cln_...)requiredlines[].variant_idID (var_...)requiredlines[].product_idID (prd_...) or nullrequiredlines[].titlestringrequiredlines[].variant_titlestringrequiredlines[].quantityintegerrequiredlines[].unit_priceintegerrequiredlines[].totalintegerrequiredlines[].taxintegerrequiredlines[].requires_shippingbooleanrequiredlines[].availablebooleanrequiredFalse when the product is no longer on sale; such lines are left out of the totals.
lines[].price_changedobject or nullrequiredlines[].price_changed.fromintegerrequiredlines[].price_changed.tointegerrequiredsubtotalintegerrequiredLines total minus the discount.
discountobject or nullrequireddiscount.codestringrequireddiscount.amountintegerrequiredshippingintegerrequiredtaxobjectrequiredtax.totalintegerrequiredtax.cgstinteger or nullrequiredtax.sgstinteger or nullrequiredtax.igstinteger or nullrequiredtotalintegerrequirednoticesarray of stringrequiredPlain sentences for the buyer, for example a changed price.
Errors
| 400 | validation_failed | A field in the request is missing or invalid. See param. |
| 401 | authentication_required | Send a valid access token or session. |
| 404 | resource_not_found | The object does not exist or belongs to another store. |
| 429 | rate_limited | Too many requests. Wait for the time in RateLimit-Reset. |
| 500 | internal_error | Something went wrong on our side. Quote the trace_id to support. |
curl -X PATCH https://api.storelyne.com/storefront/2026-11/carts/crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R \
-H "Storefront-Token: <storefront token>" \
-H "Content-Type: application/json" \
-d '{
"buyer_state": "string",
"discount_code": "string"
}'const res = await fetch('https://api.storelyne.com/storefront/2026-11/carts/crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R', {
method: 'PATCH',
headers: {
'Storefront-Token': process.env.STORELYNE_STOREFRONT_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"buyer_state": "string",
"discount_code": "string"
}),
});
const data = await res.json();{
"id": "crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"status": "open",
"currency": "INR",
"buyer_state": "string",
"lines": [
{
"id": "cln_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"variant_id": "var_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"product_id": "prd_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"title": "Festive saree",
"variant_title": "Festive saree",
"quantity": 1,
"unit_price": 49900,
"total": 49900,
"tax": 1,
"requires_shipping": false,
"available": false,
"price_changed": {
"from": 1,
"to": 1
}
}
],
"subtotal": 49900,
"discount": {
"code": "string",
"amount": 49900
},
"shipping": 1,
"tax": {
"total": 49900,
"cgst": 1,
"sgst": 1,
"igst": 1
},
"total": 49900,
"notices": [
"string"
]
}Add a variant (adds to the quantity when it is already in the cart)
POST/storefront/2026-11/carts/{id}/lines
storefront tokenIdempotency-Key required
Path parameters
idID (crt_...)required
Headers
Idempotency-KeystringrequiredUnique key for this request. Retries with the same key return the first response.
At least 1 characters · Up to 255 characters
Request body
variant_idID (var_...)requiredquantityintegerrequired1 to 1000
Response 200
idID (crt_...)requiredstatusenumrequiredOne of
openconvertedabandonedcurrencystringrequiredbuyer_statestring or nullrequiredlinesarray of objectrequiredlines[].idID (cln_...)requiredlines[].variant_idID (var_...)requiredlines[].product_idID (prd_...) or nullrequiredlines[].titlestringrequiredlines[].variant_titlestringrequiredlines[].quantityintegerrequiredlines[].unit_priceintegerrequiredlines[].totalintegerrequiredlines[].taxintegerrequiredlines[].requires_shippingbooleanrequiredlines[].availablebooleanrequiredFalse when the product is no longer on sale; such lines are left out of the totals.
lines[].price_changedobject or nullrequiredlines[].price_changed.fromintegerrequiredlines[].price_changed.tointegerrequiredsubtotalintegerrequiredLines total minus the discount.
discountobject or nullrequireddiscount.codestringrequireddiscount.amountintegerrequiredshippingintegerrequiredtaxobjectrequiredtax.totalintegerrequiredtax.cgstinteger or nullrequiredtax.sgstinteger or nullrequiredtax.igstinteger or nullrequiredtotalintegerrequirednoticesarray of stringrequiredPlain sentences for the buyer, for example a changed price.
Errors
| 400 | idempotency_key_required | Every POST needs an Idempotency-Key header. |
| 400 | validation_failed | A field in the request is missing or invalid. See param. |
| 401 | authentication_required | Send a valid access token or session. |
| 404 | resource_not_found | The object does not exist or belongs to another store. |
| 409 | idempotency_in_progress | A request with this Idempotency-Key is still running. |
| 422 | idempotency_key_reused | This Idempotency-Key was used with a different request. |
| 429 | rate_limited | Too many requests. Wait for the time in RateLimit-Reset. |
| 500 | internal_error | Something went wrong on our side. Quote the trace_id to support. |
curl -X POST https://api.storelyne.com/storefront/2026-11/carts/crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R/lines \
-H "Storefront-Token: <storefront token>" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"variant_id": "var_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"quantity": 1
}'const res = await fetch('https://api.storelyne.com/storefront/2026-11/carts/crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R/lines', {
method: 'POST',
headers: {
'Storefront-Token': process.env.STORELYNE_STOREFRONT_TOKEN,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"variant_id": "var_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"quantity": 1
}),
});
const data = await res.json();{
"id": "crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"status": "open",
"currency": "INR",
"buyer_state": "string",
"lines": [
{
"id": "cln_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"variant_id": "var_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"product_id": "prd_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"title": "Festive saree",
"variant_title": "Festive saree",
"quantity": 1,
"unit_price": 49900,
"total": 49900,
"tax": 1,
"requires_shipping": false,
"available": false,
"price_changed": {
"from": 1,
"to": 1
}
}
],
"subtotal": 49900,
"discount": {
"code": "string",
"amount": 49900
},
"shipping": 1,
"tax": {
"total": 49900,
"cgst": 1,
"sgst": 1,
"igst": 1
},
"total": 49900,
"notices": [
"string"
]
}Change a quantity
PATCH/storefront/2026-11/carts/{id}/lines/{line_id}
storefront token
Path parameters
idID (crt_...)requiredline_idID (cln_...)required
Request body
quantityintegerrequired1 to 1000
Response 200
idID (crt_...)requiredstatusenumrequiredOne of
openconvertedabandonedcurrencystringrequiredbuyer_statestring or nullrequiredlinesarray of objectrequiredlines[].idID (cln_...)requiredlines[].variant_idID (var_...)requiredlines[].product_idID (prd_...) or nullrequiredlines[].titlestringrequiredlines[].variant_titlestringrequiredlines[].quantityintegerrequiredlines[].unit_priceintegerrequiredlines[].totalintegerrequiredlines[].taxintegerrequiredlines[].requires_shippingbooleanrequiredlines[].availablebooleanrequiredFalse when the product is no longer on sale; such lines are left out of the totals.
lines[].price_changedobject or nullrequiredlines[].price_changed.fromintegerrequiredlines[].price_changed.tointegerrequiredsubtotalintegerrequiredLines total minus the discount.
discountobject or nullrequireddiscount.codestringrequireddiscount.amountintegerrequiredshippingintegerrequiredtaxobjectrequiredtax.totalintegerrequiredtax.cgstinteger or nullrequiredtax.sgstinteger or nullrequiredtax.igstinteger or nullrequiredtotalintegerrequirednoticesarray of stringrequiredPlain sentences for the buyer, for example a changed price.
Errors
| 400 | validation_failed | A field in the request is missing or invalid. See param. |
| 401 | authentication_required | Send a valid access token or session. |
| 404 | resource_not_found | The object does not exist or belongs to another store. |
| 429 | rate_limited | Too many requests. Wait for the time in RateLimit-Reset. |
| 500 | internal_error | Something went wrong on our side. Quote the trace_id to support. |
curl -X PATCH https://api.storelyne.com/storefront/2026-11/carts/crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R/lines/cln_01JCG8ZQ5S7T0V4X8K2M3N6P9R \
-H "Storefront-Token: <storefront token>" \
-H "Content-Type: application/json" \
-d '{
"quantity": 1
}'const res = await fetch('https://api.storelyne.com/storefront/2026-11/carts/crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R/lines/cln_01JCG8ZQ5S7T0V4X8K2M3N6P9R', {
method: 'PATCH',
headers: {
'Storefront-Token': process.env.STORELYNE_STOREFRONT_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"quantity": 1
}),
});
const data = await res.json();{
"id": "crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"status": "open",
"currency": "INR",
"buyer_state": "string",
"lines": [
{
"id": "cln_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"variant_id": "var_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"product_id": "prd_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"title": "Festive saree",
"variant_title": "Festive saree",
"quantity": 1,
"unit_price": 49900,
"total": 49900,
"tax": 1,
"requires_shipping": false,
"available": false,
"price_changed": {
"from": 1,
"to": 1
}
}
],
"subtotal": 49900,
"discount": {
"code": "string",
"amount": 49900
},
"shipping": 1,
"tax": {
"total": 49900,
"cgst": 1,
"sgst": 1,
"igst": 1
},
"total": 49900,
"notices": [
"string"
]
}Remove a line
DEL/storefront/2026-11/carts/{id}/lines/{line_id}
storefront token
Path parameters
idID (crt_...)requiredline_idID (cln_...)required
Response 200
idID (crt_...)requiredstatusenumrequiredOne of
openconvertedabandonedcurrencystringrequiredbuyer_statestring or nullrequiredlinesarray of objectrequiredlines[].idID (cln_...)requiredlines[].variant_idID (var_...)requiredlines[].product_idID (prd_...) or nullrequiredlines[].titlestringrequiredlines[].variant_titlestringrequiredlines[].quantityintegerrequiredlines[].unit_priceintegerrequiredlines[].totalintegerrequiredlines[].taxintegerrequiredlines[].requires_shippingbooleanrequiredlines[].availablebooleanrequiredFalse when the product is no longer on sale; such lines are left out of the totals.
lines[].price_changedobject or nullrequiredlines[].price_changed.fromintegerrequiredlines[].price_changed.tointegerrequiredsubtotalintegerrequiredLines total minus the discount.
discountobject or nullrequireddiscount.codestringrequireddiscount.amountintegerrequiredshippingintegerrequiredtaxobjectrequiredtax.totalintegerrequiredtax.cgstinteger or nullrequiredtax.sgstinteger or nullrequiredtax.igstinteger or nullrequiredtotalintegerrequirednoticesarray of stringrequiredPlain sentences for the buyer, for example a changed price.
Errors
| 400 | validation_failed | A field in the request is missing or invalid. See param. |
| 401 | authentication_required | Send a valid access token or session. |
| 404 | resource_not_found | The object does not exist or belongs to another store. |
| 429 | rate_limited | Too many requests. Wait for the time in RateLimit-Reset. |
| 500 | internal_error | Something went wrong on our side. Quote the trace_id to support. |
curl -X DELETE https://api.storelyne.com/storefront/2026-11/carts/crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R/lines/cln_01JCG8ZQ5S7T0V4X8K2M3N6P9R \
-H "Storefront-Token: <storefront token>"const res = await fetch('https://api.storelyne.com/storefront/2026-11/carts/crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R/lines/cln_01JCG8ZQ5S7T0V4X8K2M3N6P9R', {
method: 'DELETE',
headers: {
'Storefront-Token': process.env.STORELYNE_STOREFRONT_TOKEN,
},
});
const data = await res.json();{
"id": "crt_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"status": "open",
"currency": "INR",
"buyer_state": "string",
"lines": [
{
"id": "cln_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"variant_id": "var_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"product_id": "prd_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"title": "Festive saree",
"variant_title": "Festive saree",
"quantity": 1,
"unit_price": 49900,
"total": 49900,
"tax": 1,
"requires_shipping": false,
"available": false,
"price_changed": {
"from": 1,
"to": 1
}
}
],
"subtotal": 49900,
"discount": {
"code": "string",
"amount": 49900
},
"shipping": 1,
"tax": {
"total": 49900,
"cgst": 1,
"sgst": 1,
"igst": 1
},
"total": 49900,
"notices": [
"string"
]
}