API reference
Discount codes
On this page
List discount codes
/discountsRequired scopes:read_discounts
Query parameters
| Name | Type | Description |
|---|---|---|
limit | integer | Page size, 1–250 (default 50). default 50 · min 1 · max 250 |
cursor | string | next_cursor from the previous page. |
updated_since | string<date-time> | Only objects changed at or after this ISO-8601 time. |
created_since | string<date-time> | Only objects created at or after this ISO-8601 time. |
code | string | This code. |
Example request
curl "https://api.sellorchard.com/v1/discounts?limit=50" \
-H "Authorization: Bearer $SELLORCHARD_API_KEY"Response200Discount codes.
ShowHide response schema
dataarray of DiscountrequiredShowHide item attributes
objectstringrequiredidintegerrequiredId.
codestringrequiredThe code (upper case).
titlestring | nullrequiredShown to shoppers.
typestringrequiredKind.
One of:
percentagefixedfree_shippingbuy_x_get_yvaluestringrequiredPercent (percentage) or amount (fixed).
pattern ^-?\d+\.\d{2}$
minimum_subtotalstring | nullrequiredMinimum subtotal.
pattern ^-?\d+\.\d{2}$
minimum_quantityinteger | nullrequiredMinimum items.
applies_tostringrequiredWhat it discounts.
One of:
allcategoriesproductsproduct_idsarray of integerrequiredProducts (applies_to products).
category_idsarray of integerrequiredCategories (applies_to categories).
once_per_customerbooleanrequiredOne use per customer.
usage_limitinteger | nullrequiredTotal uses allowed.
times_usedintegerrequiredUses so far.
starts_atstring<date-time> | nullrequiredStarts.
ends_atstring<date-time> | nullrequiredEnds.
is_activebooleanrequiredSwitched on.
statestringrequiredRight now.
One of:
activescheduledexpiredused_updisabledcreated_atstring<date-time>requiredCreated.
updated_atstring<date-time>requiredLast changed.
has_morebooleanrequiredMore pages after this one.
next_cursorstring | nullrequiredPass as
cursorfor the next page; null on the last page.
{
"data": [
{
"object": "discount",
"id": 31,
"code": "WELCOME10",
"title": "Welcome 10% off",
"type": "percentage",
"value": "10.00",
"minimum_subtotal": null,
"minimum_quantity": null,
"applies_to": "all",
"product_ids": [],
"category_ids": [],
"once_per_customer": true,
"usage_limit": null,
"times_used": 12,
"starts_at": null,
"ends_at": null,
"is_active": true,
"state": "active",
"created_at": "2026-11-02T15:00:00Z",
"updated_at": "2026-11-03T09:30:00Z"
}
],
"has_more": false,
"next_cursor": null
}Error responses
- 400
invalid_requestMalformed request (e.g. a bad cursor). - 401
authenticationMissing, invalid, expired or revoked API key. - 403
permissionThe key lacks the scope, or the store's plan doesn't include the API. - 422
invalid_requestInvalid parameters;errorslists each field. - 429
rate_limitedToo many requests. - 500
serverSomething went wrong on our side; safe to retry with the same Idempotency-Key.
Create a discount code
/discountsFires discount.created.
Required scopes:write_discounts
Headers
| Name | Type | Description |
|---|---|---|
Idempotency-Key | string | Any unique string (e.g. a UUID, up to 255 characters). A retry with the same key and body within 24 hours gets the first response again (Idempotent-Replayed: true); the same key with a different body is a 409 conflict. |
Request body
codestringLetters, numbers, - and _ (required on create; stored upper case).
titlestring | nullShown to shoppers.
typestringRequired on create.
One of:
percentagefixedfree_shippingvaluestring | number | nullPercent (≤ 100) or amount; required for percentage and fixed.
minimum_subtotalstring | number | nullminimum_quantityinteger | nullMinimum items.
applies_tostringDefault all.
One of:
allcategoriesproductsproduct_idsarray of integerWith applies_to products.
category_idsarray of integerWith applies_to categories.
once_per_customerbooleanOne use per customer.
usage_limitinteger | nullTotal uses.
starts_atstring<date-time> | nullStart.
ends_atstring<date-time> | nullEnd (after the start).
is_activebooleanDefault true.
Example request
curl -X POST "https://api.sellorchard.com/v1/discounts" \
-H "Authorization: Bearer $SELLORCHARD_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"code": "WELCOME10",
"type": "percentage",
"value": "10",
"once_per_customer": true
}'Response201A discount code.
ShowHide response schema
dataDiscountrequiredShowHide child attributes
objectstringrequiredidintegerrequiredId.
codestringrequiredThe code (upper case).
titlestring | nullrequiredShown to shoppers.
typestringrequiredKind.
One of:
percentagefixedfree_shippingbuy_x_get_yvaluestringrequiredPercent (percentage) or amount (fixed).
pattern ^-?\d+\.\d{2}$
minimum_subtotalstring | nullrequiredMinimum subtotal.
pattern ^-?\d+\.\d{2}$
minimum_quantityinteger | nullrequiredMinimum items.
applies_tostringrequiredWhat it discounts.
One of:
allcategoriesproductsproduct_idsarray of integerrequiredProducts (applies_to products).
category_idsarray of integerrequiredCategories (applies_to categories).
once_per_customerbooleanrequiredOne use per customer.
usage_limitinteger | nullrequiredTotal uses allowed.
times_usedintegerrequiredUses so far.
starts_atstring<date-time> | nullrequiredStarts.
ends_atstring<date-time> | nullrequiredEnds.
is_activebooleanrequiredSwitched on.
statestringrequiredRight now.
One of:
activescheduledexpiredused_updisabledcreated_atstring<date-time>requiredCreated.
updated_atstring<date-time>requiredLast changed.
{
"data": {
"object": "discount",
"id": 31,
"code": "WELCOME10",
"title": "Welcome 10% off",
"type": "percentage",
"value": "10.00",
"minimum_subtotal": null,
"minimum_quantity": null,
"applies_to": "all",
"product_ids": [],
"category_ids": [],
"once_per_customer": true,
"usage_limit": null,
"times_used": 12,
"starts_at": null,
"ends_at": null,
"is_active": true,
"state": "active",
"created_at": "2026-11-02T15:00:00Z",
"updated_at": "2026-11-03T09:30:00Z"
}
}Error responses
- 401
authenticationMissing, invalid, expired or revoked API key. - 403
permissionThe key lacks the scope, or the store's plan doesn't include the API. - 409
conflictThe Idempotency-Key was used with a different request, or that request is still running. - 422
invalid_requestInvalid parameters;errorslists each field. - 429
rate_limitedToo many requests. - 500
serverSomething went wrong on our side; safe to retry with the same Idempotency-Key.
Get a discount code
/discounts/{id}Required scopes:read_discounts
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | integer | The object id. |
Example request
curl "https://api.sellorchard.com/v1/discounts/120" \
-H "Authorization: Bearer $SELLORCHARD_API_KEY"Response200A discount code.
ShowHide response schema
dataDiscountrequiredShowHide child attributes
objectstringrequiredidintegerrequiredId.
codestringrequiredThe code (upper case).
titlestring | nullrequiredShown to shoppers.
typestringrequiredKind.
One of:
percentagefixedfree_shippingbuy_x_get_yvaluestringrequiredPercent (percentage) or amount (fixed).
pattern ^-?\d+\.\d{2}$
minimum_subtotalstring | nullrequiredMinimum subtotal.
pattern ^-?\d+\.\d{2}$
minimum_quantityinteger | nullrequiredMinimum items.
applies_tostringrequiredWhat it discounts.
One of:
allcategoriesproductsproduct_idsarray of integerrequiredProducts (applies_to products).
category_idsarray of integerrequiredCategories (applies_to categories).
once_per_customerbooleanrequiredOne use per customer.
usage_limitinteger | nullrequiredTotal uses allowed.
times_usedintegerrequiredUses so far.
starts_atstring<date-time> | nullrequiredStarts.
ends_atstring<date-time> | nullrequiredEnds.
is_activebooleanrequiredSwitched on.
statestringrequiredRight now.
One of:
activescheduledexpiredused_updisabledcreated_atstring<date-time>requiredCreated.
updated_atstring<date-time>requiredLast changed.
{
"data": {
"object": "discount",
"id": 31,
"code": "WELCOME10",
"title": "Welcome 10% off",
"type": "percentage",
"value": "10.00",
"minimum_subtotal": null,
"minimum_quantity": null,
"applies_to": "all",
"product_ids": [],
"category_ids": [],
"once_per_customer": true,
"usage_limit": null,
"times_used": 12,
"starts_at": null,
"ends_at": null,
"is_active": true,
"state": "active",
"created_at": "2026-11-02T15:00:00Z",
"updated_at": "2026-11-03T09:30:00Z"
}
}Error responses
- 401
authenticationMissing, invalid, expired or revoked API key. - 403
permissionThe key lacks the scope, or the store's plan doesn't include the API. - 404
not_foundNo such object in this store. - 429
rate_limitedToo many requests. - 500
serverSomething went wrong on our side; safe to retry with the same Idempotency-Key.
Update a discount code
/discounts/{id}Required scopes:write_discounts
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | integer | The object id. |
Request body
codestringLetters, numbers, - and _ (required on create; stored upper case).
titlestring | nullShown to shoppers.
typestringRequired on create.
One of:
percentagefixedfree_shippingvaluestring | number | nullPercent (≤ 100) or amount; required for percentage and fixed.
minimum_subtotalstring | number | nullminimum_quantityinteger | nullMinimum items.
applies_tostringDefault all.
One of:
allcategoriesproductsproduct_idsarray of integerWith applies_to products.
category_idsarray of integerWith applies_to categories.
once_per_customerbooleanOne use per customer.
usage_limitinteger | nullTotal uses.
starts_atstring<date-time> | nullStart.
ends_atstring<date-time> | nullEnd (after the start).
is_activebooleanDefault true.
Example request
curl -X PATCH "https://api.sellorchard.com/v1/discounts/120" \
-H "Authorization: Bearer $SELLORCHARD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "WELCOME10",
"type": "percentage",
"value": "10",
"once_per_customer": true
}'Response200A discount code.
ShowHide response schema
dataDiscountrequiredShowHide child attributes
objectstringrequiredidintegerrequiredId.
codestringrequiredThe code (upper case).
titlestring | nullrequiredShown to shoppers.
typestringrequiredKind.
One of:
percentagefixedfree_shippingbuy_x_get_yvaluestringrequiredPercent (percentage) or amount (fixed).
pattern ^-?\d+\.\d{2}$
minimum_subtotalstring | nullrequiredMinimum subtotal.
pattern ^-?\d+\.\d{2}$
minimum_quantityinteger | nullrequiredMinimum items.
applies_tostringrequiredWhat it discounts.
One of:
allcategoriesproductsproduct_idsarray of integerrequiredProducts (applies_to products).
category_idsarray of integerrequiredCategories (applies_to categories).
once_per_customerbooleanrequiredOne use per customer.
usage_limitinteger | nullrequiredTotal uses allowed.
times_usedintegerrequiredUses so far.
starts_atstring<date-time> | nullrequiredStarts.
ends_atstring<date-time> | nullrequiredEnds.
is_activebooleanrequiredSwitched on.
statestringrequiredRight now.
One of:
activescheduledexpiredused_updisabledcreated_atstring<date-time>requiredCreated.
updated_atstring<date-time>requiredLast changed.
{
"data": {
"object": "discount",
"id": 31,
"code": "WELCOME10",
"title": "Welcome 10% off",
"type": "percentage",
"value": "10.00",
"minimum_subtotal": null,
"minimum_quantity": null,
"applies_to": "all",
"product_ids": [],
"category_ids": [],
"once_per_customer": true,
"usage_limit": null,
"times_used": 12,
"starts_at": null,
"ends_at": null,
"is_active": true,
"state": "active",
"created_at": "2026-11-02T15:00:00Z",
"updated_at": "2026-11-03T09:30:00Z"
}
}Error responses
- 401
authenticationMissing, invalid, expired or revoked API key. - 403
permissionThe key lacks the scope, or the store's plan doesn't include the API. - 404
not_foundNo such object in this store. - 422
invalid_requestInvalid parameters;errorslists each field. - 429
rate_limitedToo many requests. - 500
serverSomething went wrong on our side; safe to retry with the same Idempotency-Key.
Delete a discount code
/discounts/{id}A code already used on orders is switched off instead (deleted: false).
Required scopes:write_discounts
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | integer | The object id. |
Example request
curl -X DELETE "https://api.sellorchard.com/v1/discounts/120" \
-H "Authorization: Bearer $SELLORCHARD_API_KEY"Response200Deleted.
ShowHide response schema
dataDeletedrequiredShowHide child attributes
objectstringrequiredObject type.
idintegerrequiredId.
deletedbooleanrequiredtrue: deleted. Discounts used on orders are switched off instead (deleted false, is_active false).
{
"data": {
"object": "product",
"id": 120,
"deleted": true
}
}Error responses
- 401
authenticationMissing, invalid, expired or revoked API key. - 403
permissionThe key lacks the scope, or the store's plan doesn't include the API. - 404
not_foundNo such object in this store. - 429
rate_limitedToo many requests. - 500
serverSomething went wrong on our side; safe to retry with the same Idempotency-Key.