Skip to main content
POST
/
api
/
v1
/
developer
/
vouchers
Create voucher
curl --request POST \
  --url https://api.example.com/api/v1/developer/vouchers
import requests

url = "https://api.example.com/api/v1/developer/vouchers"

response = requests.post(url)

print(response.text)
const options = {method: 'POST'};

fetch('https://api.example.com/api/v1/developer/vouchers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/developer/vouchers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/api/v1/developer/vouchers"

req, _ := http.NewRequest("POST", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/developer/vouchers")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v1/developer/vouchers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
Required scope: vouchers:write Rate limit: 60 requests/minute Status code on success: 201 Created Idempotency: supported – pass Idempotency-Key to safely retry. See Idempotency. The new voucher is created in the completed status – i.e. ready to redeem immediately. The voucher code is generated server-side; you cannot supply it. The expiry date is calculated from your tenant’s configured voucher expiry window (default: 3 years).

Request body

FieldTypeRequiredNotes
amountdecimal (string)yesGreater than 0, less than or equal to 10000
purchaser_namestringyes1–255 characters
purchaser_emailstring (email)noIf supplied, a Customer is found-or-created and linked
recipient_namestringnoUp to 255 characters
recipient_emailstring (email)noStored encrypted; used for delivery if you wire it up
personal_messagestringnoUp to 1000 characters
notesstringnoInternal notes – accepted but not returned in the response
location_idUUIDnoRequired only when creating a location-specific voucher with a tenant-wide key
If your API key is location-scoped, the new voucher is forced to that location. Supplying a different location_id returns 403 Forbidden.

Response

{
  "id": "8d82f0d2-7f94-4a3b-8b55-1e2e3a4f5b6c",
  "code": "00000124",
  "amount": "100.00",
  "balance": "100.00",
  "status": "completed",
  "recipient_name": "Sam Recipient",
  "recipient_email": "sam@example.com",
  "expiry_date": "2029-04-26T01:23:45Z",
  "created_at": "2026-04-26T01:23:45Z",
  "updated_at": "2026-04-26T01:23:45Z",
  "location_id": null
}

Errors

  • 403 – API key is scoped to a different location than location_id.
  • 404location_id does not match an active location in your tenant.
  • 409Idempotency-Key reused with a different request body within the 24h replay window (see Idempotency).
  • 422 – Validation error on any field (e.g. amount <= 0, amount > 10000, invalid email format).

Examples

curl -X POST \
  -H "X-API-Key: vg_live_EXAMPLEdoNotUseThis123456" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "100.00",
    "purchaser_name": "Alex Buyer",
    "purchaser_email": "buyer@example.com",
    "recipient_name": "Sam Recipient",
    "recipient_email": "sam@example.com",
    "personal_message": "Happy birthday!"
  }' \
  https://api.vouchergrid.com/api/v1/developer/vouchers
const res = await fetch(
  "https://api.vouchergrid.com/api/v1/developer/vouchers",
  {
    method: "POST",
    headers: {
      "X-API-Key": process.env.VOUCHERGRID_API_KEY!,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      amount: "100.00",
      purchaser_name: "Alex Buyer",
      purchaser_email: "buyer@example.com",
      recipient_name: "Sam Recipient",
      recipient_email: "sam@example.com",
      personal_message: "Happy birthday!",
    }),
  },
);
const voucher = await res.json();