Skip to main content
POST
Typescript (SDK)

Authorizations

Authorization
string
header
required

API key in the format: Bearer {api_token}

Headers

Idempotency-Key
string

Makes this write safe to retry: a repeat with the same key replays the first response instead of creating a second resource. Scoped to the account, remembered for 24 hours; reusing a key with a different payload is an error.

Maximum string length: 255

Body

application/json
code
string
discount_type
enum<string>
Available options:
percentage,
fixed
amount_off
integer | null
percent_off
number | null
currency
string | null
duration
enum<string>
Available options:
forever,
once,
repeating
duration_in_months
integer | null
starts_at
string<date-time> | null

When the code becomes usable. Checkout rejects it before this time; omit it to make the code usable right away. For a sale that starts later, create the discount now with starts_at set rather than scheduling its creation.

redeem_by
string<date-time> | null

When the code stops being usable. Must be in the future and after starts_at.

max_redemptions
integer | null

How many live orders can use the code, across all customers. Test purchases don't count. The limit set at creation also stays on the Stripe coupon, so raising it later has no effect past that number.

Required range: x >= 1
minimum_amount
integer | null

Smallest order subtotal, in cents before the discount, that can use the code. Requires currency; an order in another currency can't use the code. null removes it.

Required range: x >= 1
once_per_customer
boolean

Each customer can use the code on one live order.

first_order_only
boolean

Only customers with no earlier live paid order from this business can use the code. Free orders and test purchases don't count as earlier orders.

price_variants
string[]

Response

Discount created

id
string
required
object
string
required
status
enum<string>
required
Available options:
active,
inactive
discount_type
enum<string>
required
Available options:
percentage,
fixed
code
string
required
amount_off
integer | null
required
duration
enum<string>
required
Available options:
forever,
once,
repeating
duration_in_months
integer | null
required
max_redemptions
integer | null
required
times_redeemed
integer
required
starts_at
string<date-time> | null
required
redeem_by
string<date-time> | null
required
minimum_amount
integer | null
required
once_per_customer
boolean
required
first_order_only
boolean
required
created_at
string<date-time>
required
updated_at
string<date-time>
required
percent_off
number<double> | null
required
currency
string | null
required