Admin API
Discounts
Codes and automatic discounts.
Discount codes
GET/admin/2026-11/discounts
Response 200
dataarray of objectrequireddata[].idID (dsc_...)requireddata[].codestringrequireddata[].kindenumrequiredOne of
percentfixeddata[].valueintegerrequiredBasis points for percent (1000 = 10%), paise for fixed.
data[].min_subtotalintegerrequireddata[].max_usesinteger or nullrequireddata[].usesintegerrequireddata[].page_slugstring or nullrequiredOnly for this payment page; null for the whole store.
data[].starts_attimestamp or nullrequireddata[].ends_attimestamp or nullrequireddata[].statusenumrequiredOne of
activedisableddata[].created_attimestamprequired
Errors
| 401 | authentication_required | Send a valid access token or session. |
| 403 | missing_scope | The app token does not have the scope this endpoint needs. |
| 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/admin/2026-11/discounts \
-H "Authorization: Bearer pat_live_..."const res = await fetch('https://api.storelyne.com/admin/2026-11/discounts', {
method: 'GET',
headers: {
'Authorization': `Bearer ${process.env.STORELYNE_TOKEN}`,
},
});
const data = await res.json();{
"data": [
{
"id": "dsc_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"code": "string",
"kind": "percent",
"value": 1,
"min_subtotal": 49900,
"max_uses": 1,
"uses": 1,
"page_slug": "festive-saree",
"starts_at": "2026-11-04T10:00:00.000Z",
"ends_at": "2026-11-04T10:00:00.000Z",
"status": "active",
"created_at": "2026-11-04T10:00:00.000Z"
}
]
}Create a discount code
POST/admin/2026-11/discounts
scope write_discountsIdempotency-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
X-CSRF-TokenstringRequired with a seller session cookie: the value of the orb_csrf cookie.
Request body
codestringrequiredkindenumrequiredOne of
percentfixedvalueintegerrequiredUp to 10000000
min_subtotalintegerDefault 0 · 0 to 10000000
max_usesinteger or nullDefault null
page_slugstring or nullDefault null
starts_attimestamp or nullDefault null
ends_attimestamp or nullDefault null
Response 201
idID (dsc_...)requiredcodestringrequiredkindenumrequiredOne of
percentfixedvalueintegerrequiredBasis points for percent (1000 = 10%), paise for fixed.
min_subtotalintegerrequiredmax_usesinteger or nullrequiredusesintegerrequiredpage_slugstring or nullrequiredOnly for this payment page; null for the whole store.
starts_attimestamp or nullrequiredends_attimestamp or nullrequiredstatusenumrequiredOne of
activedisabledcreated_attimestamprequired
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. |
| 403 | missing_scope | The app token does not have the scope this endpoint needs. |
| 409 | conflict | The request conflicts with the current state of the object. |
| 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/admin/2026-11/discounts \
-H "Authorization: Bearer pat_live_..." \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"code": "string",
"kind": "percent",
"value": 1
}'const res = await fetch('https://api.storelyne.com/admin/2026-11/discounts', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.STORELYNE_TOKEN}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"code": "string",
"kind": "percent",
"value": 1
}),
});
const data = await res.json();{
"id": "dsc_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"code": "string",
"kind": "percent",
"value": 1,
"min_subtotal": 49900,
"max_uses": 1,
"uses": 1,
"page_slug": "festive-saree",
"starts_at": "2026-11-04T10:00:00.000Z",
"ends_at": "2026-11-04T10:00:00.000Z",
"status": "active",
"created_at": "2026-11-04T10:00:00.000Z"
}Turn a code on or off, or change its end date or limit
PATCH/admin/2026-11/discounts/{id}
Path parameters
idID (dsc_...)required
Headers
X-CSRF-TokenstringRequired with a seller session cookie: the value of the orb_csrf cookie.
Request body
statusenumOne of
activedisabledends_attimestamp or nullmax_usesinteger or null
Response 200
idID (dsc_...)requiredcodestringrequiredkindenumrequiredOne of
percentfixedvalueintegerrequiredBasis points for percent (1000 = 10%), paise for fixed.
min_subtotalintegerrequiredmax_usesinteger or nullrequiredusesintegerrequiredpage_slugstring or nullrequiredOnly for this payment page; null for the whole store.
starts_attimestamp or nullrequiredends_attimestamp or nullrequiredstatusenumrequiredOne of
activedisabledcreated_attimestamprequired
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. |
| 403 | missing_scope | The app token does not have the scope this endpoint needs. |
| 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/admin/2026-11/discounts/dsc_01JCG8ZQ5S7T0V4X8K2M3N6P9R \
-H "Authorization: Bearer pat_live_..." \
-H "Content-Type: application/json" \
-d '{
"status": "active",
"ends_at": "2026-11-04T10:00:00.000Z",
"max_uses": 1
}'const res = await fetch('https://api.storelyne.com/admin/2026-11/discounts/dsc_01JCG8ZQ5S7T0V4X8K2M3N6P9R', {
method: 'PATCH',
headers: {
'Authorization': `Bearer ${process.env.STORELYNE_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"status": "active",
"ends_at": "2026-11-04T10:00:00.000Z",
"max_uses": 1
}),
});
const data = await res.json();{
"id": "dsc_01JCG8ZQ5S7T0V4X8K2M3N6P9R",
"code": "string",
"kind": "percent",
"value": 1,
"min_subtotal": 49900,
"max_uses": 1,
"uses": 1,
"page_slug": "festive-saree",
"starts_at": "2026-11-04T10:00:00.000Z",
"ends_at": "2026-11-04T10:00:00.000Z",
"status": "active",
"created_at": "2026-11-04T10:00:00.000Z"
}