Promotions > Coupons > couponsGenerate
POST:coupons/generate.json
Description
Generate a bunch of coupons at once using various template parameters.
Example mutation
mutation GenerateFiveCoupons($shopID: String!, $promotionID: String!) { couponsGenerate( shop_id: $shopID promotion_id: $promotionID data: { quantity: 5 length: 8 format: numeric prefix: "PROMO-" dash_section_length: 4 } ) }
Example result
PROMO-1286-6703 PROMO-2358-5157 PROMO-7005-0283 PROMO-1247-7714 PROMO-6219-6036
Permission bit: "coupons.create"
Topic: Coupons
Arguments
data: CouponBulk!
Main argument for mutations.
Unique promotion identifier. See also: Unique Identifiers
Example: "pr_EQzGqWoY"
Unique shop identifier. See also: Unique Identifiers
Example: "sh_EQzGqWoY"
Data Argument Fields
Dash every N characters
format: CouponBulkFormat!
Format of the generated coupon code
Length of a generated coupon code (without prefix/suffix and dashes)
Valid when: length is in range: 1 ≤ length ≤ 100
Coupon code prefix
Valid when: prefix's length doesn't exceed 25 characters
Amount of coupons to generate
Valid when: quantity is in range: 1 ≤ quantity ≤ 500
Coupon code suffix
Valid when: suffix's length doesn't exceed 25 characters
Result
Boolean
Preview (typescript)
Loading module