Create direct link order
curl --request POST \
--url https://api-testbed.giftbit.com/papi/v1/direct_links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "clientProvidedId_abc123",
"price_in_cents": 2500,
"expiry": "2025-01-01",
"region": "USA",
"link_count": 1
}
'import requests
url = "https://api-testbed.giftbit.com/papi/v1/direct_links"
payload = {
"id": "clientProvidedId_abc123",
"price_in_cents": 2500,
"expiry": "2025-01-01",
"region": "USA",
"link_count": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'clientProvidedId_abc123',
price_in_cents: 2500,
expiry: '2025-01-01',
region: 'USA',
link_count: 1
})
};
fetch('https://api-testbed.giftbit.com/papi/v1/direct_links', 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-testbed.giftbit.com/papi/v1/direct_links",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 'clientProvidedId_abc123',
'price_in_cents' => 2500,
'expiry' => '2025-01-01',
'region' => 'USA',
'link_count' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-testbed.giftbit.com/papi/v1/direct_links"
payload := strings.NewReader("{\n \"id\": \"clientProvidedId_abc123\",\n \"price_in_cents\": 2500,\n \"expiry\": \"2025-01-01\",\n \"region\": \"USA\",\n \"link_count\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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-testbed.giftbit.com/papi/v1/direct_links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"clientProvidedId_abc123\",\n \"price_in_cents\": 2500,\n \"expiry\": \"2025-01-01\",\n \"region\": \"USA\",\n \"link_count\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-testbed.giftbit.com/papi/v1/direct_links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"clientProvidedId_abc123\",\n \"price_in_cents\": 2500,\n \"expiry\": \"2025-01-01\",\n \"region\": \"USA\",\n \"link_count\": 1\n}"
response = http.request(request)
puts response.read_body{
"info": {
"code": "INFO_CAMPAIGN_CREATED",
"name": "Campaign Created",
"message": "Campaign creation has begun."
},
"status": 200,
"direct_links": [
"https://reward.giftbit.com/getReward/dl-59ec25692ca940358fcd51e91e3d1fdb"
],
"campaign": {
"company_name": "Company Name",
"message": "Here is your reward!",
"subject": null,
"contacts": null,
"status": "API_CREATING",
"uuid": "aa10bbe7bfa64b4a81d61d3ade419653",
"suppress_default_greeting": false,
"delivery_type": "DIRECT_LINK",
"region": "USA",
"expiry": "2025-01-01",
"id": "clientProvidedId_abc123"
}
}Create direct link order
Places an order for direct link rewards — URLs that go straight to rewards with minimal Giftbit branding and no template content or message. The reward URLs are generated and returned immediately in the response.
A direct link reward can be a full catalog of options in a specific region, or
a custom reward of one or more specific brand_codes (which must be from the
same region). Set link_count to generate more than one direct link at a time.
POST
/
direct_links
Create direct link order
curl --request POST \
--url https://api-testbed.giftbit.com/papi/v1/direct_links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "clientProvidedId_abc123",
"price_in_cents": 2500,
"expiry": "2025-01-01",
"region": "USA",
"link_count": 1
}
'import requests
url = "https://api-testbed.giftbit.com/papi/v1/direct_links"
payload = {
"id": "clientProvidedId_abc123",
"price_in_cents": 2500,
"expiry": "2025-01-01",
"region": "USA",
"link_count": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'clientProvidedId_abc123',
price_in_cents: 2500,
expiry: '2025-01-01',
region: 'USA',
link_count: 1
})
};
fetch('https://api-testbed.giftbit.com/papi/v1/direct_links', 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-testbed.giftbit.com/papi/v1/direct_links",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 'clientProvidedId_abc123',
'price_in_cents' => 2500,
'expiry' => '2025-01-01',
'region' => 'USA',
'link_count' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-testbed.giftbit.com/papi/v1/direct_links"
payload := strings.NewReader("{\n \"id\": \"clientProvidedId_abc123\",\n \"price_in_cents\": 2500,\n \"expiry\": \"2025-01-01\",\n \"region\": \"USA\",\n \"link_count\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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-testbed.giftbit.com/papi/v1/direct_links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"clientProvidedId_abc123\",\n \"price_in_cents\": 2500,\n \"expiry\": \"2025-01-01\",\n \"region\": \"USA\",\n \"link_count\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-testbed.giftbit.com/papi/v1/direct_links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"clientProvidedId_abc123\",\n \"price_in_cents\": 2500,\n \"expiry\": \"2025-01-01\",\n \"region\": \"USA\",\n \"link_count\": 1\n}"
response = http.request(request)
puts response.read_body{
"info": {
"code": "INFO_CAMPAIGN_CREATED",
"name": "Campaign Created",
"message": "Campaign creation has begun."
},
"status": 200,
"direct_links": [
"https://reward.giftbit.com/getReward/dl-59ec25692ca940358fcd51e91e3d1fdb"
],
"campaign": {
"company_name": "Company Name",
"message": "Here is your reward!",
"subject": null,
"contacts": null,
"status": "API_CREATING",
"uuid": "aa10bbe7bfa64b4a81d61d3ade419653",
"suppress_default_greeting": false,
"delivery_type": "DIRECT_LINK",
"region": "USA",
"expiry": "2025-01-01",
"id": "clientProvidedId_abc123"
}
}Authorizations
Send your API token prefixed by Bearer in the Authorization header.
Body
application/json
- Option 1
- Option 2
A unique client-assigned identifier for the order. Idempotent on retry.
One or more brand_codes from the same region. Omit for a Full Catalog reward.
Region for a Full Catalog reward.
Number of reward links to generate (positive integer).