These docs are for v1.0. Click to read the latest docs for v2.1.

Create a single voucher

First we will create a single voucher. There are only two attributes that need to be specified: the voucher code, and voucher state (is it active or not). Remember this campaign has unique vouchers so it's best to avoid generic codes like "SALE10".

curl --request POST \
     --user "username:password" \
     --url "https://preview.vouchery.io/api/v1.0/campaigns/2/vouchers" \
     --header "Content-Type: application/json" \
     --data \
'
{
	"active": true,
  "code": "QJSVKCNS"
}
'
{
	"type": "Voucher"
  "id": 2,
  "campaign_id": 3,
  "code": "QJSVKCNS",
  "created_at": "2018-10-17T12:41:43.937Z",
  "updated_at": "2018-10-17T12:41:43.937Z",
  "campaign": {
    "id": 3,
    "name": "Spring haul 2019"
  }
}