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.

Create Promotion Codes

POST https://api.moltin.com/v2/promotions/:id/codes

Path Parameters

NameTypeDescription

id

string

The unique promotion identifier

Headers

NameTypeDescription

Authorization

string

The Bearer token to grant access to the API

Request Body

NameTypeDescription

type

string

promotion_codes

codes

array

An array of objects

codes[].code

string

A string to use as a code for the promotion

codes[].uses

integer

Number of times code can be used

codes[].user

string

A string that can used to identify a user

{
    "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 -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"}
        ]
      }
    }'

Last updated