Skip to content

Bulk-Generate Cart Rule Coupons

EndpointMethod
/api/admin/marketing/cart-rules/{cartRuleId}/coupons/generatePOST

Generates coupon_qty random codes of the given format and length, optionally with prefix/suffix. Inherits usage_limit / usage_per_customer / expired_at from the parent cart rule.

Request Body

FieldTypeRequiredNotes
lengthint 4-30yesAlso accepted as code_length.
formatenumyesalphabetic, alphanumeric, numeric (core's spelling alphabetical also accepted). Also accepted as code_format.
prefixstringnoAlso code_prefix.
suffixstringnoAlso code_suffix.
coupon_qtyint 1-100yes

Bulk-generate accepts both shapes

The endpoint accepts both the spec's friendlier keys (length, format, prefix, suffix) and the core's keys (code_length, code_format, code_prefix, code_suffix).

Permission: marketing.promotions.cart_rules.create.

Released under the MIT License.