Generate codes
POST
/ admin/ v1/ stores/ {store_id}/ discounts/ {discount_id}/ codes/ batches- discounts:write
- Idempotency-Key supported
Starts making a batch of codes in the background.
Path parameters
store_idstringrequiredThe store's ID, like
store_01k8qs5s…. Apps get it with the install, in the OAuth redirect and the token response.discount_idstringrequiredThe discount's ID, like
disc_01k8qs5s….
Headers
Idempotency-KeystringSend the same key to retry safely: the first answer is replayed for 24 hours.
shop-api-versionYYYY-MMThe version to answer in. Without it, your app’s pinned version, else the newest.
Body
countintegerrequiredHow many: 1 to 100,000.
prefixstring · or nullWhat each code starts with, up to 16 letters, digits, dashes or underscores.
lengthinteger · or nullRandom characters per code: 8 to 16, 10 by default.
Returns
202 Making them.
Errors
- 403
forbiddenMissing permission. - 404
not_foundNo such discount. - 409A batch is running, or there would be too many.
- 422
validation_failedInvalid count, prefix or length.