Create an API Key
curl --request POST \
--url https://api.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key \
--header 'Authorization: <authorization>' \
--header 'z-client: <z-client>'import requests
url = "https://api.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key"
headers = {
"z-client": "<z-client>",
"Authorization": "<authorization>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'z-client': '<z-client>', Authorization: '<authorization>'}
};
fetch('https://api.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key', 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.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"z-client: <z-client>"
],
]);
$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.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("z-client", "<z-client>")
req.Header.Add("Authorization", "<authorization>")
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.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key")
.header("z-client", "<z-client>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["z-client"] = '<z-client>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "API key created successfully. Please save this key securely as it will not be shown again.",
"data": {
"id": "78b411d8-1f61-4824-97c6-e3c3a571f1c5",
"apiKey": "sdk_live_cbe66d6f0a60e2a8c0b2ac2831db8909d736409cadb78bce9ad94954259d8c88",
"createdAt": "2025-10-29T13:58:11.602Z"
}
}
API Keys
Create an API Key
Generate a new API key for your Rewards App to authenticate server-side reward requests.
POST
/
api
/
v1
/
rewards
/
app
/
{rewardsAppId}
/
api-key
Create an API Key
curl --request POST \
--url https://api.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key \
--header 'Authorization: <authorization>' \
--header 'z-client: <z-client>'import requests
url = "https://api.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key"
headers = {
"z-client": "<z-client>",
"Authorization": "<authorization>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'z-client': '<z-client>', Authorization: '<authorization>'}
};
fetch('https://api.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key', 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.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"z-client: <z-client>"
],
]);
$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.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("z-client", "<z-client>")
req.Header.Add("Authorization", "<authorization>")
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.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key")
.header("z-client", "<z-client>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["z-client"] = '<z-client>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "API key created successfully. Please save this key securely as it will not be shown again.",
"data": {
"id": "78b411d8-1f61-4824-97c6-e3c3a571f1c5",
"apiKey": "sdk_live_cbe66d6f0a60e2a8c0b2ac2831db8909d736409cadb78bce9ad94954259d8c88",
"createdAt": "2025-10-29T13:58:11.602Z"
}
}
Generate an API key for your Rewards App to authenticate server-side reward requests.
This key authorizes your backend to send rewards securely without exposing credentials to the client.
In the next step, you’ll learn how to send rewards directly from your server using the v2 API endpoint.
This key authorizes your backend to send rewards securely without exposing credentials to the client.
Store this key securely, it will not be displayed again after creation. Save it immediately in your environment variables or secrets manager.
Configuration
Header Parameters
string
required
Client identifier (use
“developer-dashboard” )string
required
Bearer token for authenticationFormat:
Bearer {JWT_TOKEN}Path Parameters
string
required
Your Rewards App ID.
{
"success": true,
"message": "API key created successfully. Please save this key securely as it will not be shown again.",
"data": {
"id": "78b411d8-1f61-4824-97c6-e3c3a571f1c5",
"apiKey": "sdk_live_cbe66d6f0a60e2a8c0b2ac2831db8909d736409cadb78bce9ad94954259d8c88",
"createdAt": "2025-10-29T13:58:11.602Z"
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the request was successful |
message | string | Description of the result |
data | object | Contains API key details |
id | string | Unique identifier for this API key |
apiKey | string | The actual API key to use for server authentication. Store securely! |
createdAt | string | ISO 8601 timestamp of when the key was created |
Response Status Codes
| Code | Description |
|---|---|
201 | API key created successfully |
400 | Bad request - invalid UUID |
401 | Unauthorized - authentication required |
403 | Forbidden - developer does not own this app |
409 | Conflict - race condition detected |
500 | Internal server error |
{
"success": false,
"message": "Invalid UUID"
}
{
"success": false,
"message": "Authentication required"
}
{
"success": false,
"message": "Developer does not own this app"
}
{
"success": false,
"message": "Race condition detected"
}
{
"success": false,
"message": "Internal server error"
}
This API key will only be shown once in the response. If you lose it, you’ll need to create a new key and revoke the old one.
Code Examples
const rewardsAppId = 'YOUR_REWARDS_APP_ID';
const jwtToken = 'YOUR_JWT_TOKEN';
const response = await fetch(`https://api.zbdpay.com/api/v1/rewards/app/${rewardsAppId}/api-key`, {
method: 'POST',
headers: {
'z-client': 'developer-dashboard',
'Authorization': `Bearer ${jwtToken}`
}
});
const data = await response.json();
if (data.success) {
console.log('API Key created:', data.data.apiKey);
// IMPORTANT: Store this key in your environment variables
// It will not be shown again!
} else {
console.error('Error:', data.message);
}
curl --location --request POST 'https://api.zbdpay.com/api/v1/rewards/app/{rewardsAppId}/api-key' \
--header 'z-client: developer-dashboard' \
--header 'Authorization: Bearer {JWT_TOKEN}' \
--data ''
import requests
rewards_app_id = "YOUR_REWARDS_APP_ID"
jwt_token = "YOUR_JWT_TOKEN"
url = f"https://api.zbdpay.com/api/v1/rewards/app/{rewards_app_id}/api-key"
headers = {
"z-client": "developer-dashboard",
"Authorization": f"Bearer {jwt_token}"
}
response = requests.post(url, headers=headers)
data = response.json()
if data["success"]:
print(f"API Key created: {data['data']['apiKey']}")
# IMPORTANT: Store this key in your environment variables
else:
print(f"Error: {data['message']}")
Try It Out
Ready to create your first API key? Use our API playground on the right to test with your JWT token.What’s Next?
Now that you’ve created an API key, your backend can authenticate securely with the ZBD Earn API.In the next step, you’ll learn how to send rewards directly from your server using the v2 API endpoint.
Was this page helpful?
⌘I