Hey! These docs are for version 1.0, which is no longer officially supported. Click here for the latest version, 2.0!

Create vouchers in batch

Creating unique vouchers one by one is not very efficient, especially if you need a lot of them. Luckily Vouchery API provides a way to generate them in a batch for you. So far so good!

To make a batch of vouchers you will need to provide some more information. Just like before we need to know if vouchers should be active. We also need to know what prefix should they have, how long the random code should be and what characters are allowed in the random part.
There are three code types: letters, digits, and mixed (letters and digits). For the mixed ones we have filtered the set of allowed signs to avoid confusion, e.g. between digit 5 and letter S.

All codes will be generated in the format of {prefix}-{random part}. You can make up to 500 thousand of them at once! In this example we will make just 100 though.

curl --request POST \
     --user "username:password" \
     --url "https://preview.vouchery.io/api/v1.0/campaigns/3/vouchers/batch" \
     --header "Content-Type: application/json" \
     --data \
  "active": true,
  "size": 100,
  "code_type": "mixed",
  "random_part_length": 6,
  "prefix": "VOU"
    "id": 2,
    "campaign_id": 3,
    "code": "VOU-S4H9LX",
    "created_at": "2018-10-17T12:41:43.937Z",
    "updated_at": "2018-10-17T12:41:43.937Z",
    "campaign": {
      "id": 3,
      "name": "Spring haul 2019"
  // I got 99 more vouchers, but this ain't one