Skip to main content
POST
Create a discount code

Authorizations

X-Suby-Api-Key
string
header
required

API key authentication

Body

application/json
name
string
required

The discount code customers enter at checkout.

Required string length: 1 - 50
Example:

"WELCOME10"

productIds
required

Either the literal string "all" (applies to every product you own) or a non-empty array of product IDs the code is valid for.

Available options:
all
Example:
discountType
enum<string>
default:FIXED

Whether the discount is a percentage or a fixed cents amount.

Available options:
PERCENT,
FIXED
Example:

"FIXED"

discountPercent
integer

Percentage off (1–100). Required when discountType is PERCENT, must NOT be set otherwise.

Required range: 1 <= x <= 100
Example:

10

discountAmountCents
integer

Fixed amount off in cents, applied in each target product's currency. Required when discountType is FIXED, must NOT be set otherwise.

Required range: x >= 1
Example:

500

preApply
boolean
default:false

When true, the discount is applied automatically at checkout without the customer entering the code.

Example:

false

maxUses
integer

Maximum number of times the code can be redeemed. Omit for effectively unlimited.

Required range: x >= 1
Example:

100

expiresAt
string<date-time> | null

Expiration date (must be in the future). Omit for no expiry.

Example:

"2026-12-31T23:59:59Z"

isActive
boolean
default:true

Whether the code is active and redeemable.

Response

Discount code created

success
boolean
Example:

true

data
object