Skip to Content
API ReferenceCoupons

Create a coupon

Create a discount code for your store.

Create a discount code for your store.

POST
/v2/coupons

Authorization

headerAuthorizationBearer <API Key>

Provide your SellApp API key as a bearer token.

Header Parameters

Idempotency-Key?string

Reuse this key only for an identical retry. A replay returns Idempotent-Replayed: true.

Length8 <= length <= 255
X-STORE?string

Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.

Request Body

application/json
  1. body
code*string
Lengthlength <= 255
type*string
Value in"PERCENTAGE""AMOUNT"
discount*|

A decimal discount value of at least 1. Percentage discounts cannot exceed 100; amount discounts use the store currency's major unit. A subscriptions coupon cannot take 100% off: that returns 422 on discount, so offer a free trial instead.

Range1 <= value
Lengthlength <= 255
store_wide*boolean
products?array<integer>

Product IDs the coupon applies to when store_wide is false. Each product you add must sell a variant of the coupon's kind: a subscription plan for a subscriptions coupon, or a one-time variant for a one_time one. Another product returns 422 on products. It may be an empty list when the same request sends store_wide: true, so a store-wide coupon you read can be sent back unchanged. Otherwise an empty list returns 422 on products.

product_variants?array<integer>

Optional variant restrictions. Every variant must belong to a selected product. Products without listed variants remain eligible on all variants. Each variant you add must be of the coupon's kind, a subscription plan or a one-time variant; another returns 422 on product_variants.

limit?|
Range1 <= value
expires_at?|

A future date and time, or null for no expiry.

Formatdate-time
minimum_amount?||

A decimal minimum amount in the store currency's major unit that the order lines of the coupon's kind must reach, or null for no minimum.

Range1 <= value
Lengthlength <= 255
applies_to?string

What the coupon discounts: one_time for one-time purchases, or subscriptions for the first payments of a subscription plan. A new coupon defaults to one_time, and an update that leaves this out keeps the current kind. The coupon only discounts order lines of its kind.

Value in"one_time""subscriptions"
subscription_payments?|

How many payments a subscriptions coupon discounts, counting the signup payment as the first, so 3 discounts the signup and the next two renewals. A subscriptions coupon needs one, and an update that leaves it out keeps the stored number. Missing on a subscriptions coupon, or outside 1 to 36, it returns 422 on subscription_payments with The number of discounted payments must be between 1 and 36. A one_time coupon always stores null here.

Range1 <= value <= 36
maximum_discount_amount?||

The most a percentage coupon takes off one order, as a decimal amount of at least 1 in the major unit of the order's currency, with at most two decimals: 15.50 caps the discount at 15.50. Send null to remove the cap. Only a PERCENTAGE coupon can have a cap: sending one for an AMOUNT coupon returns 422 on maximum_discount_amount, and changing a coupon to AMOUNT removes its cap.

Range1 <= value
Lengthlength <= 255

Response Body

Coupon created successfully.

application/json
  1. response
data*
curl -X POST 'https://sell.app/api/v2/coupons' \  -H 'Idempotency-Key: project-library-2026-09-04' \  -H 'X-STORE: launch-lab' \  -H 'Content-Type: application/json' \  -d '{  "code": "PLAN10",  "type": "PERCENTAGE",  "discount": 10,  "store_wide": false,  "products": [    123,    456  ],  "product_variants": [    1001,    1002  ]}'
{  "data": {    "id": 1,    "code": "PLAN10",    "type": "PERCENTAGE",    "discount": "10",    "limit": null,    "store_wide": false,    "minimum_amount": null,    "expires_at": null,    "created_at": "2026-08-30T12:00:01.000000Z",    "updated_at": "2026-08-30T12:00:01.000000Z",    "store_id": 1,    "deleted_at": null,    "products": [      123,      456    ],    "product_variants": [      1001,      1002    ],    "maximum_discount_amount": null,    "applies_to": "one_time",    "subscription_payments": null  }}

Limit a coupon to specific products or variants

Set store_wide to false and include a products array containing the product IDs the coupon should apply to.

Optionally include product_variants to restrict any selected product to particular variants. Every variant ID must belong to one of the products in products. If a selected product has no IDs in product_variants, the coupon applies to all of that product's current and future variants.

{
  "code": "PLAN10",
  "type": "PERCENTAGE",
  "discount": 10,
  "store_wide": false,
  "products": [123, 456],
  "product_variants": [1001, 1002]
}

In this example, product 123 is limited to variants 1001 and 1002, while product 456 accepts the coupon on every variant. When store_wide is true, the API ignores product and variant scoping.

Cap a percentage discount

Send maximum_discount_amount with a PERCENTAGE coupon to limit how much it takes off one order. It is a decimal amount in the major unit of the order's currency, at least 1 with at most two decimals: a 20% coupon with "maximum_discount_amount": "15.50" takes 20% off orders up to 77.50 and 15.50 off larger ones. An AMOUNT coupon with a cap returns 422 on maximum_discount_amount.

Discount a subscription's first payments

Set applies_to to subscriptions and subscription_payments to how many payments the coupon discounts. This coupon takes 20% off the first three payments of plan 4321, a variant of product 120:

{
  "code": "MEMBER20",
  "type": "PERCENTAGE",
  "discount": 20,
  "store_wide": false,
  "products": [120],
  "product_variants": [4321],
  "applies_to": "subscriptions",
  "subscription_payments": 3
}

The signup is the first discounted payment, so the next two renewals are discounted too, and then the plan bills its full price. Every product and variant you pick must sell a subscription, or the request returns 422 on products or product_variants. A subscriptions coupon without subscription_payments returns 422 on subscription_payments. Subscription coupons lists the payment methods that carry the discount.