Backend API
Create a new coupon generation.
Arguments
idobjectId
ID of the coupon generation.
countintrequired
The number of coupon codes generated in the generation. Minimum of 0 and maximum of 1000.
parent_idobjectIdrequired
ID of the parent coupon.
codesCoupon code
Expandable link to the coupon code.
completeboolean
Indicates that the coupon code generation is complete.
date_createddateauto
Date and time the coupon generation was created.
date_updateddateauto
Date and time the coupon generation was last updated.
errorstring
Indicates if there was an error with the coupon code generation.
parentCoupon
Expandable link to the parent coupon.
patternstring
Specifies the code pattern for generated coupons.
pattern_typestring
Determines the pattern type for the codes generated, which can be either default or custom. Specify the pattern when using custom.
POST/coupons:generations
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
await swell.post('/coupons:generations', {
pattern_type: default
count: 10
});The coupon generation model
{
"complete": true,
"count": 1000,
"date_created": "2015-09-02T20:57:03.441Z",
"date_updated": "2015-09-02T20:57:20.033Z",
"parent_id": "559c5799bcb1de1d1c4821da",
"pattern": "TABATHA-{0000000}",
"pattern_type": "custom",
"id": "55e7629f5c0dfa1e3c2dd4c1"
},