Skip to main content
POST
Create coupon

Endpoint

POST /stores/{storeId}/coupons Creates a new coupon for products and/or categories.

Authentication

  • Private route.
  • Requires header Authorization with your API key and active plan.

Route parameters


Body (JSON)

At least one of productIds and categoryIds must be sent.

Request example


Standard snippet (cURL)

Use the cURL example from the Request example section above as the official snippet.

Success response (201)


Possible errors

  • 400 INVALID_DATA -> invalid body
  • 400 INVALID_DATA_CODE -> code missing or outside 3 to 32 characters
  • 400 INVALID_DATA_DISCOUNT -> discount missing or outside 1 to 100
  • 400 INVALID_DATA_USE_LIMIT -> useLimit outside -1 to 9999
  • 400 INVALID_DATA_RULES -> invalid or malformed rules
  • 400 INVALID_DATA_EXPIRED_AT -> invalid expiredAt or not in the future
  • 400 INVALID_DATA_SCOPE_REQUIRED -> neither productIds nor categoryIds was sent
  • 400 RELATION_NOT_FOUND -> invalid product/category
  • 401 API_KEY_NOT_PROVIDED -> Authorization header not provided
  • 401 INVALID_API_KEY -> invalid API key
  • 401 UNAUTHENTICATED -> unauthenticated user
  • 403 USER_DISABLED -> user disabled
  • 403 NO_ACTIVE_SUBSCRIPTION -> no active plan
  • 403 COUPON_LIMIT_REACHED -> plan coupon limit reached
  • 404 STORE_NOT_FOUND -> store not found
  • 409 COUPON_ALREADY_EXISTS -> code already exists
  • 429 RATE_LIMIT_EXCEEDED -> per-minute rate limit exceeded
  • 500 INTERNAL_SERVER_ERROR -> internal error
  • 503 SERVICE_UNAVAILABLE -> service unavailable

Authorizations

Authorization
string
header
default:YOUR_API_KEY_HERE
required

Path Parameters

storeId
string
required
Required string length: 1 - 50

Body

application/json

Coupon details (code, discount, expiration).

code
string
required
Required string length: 3 - 32
discount
integer
required
Required range: 1 <= x <= 100
useLimit
integer | null
Required range: -1 <= x <= 9999
rules
object[] | null
Maximum array length: 32
expiredAt
string<date-time> | null
productIds
string[]
Required string length: 1 - 50
categoryIds
string[]
Required string length: 1 - 50

Response

Create coupon.

code
string
required
Example:

"COUPON_CREATED"

coupon
object
required

Store discount coupon.