Create a coupon or store discount
coupons:writeRate limit writesIdempotent with Idempotency-KeyTwo types. coupon_type product: discount + discount_type (percent | fixed | free), with products[] and tags[] to limit it. coupon_type commerce (store discount): kind order | product | buy_x_get_y | free_shipping; method code (default) or automatic; discount_type percent | fixed (with value), or free (buy_x_get_y only); applies_to for kind product; buy/get for buy_x_get_y; optional min_subtotal, min_quantity, customer_orders_min/max, once_per_customer, combines_with. code is always required — for an automatic discount it is the title shown on the cart. is_active defaults to true. Product, collection and tag ids must belong to this project.
More examples: - Product coupon: {"code":"VIP20","coupon_type":"product","discount":20,"discount_type":"percent","products":[812]} - Off some products: {"code":"TEES5","coupon_type":"commerce","kind":"product","discount_type":"fixed","value":5,"applies_to":{"collection_ids":[31]}} - Buy 2 get 1 free: {"code":"B2G1","coupon_type":"commerce","kind":"buy_x_get_y","discount_type":"free","buy":{"quantity":2,"collection_ids":[31]},"get":{"quantity":1,"collection_ids":[31]}} - Automatic free shipping: {"code":"Free shipping over $75","coupon_type":"commerce","method":"automatic","kind":"free_shipping","min_subtotal":75}
Authorization
ESTAGE-API-KeystringheaderrequiredA project key, est_live_…, from Settings → API keys. Call from server code only.
Body
application/jsoncodestringrequired≤ 255 charsWhat the buyer types; unique in the project. For an automatic discount (method automatic) it is the title the buyer sees on the cart. title is accepted as an alias.
coupon_typestringrequiredproduct: a coupon on products sold through product checkout (discount, discount_type, products, tags). commerce: a store discount (method, kind, discount_type, value, applies_to, buy/get, minimums, combines_with).
One of product, commerce
is_activebooleandefault trueusage_countintegernullable≥ 1How many times it can be used in total; null = unlimited.
start_datestringdateend_datestringdatecommentsstringnullable≤ 2000 charsInternal note.
discountintegernullable≥ 0coupon_type product only (required there): the amount, a whole number — percent or money depending on discount_type. For commerce, value is used.
discount_typestringnullableRequired for coupon_type product, and for commerce kinds except free_shipping. For commerce, free is allowed only with kind buy_x_get_y; for a 100% off elsewhere use percent 100.
One of percent, fixed, free
recurring_rebillsbooleancoupon_type product only.
productsarray of integernullable≤ 500 itemscoupon_type product only: product ids of this project the coupon applies to. Ignored for commerce (use applies_to).
tagsarray of integernullable≤ 100 itemscoupon_type product only: contact tag ids of this project; only buyers with one of these tags can use the coupon. Ignored for commerce.
methodstringnullabledefault "code"commerce only: code = the buyer types code; automatic = applied to every qualifying cart.
One of code, automatic
kindstringnullablecommerce only, required there. order: off the whole order. product: off the products in applies_to. buy_x_get_y: buy what buy says, get get discounted. free_shipping: shipping is free (value and discount_type are ignored).
One of order, product, buy_x_get_y, free_shipping
valuenumbernullable≥ 0commerce only: required for percent (above 0, at most 100) and fixed (money in the store currency). Ignored for free and free_shipping.
applies_toobjectnullablecommerce kind product only: which products are discounted. Omitted or all lists empty = every product. Ignored for other kinds.
Show 3 fields
product_idsarray of integerProducts of this project.
product_typesarray of stringProduct type values (as on the product).
collection_idsarray of integerCollections of this project.
buyobjectnullablecommerce kind buy_x_get_y only (required there): what the buyer must buy — quantity or amount, plus an optional product scope.
Show 5 fields
quantityinteger≥ 1amountnumber≥ 0Spend at least this much instead of a quantity.
product_idsarray of integerproduct_typesarray of stringcollection_idsarray of integergetobjectnullablecommerce kind buy_x_get_y only: what the buyer gets discounted (by discount_type/value, or free).
Show 5 fields
quantityintegerdefault 1≥ 1max_repeatsinteger≥ 1How many times the offer can apply in one order.
product_idsarray of integerproduct_typesarray of stringcollection_idsarray of integermin_subtotalnumbernullable≥ 0commerce only: the cart subtotal needed.
min_quantityintegernullable≥ 1commerce only: the number of items needed.
customer_orders_minintegernullable≥ 0commerce only: the buyer must have at least this many earlier orders.
customer_orders_maxintegernullable≥ 0commerce only: the buyer must have at most this many earlier orders (0 = first order only).
once_per_customerbooleancommerce only.
combines_withobjectnullablecommerce only: which other discount classes this one may stack with. Missing keys = false.
Show 3 fields
productbooleanorderbooleanshippingbooleanHeaders
Idempotency-Keystring≤ 255 charsAny unique string per attempt. A retry with the same key gets the first answer back instead of doing the work twice.
curl --request POST \ --url 'https://api.estage.com/v1/coupons' \ --header 'ESTAGE-API-Key: est_live_your-api-key' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: your-unique-key' \ --data '{ "code": "SUMMER10", "coupon_type": "commerce", "kind": "order", "discount_type": "percent", "value": 10, "min_subtotal": 50, "end_date": "2027-01-31" }'
{
"data": {
"id": 412,
"code": "SUMMER10",
"coupon_type": "commerce",
"method": "code",
"kind": "order",
"discount_type": "percent",
"discount": 10,
"value": "10.00",
"applies_to": null,
"buy": null,
"get": null,
"min_subtotal": "50.00",
"min_quantity": null,
"customer_orders_min": null,
"customer_orders_max": null,
"once_per_customer": false,
"combines_with": {
"product": false,
"order": false,
"shipping": false
},
"products": null,
"tags": null,
"recurring_rebills": false,
"usage_count": null,
"used_count": 0,
"is_active": true,
"usable_now": true,
"start_date": null,
"end_date": "2027-01-31",
"comments": null,
"summary": "10% off the order",
"created_at": "2026-11-02T14:05:31Z",
"updated_at": "2026-11-02T14:05:31Z"
}
}{ error: { code, message, details } }.