Skip to main content
POST
Create a discount code

Authorizations

X-API-Key
string
header
required

Path Parameters

shopId
string
required

Shop ID (ObjectId)

Body

application/json
code
string
required

Discount code (uppercase)

Required string length: 1 - 50
Pattern: ^[A-Z0-9_-]+$
Example:

"LATO10"

scope
enum<string>
required

Scope

Available options:
all,
server,
product
Example:

"all"

type
enum<string>
required

Discount type

Available options:
percentage,
fixed
Example:

"percentage"

value
number
required

Value (percent or amount)

Required range: x >= 0.01
Example:

10

maxUsage
number
required

Max usage count

Required range: x >= 1
Example:

100

description
string

Description note

Maximum string length: 200
Example:

"Promocja na lato"

targets
string[]

Target IDs for non-all scope

expirationDate
string

Expiration date (ISO 8601) — omit for a permanent code

Example:

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

minOrderValue
number

Minimum order value

Required range: x >= 0
Example:

20

maxDiscountAmount
number

Max discount amount cap

Required range: x >= 0
Example:

50

Response

OK

success
boolean
Example:

true

data
object
message
string