# Coupons

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
[https://store.link/help/developer/article/1165].


ENDPOINTS

EndpointWhat it doesGET /stores/{storeId}/couponsList couponsPOST
/stores/{storeId}/couponsCreate a couponPATCH
/stores/{storeId}/coupons/{couponId}Change a couponDELETE
/stores/{storeId}/coupons/{couponId}Delete a coupon


COUPON TYPES

TypeFields it usesamount_off_orderdiscount_type,
discount_amountamount_off_productdiscount_type, discount_amount, applies_to,
targetsbuy_x_get_ycustomer_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

NameTypeDescriptionstoreIdstring
requiredA store id from GET /stores.


EXAMPLE REQUEST

curl 'https://api.store.link/v1/stores/665f1c2ab4e8a90012ab34cd/coupons' \
  -H 'Authorization: Bearer YOUR_API_KEY'


RESPONSE

FieldTypeDescriptiondataarray of
objectdata[].idstringdata[].typestringamount_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[].codestringWhat
customers type at checkout, in
lowercase.data[].enabledbooleandata[].valid_fromstring (date-time),
nullabledata[].valid_tillstring (date-time), nullablenull for no end
date.data[].use_per_customerstring, nullableunlimited or
once.data[].min_order_amountnumber, nullabledata[].max_discount_amountnumber,
nullableCaps a percentage discount.data[].discount_typestring, nullableOne of:
percentage, flat.data[].discount_amountnumber, nullableA percentage, or an
amount in the store currency.data[].applies_tostring, nullableOne of: products,
categories.data[].targetsarray of objectdata[].targets[].slugstringA product
slug, or a category slug when applies_to is
categories.data[].targets[].namestringdata[].targets[].variantobject,
nullableOne variant of the product, or null for all of
them.data[].targets[].variant.keystringdata[].targets[].variant.namestringdata[].customer_buysobject,
nullabledata[].customer_buys.min_quantityinteger,
nullabledata[].customer_buys.applies_tostring, nullableOne of: products,
categories.data[].customer_buys.targetsarray of objectSame fields as
targets.data[].customer_getsobject, nullableWhat the customer gets
free.data[].customer_gets.quantityinteger,
nullabledata[].customer_gets.applies_tostring, nullableOne of: products,
categories.data[].customer_gets.targetsarray of objectSame fields as
targets.data[].max_uses_per_orderinteger, nullabledata[].times_usedinteger


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
[https://store.link/help/developer/article/1165].


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

NameTypeDescriptionstoreIdstring
requiredA store id from GET /stores.


REQUEST BODY

FieldTypeDescriptiontypestring
requiredOne of: amount_off_order, amount_off_product, buy_x_get_y.codestring
requiredWhat customers type at checkout. Stored in lowercase, and unique in the
store.enabledbooleanDefault true.valid_fromstring (date-time)Default
now.valid_tillstring (date-time)Leave out for no end
date.use_per_customerstringDefault unlimited. One of: unlimited,
once.min_order_amountnumberdiscount_typestringOne of: percentage,
flat.discount_amountnumberA percentage, or an amount in the store currency.
Greater than 0.max_discount_amountnumberCaps a percentage
discount.applies_tostringOne of: products, categories.targetsarray of
objecttargets[].slugstring
requiredA product slug, or a category slug when applies_to is
categories.targets[].namestringtargets[].variantobjectOne variant of the
product, by its key; leave out for all of them.targets[].variant.keystring
requiredtargets[].variant.namestring
requiredcustomer_buysobjectcustomer_buys.min_quantityinteger
requiredGreater than 0.customer_buys.applies_tostring
requiredOne of: products, categories.customer_buys.targetsarray of object
requiredSame fields as targets.customer_getsobjectWhat the customer gets
free.customer_gets.quantityinteger
requiredGreater than 0.customer_gets.applies_tostring
requiredOne of: products, categories.customer_gets.targetsarray of object
requiredSame fields as targets.max_uses_per_orderintegerHow 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
[https://store.link/help/developer/article/1165].


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

NameTypeDescriptionstoreIdstring
requiredA store id from GET /stores.couponIdstring
requiredA 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
[https://store.link/help/developer/article/1165].


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

NameTypeDescriptionstoreIdstring
requiredA store id from GET /stores.couponIdstring
requiredA 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

FieldTypeDescriptionidstringdeletedtrue


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
[https://store.link/help/developer/article/1165].