Bulk-Generate Cart Rule Coupons
Generates several random coupon codes for a cart rule in one call — the Generate Coupons action on the Coupons tab of the admin Marketing → Promotions → Cart Rules screen.
TIP
New here? Read the Cart Rule Coupons overview for what these coupons do and how they relate to a cart rule.
Endpoint
| Endpoint | Method |
|---|---|
/api/admin/marketing/cart-rules/{cartRuleId}/coupons/generate | POST |
Details
- Requires an admin Bearer token and the
marketing.promotions.cart_rules.createpermission. - Generates
coupon_qtycodes of the givenformatandlength, optionally wrapped withprefix/suffix. - Each generated coupon inherits
usage_limit/usage_per_customer/expired_atfrom the parent cart rule and is created as a secondary code (type1,isPrimaryfalse). - Returns
generated(the count created) andcoupons(the full coupon rows).
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
length | int | yes | Code length, 4–30 |
format | string | yes | alphabetic, alphanumeric, or numeric |
prefix | string | no | Prepended to every generated code |
suffix | string | no | Appended to every generated code |
coupon_qty | int | yes | Number of codes to generate, 1–100 |

