CouponCodes
Create a coupon code
Generates a new CouponCode under the parent Coupon. All body fields are optional — pass code to set a specific string, omit to auto-generate. Set valid_from_date/valid_to_date to time-limit the code, multi_use to allow multiple redemptions, and customer_credit_id + customer_id to pre-allocate it.
Requires the SETTINGS_MANAGE permission on the coupon's site. Returns 422 if code collides with another code under the same coupon (codes are unique per coupon, not globally).
post/shop/coupons/{couponId}/codes
Request body
Example request
{
"code": "SUMMER2026",
"valid_from_date": "2026-06-01T00:00:00Z",
"valid_to_date": "2026-08-31T23:59:59Z",
"customer_credit_id": "5f1234567890abcdef123456",
"customer_id": "11111111-1111-1111-1111-111111111111",
"revenue": 5000
}Response
A single CouponCode.
Example response
{
"data": {
"id": "5f1234567890abcdef123456",
"code": "SUMMER2026",
"coupon_id": "5f1234567890abcdef123456",
"valid_from_date": "2026-06-01T00:00:00Z",
"valid_to_date": "2026-08-31T23:59:59Z",
"customer_credit_id": "5f1234567890abcdef123456",
"customer_id": "11111111-1111-1111-1111-111111111111",
"revenue": 5000
}
}