Create a Promotional Code
Creates a promotional code against an existing coupon. couponId is always required — the coupon supplies the discount.
There are two ways to create a code:
- Give it yourself. Send
codewith the exact string you want. It must be unique within the program. - Have it generated. Set
isAutoGeneratedtotrueand sendcodeStructuredescribing which pieces to combine — the affiliate’s first name, last name, email prefix, the discount value, the coupon name, and/or random characters. An affiliate is required in this mode, and you can shape the result further withprefix,randomCharsLengthandrandomCharsCase.
Assign the code to an affiliate with affiliateId or affiliateEmail so their redemptions are tracked. Assigned codes are also connected to that affiliate’s links automatically in the background.
Fires the promotional_code.created webhook.
Requires promotional-codes:write. This legacy endpoint uses the key’s original program and its existing response format.
Creating Promotional Codes
Create promotional codes that customers can use at checkout. Each promotional code must be linked to an existing coupon.Manual vs Auto-Generated Codes
Manual Codes
Specify the exact code string you want to create:Auto-Generated Codes
Let the system generate codes based on a structure:SAVEJOHN8X4Z
Code Structure Options
When using auto-generated codes, you can combine:- firstName: Include affiliate’s first name
- lastName: Include affiliate’s last name
- email: Include part of affiliate’s email (before @)
- discountAmount: Include the discount value
- couponName: Include the coupon name
- randomChars: Add random characters
Additional Settings
- active: Whether the code is currently active
- expiresAt: Expiration date for the code
- maxRedemptions: Maximum number of times the code can be used
- firstTimeOrder: Limit to first-time customers only
- minimumAmount: Minimum purchase amount required
- limitToAffiliate: Only the affiliate can use this code
- limitToCustomers: Restrict to specific customers
Authorizations
Body
The promotional code to create
Response
The created promotional code, with its parent coupon and assigned affiliate.
A code customers enter at checkout. Its discount comes from the coupon it belongs to.