A store's discount codes. Creating and changing them needs a plan with coupons.
All paths are relative to the base URL https://api.store.link/v1. Every request needs your API key; see Overview.
Endpoints
| Endpoint | What it does |
|---|---|
GET /stores/{storeId}/coupons | List coupons |
POST /stores/{storeId}/coupons | Create a coupon |
PATCH /stores/{storeId}/coupons/{couponId} | Change a coupon |
DELETE /stores/{storeId}/coupons/{couponId} | Delete a coupon |
Coupon types
| Type | Fields it uses |
|---|---|
amount_off_order | discount_type, discount_amount |
amount_off_product | discount_type, discount_amount, applies_to, targets |
buy_x_get_y | customer_buys, customer_gets, max_uses_per_order |
Every type also takes code, enabled, valid_from, valid_till, use_per_customer and min_order_amount. Fields a type doesn't use are null (or an empty targets) in responses.
List coupons
GET /stores/{storeId}/coupons
Every coupon in the store, with its discount, validity and how often it's been used.
Your role in the store needs to read coupons.
Path parameters
| Name | Type | Description |
|---|---|---|
storeId | string required | A store id from GET /stores. |
Example request
curl 'https://api.store.link/v1/stores/665f1c2ab4e8a90012ab34cd/coupons' \
-H 'Authorization: Bearer YOUR_API_KEY'Response
| Field | Type | Description |
|---|---|---|
data | array of object | |
data[].id | string | |
data[].type | string | amount_off_order uses discount_type and discount_amount; amount_off_product adds applies_to and targets; buy_x_get_y uses customer_buys, customer_gets and max_uses_per_order. One of: amount_off_order, amount_off_product, buy_x_get_y. |
data[].code | string | What customers type at checkout, in lowercase. |
data[].enabled | boolean | |
data[].valid_from | string (date-time), nullable | |
data[].valid_till | string (date-time), nullable | null for no end date. |
data[].use_per_customer | string, nullable | unlimited or once. |
data[].min_order_amount | number, nullable | |
data[].max_discount_amount | number, nullable | Caps a percentage discount. |
data[].discount_type | string, nullable | One of: percentage, flat. |
data[].discount_amount | number, nullable | A percentage, or an amount in the store currency. |
data[].applies_to | string, nullable | One of: products, categories. |
data[].targets | array of object | |
data[].targets[].slug | string | A product slug, or a category slug when applies_to is categories. |
data[].targets[].name | string | |
data[].targets[].variant | object, nullable | One variant of the product, or null for all of them. |
data[].targets[].variant.key | string | |
data[].targets[].variant.name | string | |
data[].customer_buys | object, nullable | |
data[].customer_buys.min_quantity | integer, nullable | |
data[].customer_buys.applies_to | string, nullable | One of: products, categories. |
data[].customer_buys.targets | array of object | Same fields as targets. |
data[].customer_gets | object, nullable | What the customer gets free. |
data[].customer_gets.quantity | integer, nullable | |
data[].customer_gets.applies_to | string, nullable | One of: products, categories. |
data[].customer_gets.targets | array of object | Same fields as targets. |
data[].max_uses_per_order | integer, nullable | |
data[].times_used | integer |
Example response
{
"data": [
{
"id": "6662b1e4d3a2c90014de67f0",
"type": "amount_off_order",
"code": "welcome10",
"enabled": true,
"valid_from": "2026-11-20T10:15:00.000Z",
"valid_till": "2026-12-31T23:59:59.000Z",
"use_per_customer": "once",
"min_order_amount": 30,
"max_discount_amount": 20,
"discount_type": "percentage",
"discount_amount": 10,
"applies_to": null,
"targets": [],
"customer_buys": null,
"customer_gets": null,
"max_uses_per_order": null,
"times_used": 12
}
]
}Errors
The common errors: 400 invalid_request, 401 unauthorized, 403 insufficient_permission, 404 store_not_found, 429 rate_limited, 500 internal_error. See Errors in the Overview.
Create a coupon
POST /stores/{storeId}/coupons
Creates a discount code. amount_off_order takes discount_type and discount_amount; amount_off_product also takes applies_to and targets; buy_x_get_y takes customer_buys, customer_gets and max_uses_per_order. A code the store already has is a conflict.
Your role in the store needs to write coupons.
Path parameters
| Name | Type | Description |
|---|---|---|
storeId | string required | A store id from GET /stores. |
Request body
| Field | Type | Description |
|---|---|---|
type | string required | One of: amount_off_order, amount_off_product, buy_x_get_y. |
code | string required | What customers type at checkout. Stored in lowercase, and unique in the store. |
enabled | boolean | Default true. |
valid_from | string (date-time) | Default now. |
valid_till | string (date-time) | Leave out for no end date. |
use_per_customer | string | Default unlimited. One of: unlimited, once. |
min_order_amount | number | |
discount_type | string | One of: percentage, flat. |
discount_amount | number | A percentage, or an amount in the store currency. Greater than 0. |
max_discount_amount | number | Caps a percentage discount. |
applies_to | string | One of: products, categories. |
targets | array of object | |
targets[].slug | string required | A product slug, or a category slug when applies_to is categories. |
targets[].name | string | |
targets[].variant | object | One variant of the product, by its key; leave out for all of them. |
targets[].variant.key | string required | |
targets[].variant.name | string required | |
customer_buys | object | |
customer_buys.min_quantity | integer required | Greater than 0. |
customer_buys.applies_to | string required | One of: products, categories. |
customer_buys.targets | array of object required | Same fields as targets. |
customer_gets | object | What the customer gets free. |
customer_gets.quantity | integer required | Greater than 0. |
customer_gets.applies_to | string required | One of: products, categories. |
customer_gets.targets | array of object required | Same fields as targets. |
max_uses_per_order | integer | How many times the deal can apply in one order. Greater than 0. |
Example request: 10% off orders over 30
curl -X POST 'https://api.store.link/v1/stores/665f1c2ab4e8a90012ab34cd/coupons' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"type": "amount_off_order",
"code": "WELCOME10",
"valid_till": "2026-12-31T23:59:59.000Z",
"use_per_customer": "once",
"min_order_amount": 30,
"discount_type": "percentage",
"discount_amount": 10,
"max_discount_amount": 20
}'Example request: buy 2 tees, get 1 free
curl -X POST 'https://api.store.link/v1/stores/665f1c2ab4e8a90012ab34cd/coupons' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"type": "buy_x_get_y",
"code": "TEES3FOR2",
"customer_buys": {
"min_quantity": 2,
"applies_to": "categories",
"targets": [{ "slug": "t-shirts" }]
},
"customer_gets": {
"quantity": 1,
"applies_to": "products",
"targets": [{ "slug": "classic-tee" }]
},
"max_uses_per_order": 1
}'Response
The coupon, with the fields listed under List coupons (each item in data) above.
Errors
- 403
plan_upgrade_required: The store's plan doesn't include this. The message names the plan it needs. - 409
conflict: The write collides with what the store has, such as a code or slug in use.
Plus the common errors: 400 invalid_request, 401 unauthorized, 403 insufficient_permission, 404 store_not_found, 429 rate_limited, 500 internal_error. See Errors in the Overview.
Change a coupon
PATCH /stores/{storeId}/coupons/{couponId}
Changes only the fields you send, including enabled to pause or resume the coupon; customer_buys and customer_gets replace the whole object. An empty body changes nothing. A coupon's type can't change: delete it and create another.
Your role in the store needs to write coupons.
Path parameters
| Name | Type | Description |
|---|---|---|
storeId | string required | A store id from GET /stores. |
couponId | string required | A coupon id from GET /stores/{storeId}/coupons. A 24-character id. |
Request body
The same fields as Create a coupon, all optional. type, if sent, must be the coupon's own type.
Example request: pause a coupon
curl -X PATCH 'https://api.store.link/v1/stores/665f1c2ab4e8a90012ab34cd/coupons/6662b1e4d3a2c90014de67f0' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"enabled": false
}'Response
The coupon, with the fields listed under List coupons (each item in data) above.
Errors
- 403
plan_upgrade_required: The store's plan doesn't include this. The message names the plan it needs. - 404
not_found: Nothing with this id in this store, or something the body names, such as a product or coupon, is not there. - 409
conflict: The write collides with what the store has, such as a code or slug in use.
Plus the common errors: 400 invalid_request, 401 unauthorized, 403 insufficient_permission, 404 store_not_found, 429 rate_limited, 500 internal_error. See Errors in the Overview.
Delete a coupon
DELETE /stores/{storeId}/coupons/{couponId}
Deletes the coupon. To pause it instead, change it with enabled false.
Your role in the store needs to write coupons.
Path parameters
| Name | Type | Description |
|---|---|---|
storeId | string required | A store id from GET /stores. |
couponId | string required | A coupon id from GET /stores/{storeId}/coupons. A 24-character id. |
Example request
curl -X DELETE 'https://api.store.link/v1/stores/665f1c2ab4e8a90012ab34cd/coupons/6662b1e4d3a2c90014de67f0' \
-H 'Authorization: Bearer YOUR_API_KEY'Response
| Field | Type | Description |
|---|---|---|
id | string | |
deleted | true |
Example response
{
"id": "6662b1e4d3a2c90014de67f0",
"deleted": true
}Errors
- 404
not_found: Nothing with this id in this store, or something the body names, such as a product or coupon, is not there.
Plus the common errors: 400 invalid_request, 401 unauthorized, 403 insufficient_permission, 404 store_not_found, 429 rate_limited, 500 internal_error. See Errors in the Overview.
