Skip to content

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

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

Details

  • Requires an admin Bearer token and the marketing.promotions.cart_rules.create permission.
  • Generates coupon_qty codes of the given format and length, optionally wrapped with prefix / suffix.
  • Each generated coupon inherits usage_limit / usage_per_customer / expired_at from the parent cart rule and is created as a secondary code (type 1, isPrimary false).
  • Returns generated (the count created) and coupons (the full coupon rows).

Request body

FieldTypeRequiredNotes
lengthintyesCode length, 430
formatstringyesalphabetic, alphanumeric, or numeric
prefixstringnoPrepended to every generated code
suffixstringnoAppended to every generated code
coupon_qtyintyesNumber of codes to generate, 1100

Released under the MIT License.