NAV
bash javascript php

Introduction

Welcome to the generated API reference for Gift Voucher Brilliance V2.

This API is currently in Beta.

Get Postman Collection

Authentication

All requests require an Authorization header to be sent with the request. This should be a Bearer token. Please click here to contact support@giftvoucherbrilliance.co.uk to obtain a token.

Please include what you plan on using the API for in your request.

V2

Please note this API is only compatible with clients using the current stable version of Gift Voucher Brilliance. All clients are current running V2 however if you would like to check, please contact the support team at support@giftvoucherbrilliance.co.uk.

Gift Voucher Brilliance V3 is scheduled for release in Q4 of 2020 and a new API will be issued to coincide. Please note that on the new release the calls will be the same but the responses will differ.

Vouchers

APIs for managing issused vouchers

Get All Vouchers

Requires authentication

The request will be paginated at 50 results per page.

Example request:

curl -X GET -G "https://api.giftvoucherbrilliance.co.uk/vouchers" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {YOUR_TOKEN_HERE}"
const url = new URL("https://api.giftvoucherbrilliance.co.uk/vouchers");

    let params = {
            "page": "18",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {YOUR_TOKEN_HERE}",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.giftvoucherbrilliance.co.uk/vouchers", [
    'headers' => [
            "Content-Type" => "application/json",
            "Accept" => "application/json",
            "Authorization" => "Bearer {YOUR_TOKEN_HERE}",
        ],
    'query' => [
            "page" => "18",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": [
        {
            "voucher_id": "tin-001245-000000",
            "description": "Spa Day for two<br\/>For two people",
            "date_issued": "2019-06-24 14:22:19",
            "date_valid_from": "2019-06-24",
            "date_expires": "2019-06-30T00:00:00.000000Z",
            "value": "130.00",
            "redeemed": "NO",
            "void": "NO"
        },
        {
            "voucher_id": "tin-001244-000000",
            "description": "Monetary Vouchers<br\/>To the value of &pound;50",
            "date_issued": "2019-04-04 10:59:40",
            "date_valid_from": "2019-04-04",
            "date_expires": "2020-04-04T00:00:00.000000Z",
            "value": "50.00",
            "redeemed": "YES",
            "void": "NO"
        },
        {
            "voucher_id": "tin-001243-000000",
            "description": "Champagne Afternoon Tea<br\/>For two people",
            "date_issued": "2019-04-02 10:56:12",
            "date_valid_from": "2019-04-02",
            "date_expires": "2020-04-02T00:00:00.000000Z",
            "value": "39.90",
            "redeemed": "YES",
            "void": "NO"
        }
    ],
    "meta": {
        "pagination": {
            "total": 843,
            "count": 3,
            "per_page": 3,
            "current_page": 1,
            "total_pages": 85,
            "links": {
                "next": "https:\/\/api.giftvoucherbrilliance.co.uk\/vouchers?page=2"
            }
        }
    }
}

HTTP Request

GET vouchers

Query Parameters

Parameter Status Description
page optional The page number to return

Retrieve a specific voucher

Requires authentication

Use this to retreive a single voucher. Use the voucher code printed on the voucher to search for a voucher. e.g. pot-000004-000001

If the voucher is redeemed, extra fields suchs the redeemer and redeemed_at will be added.

If the voucher is void, extra fields suchs the voider, voided_at and void_reason will be added.

Example request:

curl -X GET -G "https://api.giftvoucherbrilliance.co.uk/vouchers/pot-000004-000001" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {YOUR_TOKEN_HERE}"
const url = new URL("https://api.giftvoucherbrilliance.co.uk/vouchers/pot-000004-000001");

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {YOUR_TOKEN_HERE}",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get("https://api.giftvoucherbrilliance.co.uk/vouchers/pot-000004-000001", [
    'headers' => [
            "Content-Type" => "application/json",
            "Accept" => "application/json",
            "Authorization" => "Bearer {YOUR_TOKEN_HERE}",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "data": {
        "voucher_id": "pot-000004-000001",
        "description": "Monetary Voucher<br\/>To the value of &pound;150",
        "date_issued": "2015-09-23 09:39:36",
        "date_valid_from": "0000-00-00",
        "date_expires": "2016-09-23 00:00:00",
        "value": "150.00",
        "redeemed": "YES",
        "void": "NO",
        "redeemed_at": "2019-07-04 13:42:42",
        "redeemer": {
            "data": {
                "name": "Clockwork Admin",
                "username": "clockwork_admin",
                "active": "YES"
            }
        }
    }
}

HTTP Request

GET vouchers/{voucher}

Redeem a voucher

This call will check if a voucher has been redeemed prevoiusly, is voided or has expired.

If the voucher passes all of those checks, it then will become redeemed and will be marked. The call will return the newly redeemed voucher.

Example request:

curl -X PATCH "https://api.giftvoucherbrilliance.co.uk/vouchers/pot-000004-000001/redeem" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {YOUR_TOKEN_HERE}"
const url = new URL("https://api.giftvoucherbrilliance.co.uk/vouchers/pot-000004-000001/redeem");

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {YOUR_TOKEN_HERE}",
}

fetch(url, {
    method: "PATCH",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->patch("https://api.giftvoucherbrilliance.co.uk/vouchers/pot-000004-000001/redeem", [
    'headers' => [
            "Content-Type" => "application/json",
            "Accept" => "application/json",
            "Authorization" => "Bearer {YOUR_TOKEN_HERE}",
        ],
]);
$body = $response->getBody();
print_r(json_decode((string) $body));

HTTP Request

PATCH vouchers/{voucher}/redeem