Skip to content

Create a discount (code or automatic)

POST
/admin/v1/discounts
curl --request POST \
--url https://your-store.example.com/admin/v1/discounts \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "code": "example", "type": "percentage", "value": 1, "currency": "example", "minCartAmount": 1, "appliesTo": "all", "targetIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "customerSegment": "all", "stackable": false, "usageLimitTotal": 1, "usageLimitPerCustomer": 1, "startsAt": "2026-04-15T12:00:00Z", "endsAt": "2026-04-15T12:00:00Z", "active": true }'
Media type application/json
object
name
required
string
>= 1 characters <= 255 characters
code
Any of:
string
>= 1 characters <= 64 characters
type
required
string
Allowed values: percentage fixed
value
required
integer
<= 9007199254740991
currency
Any of:
string
/^[A-Z]{3}$/
minCartAmount
Any of:
integer
<= 9007199254740991
appliesTo
string
default: all
Allowed values: all products categories
targetIds
Any of:
Array<string>
<= 1000 items
customerSegment
Any of:
string
Allowed values: all first_time returning b2b
stackable
boolean
usageLimitTotal
Any of:
integer
> 0 <= 9007199254740991
usageLimitPerCustomer
Any of:
integer
> 0 <= 9007199254740991
startsAt
Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$/
endsAt
Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$/
active
boolean
default: true