Search docs ⌘K
esc
Type to search across all documentation pages
Commerce

Discounts

Create and manage discount codes with percentage or fixed-amount values, date ranges, and usage limits.

Create a discount

POST
/modules/commerce/discounts
commerce:write0.0000053 tokens

Create a new discount code.

curl
curl -X POST https://api.saasignal.saastemly.com/modules/commerce/discounts \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"code":"...","type":"driver","value":{"example":"data"}}'
json — 201 Created
{ "status": "ok" }
Body field
Type
Description
code required
string
1–64 chars
type required
string
value required
number
range >0
min_purchase_amount
number
max_discount_amount
number
applies_to
string
applies_to_ids
array
usage_limit
integer
range ≥-9007199254740991 .. ≤9007199254740991
per_customer_limit
integer
range ≥-9007199254740991 .. ≤9007199254740991
starts_at
string
ends_at
string
enabled
boolean
buy_quantity
integer
range ≥-9007199254740991 .. ≤9007199254740991
get_quantity
integer
range ≥-9007199254740991 .. ≤9007199254740991
metadata
object
Error responses
401 Unauthorized
402 Insufficient tokens
429 Rate limited

List discounts

GET
/modules/commerce/discounts
commerce:read0.0000008 tokens

List discount codes.

curl
curl https://api.saasignal.saastemly.com/modules/commerce/discounts \
  -H "Authorization: Bearer sk_live_..."
json — 200 OK
{ "status": "ok" }
Query param
Type
Description
enabled
boolean
type
string
limit
integer
range ≥1 .. ≤100default 25
cursor
string
Error responses
401 Unauthorized
402 Insufficient tokens
429 Rate limited

Get a discount

GET
/modules/commerce/discounts/{discount_id}
commerce:read0.0000008 tokens

Retrieve a single discount.

curl
curl https://api.saasignal.saastemly.com/modules/commerce/discounts/{discount_id} \
  -H "Authorization: Bearer sk_live_..."
json — 200 OK
{ "status": "ok" }
Path param
Type
Description
discount_id required
string
Error responses
401 Unauthorized
402 Insufficient tokens
404 Not found
429 Rate limited

Update a discount

PATCH
/modules/commerce/discounts/{discount_id}
commerce:write0.0000053 tokens

Update a discount code.

curl
curl -X PATCH https://api.saasignal.saastemly.com/modules/commerce/discounts/{discount_id} \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{}'
json — 200 OK
{ "status": "ok" }
Path param
Type
Description
discount_id required
string
Body field
Type
Description
code
string
1–64 chars
type
string
value
number
range >0
min_purchase_amount
mixed
max_discount_amount
mixed
applies_to
string
applies_to_ids
array
usage_limit
mixed
per_customer_limit
mixed
starts_at
mixed
ends_at
mixed
enabled
boolean
buy_quantity
mixed
get_quantity
mixed
metadata
object
Error responses
401 Unauthorized
402 Insufficient tokens
404 Not found
429 Rate limited

Delete a discount

DELETE
/modules/commerce/discounts/{discount_id}
commerce:admin

Permanently remove a discount.

curl
curl -X DELETE https://api.saasignal.saastemly.com/modules/commerce/discounts/{discount_id} \
  -H "Authorization: Bearer sk_live_..."
json — 200 OK
{ "status": "ok" }
Path param
Type
Description
discount_id required
string
Error responses
401 Unauthorized
402 Insufficient tokens
404 Not found
429 Rate limited