Create Promotion codes

When a promotion expires, the promotion codes attached to that promotion will automatically become invalid, though they are not deleted. Should you re-enable the expired promotion, the promotion codes attached to that promotion will be completely deleted.

post
Create Promotion Codes

https://api.moltin.com/v2/promotions/:id/codes
Request
Response
Path Parameters
id
required
string
The unique promotion identifier
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
type
required
string
promotion_codes
codes[]
required
array
An array of objects
codes[].code
required
string
A string to use as a code for the promotion
201: Created
{
"data": {
"type": "promotion",
"id": "7005b249-300b-4cf6-964e-e663278af218",
"name": "Promo #1",
"description": "Initial Promotion",
"enabled": true,
"promotion_type": "fixed_discount",
"schema": {
"currencies": [
{
"currency": "USD",
"amount": 900
},
{
"currency": "GBP",
"amount": 1100
}
]
},
"start": "2017-11-13T00:00:00Z",
"end": "2019-11-13T00:00:00Z",
"created_at": "2018-05-10T15:25:21.164Z",
"updated_at": "2018-05-10T15:26:18.203Z"
}
}
cURL
curl -X POST https://api.moltin.com/v2/promotions/:id/codes \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data":{
"type":"promotion_codes",
"codes": [
{"code":"ZXY_CBA"},
{"code":"ABC_XYZ"}
]
}
}'