curl --request GET \
--url https://api-sandbox.endl.io/giftcards/orders/{order_id}/vouchers \
--header 'X-Api-Key-Id: <api-key>'import requests
url = "https://api-sandbox.endl.io/giftcards/orders/{order_id}/vouchers"
headers = {"X-Api-Key-Id": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Api-Key-Id': '<api-key>'}};
fetch('https://api-sandbox.endl.io/giftcards/orders/{order_id}/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-sandbox.endl.io/giftcards/orders/{order_id}/vouchers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Api-Key-Id: <api-key>"
],
]);
$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-sandbox.endl.io/giftcards/orders/{order_id}/vouchers"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Api-Key-Id", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-sandbox.endl.io/giftcards/orders/{order_id}/vouchers")
.header("X-Api-Key-Id", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.endl.io/giftcards/orders/{order_id}/vouchers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Api-Key-Id"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"order_id": "9f1c8a44-2b7e-4d31-9a6f-5c0e7b2d81a3",
"items": [
{
"item_id": "2c81a0f4-9c33-4f02-b0b7-1d5e9f2a44c8",
"canonical_sku": "BIGBASKET--IN--INR",
"vouchers": [
{
"voucher_id": "b1d7a9e0-6c2f-4f7a-9f2b-77a1c0de4411",
"seq": 1,
"kind": "CODE_PIN",
"denomination_minor": "50000",
"currency": "INR",
"expires_at": "2027-09-21T00:00:00.000Z",
"masked_hint": "****4821",
"secret": "{\"kind\":\"CODE_PIN\",\"code\":\"BB-4821-9930-1174\",\"pin\":\"4821\"}"
}
]
}
]
}{
"code": "AUTH_INVALID_KEY",
"message": "credential could not be verified"
}{
"code": "SCOPE_FORBIDDEN",
"message": "key lacks the required scope"
}{
"code": "ORDER_NOT_FOUND",
"message": "order not found"
}{
"code": "ORDER_NOT_IN_RETRIEVABLE_STATE",
"message": "order is not in a retrievable state"
}{
"code": "RATE_LIMITED",
"message": "rate limit exceeded"
}{
"code": "INTERNAL_ERROR",
"message": "unexpected error"
}Retrieve vouchers
The only endpoint that returns redemption material. It has its own scope (vouchers:read), its own tighter rate limit (30/min, a separate budget), and every retrieval is individually audited.
Retrieval is repeatable and returns the same material; the first retrieval is timestamped and later ones do not move it. This route is replay-protected, so each call needs a fresh signature.
Retrieve once and store. The tight limit exists because bulk retrieval is indistinguishable from exfiltration — fetch per order as it fulfils, never sweep historical orders. Never log secret; log voucher_id and masked_hint instead.
curl --request GET \
--url https://api-sandbox.endl.io/giftcards/orders/{order_id}/vouchers \
--header 'X-Api-Key-Id: <api-key>'import requests
url = "https://api-sandbox.endl.io/giftcards/orders/{order_id}/vouchers"
headers = {"X-Api-Key-Id": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Api-Key-Id': '<api-key>'}};
fetch('https://api-sandbox.endl.io/giftcards/orders/{order_id}/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-sandbox.endl.io/giftcards/orders/{order_id}/vouchers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Api-Key-Id: <api-key>"
],
]);
$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-sandbox.endl.io/giftcards/orders/{order_id}/vouchers"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Api-Key-Id", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-sandbox.endl.io/giftcards/orders/{order_id}/vouchers")
.header("X-Api-Key-Id", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.endl.io/giftcards/orders/{order_id}/vouchers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Api-Key-Id"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"order_id": "9f1c8a44-2b7e-4d31-9a6f-5c0e7b2d81a3",
"items": [
{
"item_id": "2c81a0f4-9c33-4f02-b0b7-1d5e9f2a44c8",
"canonical_sku": "BIGBASKET--IN--INR",
"vouchers": [
{
"voucher_id": "b1d7a9e0-6c2f-4f7a-9f2b-77a1c0de4411",
"seq": 1,
"kind": "CODE_PIN",
"denomination_minor": "50000",
"currency": "INR",
"expires_at": "2027-09-21T00:00:00.000Z",
"masked_hint": "****4821",
"secret": "{\"kind\":\"CODE_PIN\",\"code\":\"BB-4821-9930-1174\",\"pin\":\"4821\"}"
}
]
}
]
}{
"code": "AUTH_INVALID_KEY",
"message": "credential could not be verified"
}{
"code": "SCOPE_FORBIDDEN",
"message": "key lacks the required scope"
}{
"code": "ORDER_NOT_FOUND",
"message": "order not found"
}{
"code": "ORDER_NOT_IN_RETRIEVABLE_STATE",
"message": "order is not in a retrievable state"
}{
"code": "RATE_LIMITED",
"message": "rate limit exceeded"
}{
"code": "INTERNAL_ERROR",
"message": "unexpected error"
}Reading secret
secret is a JSON document encoded as a string. Parse it, then read the
fields named by kind.
kind | code | pin | claimUrl | How the customer redeems |
|---|---|---|---|---|
CODE | redemption code | — | — | Enters the code. |
CODE_PIN | redemption code | required | — | Enters the code and the PIN. |
URL | — | — | redemption link | Opens the link. |
URL_PIN | — | required | redemption link | Opens the link, then enters the PIN. |
const secret = JSON.parse(voucher.secret);
switch (secret.kind) {
case 'CODE': return { code: secret.code };
case 'CODE_PIN': return { code: secret.code, pin: secret.pin };
case 'URL': return { url: secret.claimUrl };
case 'URL_PIN': return { url: secret.claimUrl, pin: secret.pin };
}
code is always present. On URL and URL_PIN the
redemption material is a link and there is no code — rendering secret.code
blindly shows the customer undefined.Do not discard pin. A CODE_PIN voucher is unredeemable without it, and
the customer has no way to recover it.Availability
| Order state | Response | What to do |
|---|---|---|
PENDING / UNDER_REVIEW | 409 ORDER_NOT_IN_RETRIEVABLE_STATE | Keep polling. This is the expected answer, not an error condition. |
FULFILLED | 200 | Read the vouchers. |
FAILED / REFUNDED | 409 ORDER_NOT_IN_RETRIEVABLE_STATE | Never becomes retrievable. |
Handling rules
| Rule | Detail |
|---|---|
| Retrieval is repeatable | Fetching again returns the same material. The first retrieval is timestamped; later ones do not move it. |
| Each retrieval needs a fresh signature | This route is replay-protected, so two identical retrievals inside the same second collide. |
| Retrieve once and store | The tight limit exists because bulk retrieval is indistinguishable from exfiltration. Fetch per order as it fulfils; never sweep historical orders. |
Never log secret | Log voucher_id and masked_hint instead. They identify the voucher without disclosing it. |
Authorizations
Your key id, verbatim. Public — it identifies the credential. The secret is never transmitted.
Headers
Unix seconds. Optional, carried for symmetry — send the same value as the t= inside X-Signature, which is the one actually validated.
Path Parameters
The order id.
Response
The redemption material. Only items in a retrievable state appear.