API documentation
Everything you need to launch games on your site and settle bets in your own wallet.
Overview
Base URL: https://api.jinbaoapi.example. All requests and responses are JSON over HTTPS.
The flow has three parts:
- You call us to list games and to launch a game for a player. We return a URL to open in an iframe, WebView or new tab.
- The player plays. The game studio settles each round.
- We call you with a signed
round.settledwebhook for every round. You debit the bet and credit the win in your wallet.
Your keys are in the dashboard. New accounts can launch demo games immediately from the playground.
Authentication
Every request carries three headers. The secret never leaves your server.
| Header | Value |
|---|---|
X-Api-Key | Your public key id, starts with pk_ |
X-Timestamp | Current Unix time in seconds. Must be within 5 minutes of our clock. |
X-Signature | Hex HMAC-SHA256 of {timestamp}.{rawBody} using your secret (sk_…). For GET requests the body is an empty string. |
Sign the exact bytes you send. If you re-serialise JSON after signing, the signature will not match. You can also restrict keys to your server IPs in Settings.
Responses
Successful calls return { "ok": true, "data": … }. Failed calls return an HTTP error status and { "ok": false, "error": { "code", "message", "details" } }.
Launch a game
POST /v1/game/launch
| Field | Type | Notes |
|---|---|---|
playerId | string | Your player id. Letters, numbers, _ . -, up to 40 characters. |
balance | number | The player's current balance in major units, for example 2500.50. |
currency | string | ISO code such as USD, INR, BDT, THB. |
gameId | string | From /v1/games or the catalog. |
returnUrl | string, optional | Where the lobby button sends the player. |
language | string, optional | Two-letter code, default en. |
nickname | string, optional | Display name inside the game. |
import crypto from "node:crypto";
const KEY = process.env.GAME_API_KEY; // pk_...
const SECRET = process.env.GAME_API_SECRET; // sk_...
async function call(method, path, payload) {
const body = payload ? JSON.stringify(payload) : "";
const ts = Math.floor(Date.now() / 1000).toString();
const sig = crypto.createHmac("sha256", SECRET).update(`${ts}.${body}`).digest("hex");
const res = await fetch("https://api.jinbaoapi.example" + path, {
method,
headers: { "content-type": "application/json", "x-api-key": KEY, "x-timestamp": ts, "x-signature": sig },
body: body || undefined,
});
return res.json();
}
const { data } = await call("POST", "/v1/game/launch", {
playerId: "user_1001",
balance: 2500,
currency: "INR",
gameId: "aurelian-studio-gilded-pharaoh",
returnUrl: "https://your-site.com/lobby",
});
// Open data.launchUrl in an iframe, WebView or new tab
console.log(data.launchUrl);Response:
{
"ok": true,
"data": {
"launchUrl": "https://…/play/ses_9f2c…",
"sessionId": "ses_9f2c…",
"game": { "id": "aurelian-studio-gilded-pharaoh", "name": "Gilded Pharaoh", "provider": "Aurelian Studio" }
}
}List games
GET /v1/games?category=slots&provider=…&q=…&page=1&limit=48 returns items, total, page, limit. Categories: slots, live, sports, table, crash, fishing, lottery.
GET /v1/providers returns each studio with its game count.
Account and credit
GET /v1/account returns your plan, expiry, prepaid credit in USD and your GGR rates per category. Launches stop when credit falls to zero, so top up before it runs out.
Rounds and reports
GET /v1/rounds?playerId=&from=&to=&page=&limit= lists settled rounds with bet, win, GGR and the fee charged.
GET /v1/reports/ggr?days=30 returns daily rounds, turnover, GGR, fees and unique players. Use it to reconcile with your wallet.
Webhooks
Set your callback URL in Settings. We send a POST for every settled round:
POST https://your-site.com/game-callback
X-Webhook-Event: round.settled
X-Webhook-Id: 674d…
X-Webhook-Timestamp: 1764660000
X-Webhook-Signature: <hex HMAC-SHA256 of "{timestamp}.{body}" with your webhook secret>
{
"event": "round.settled",
"data": {
"roundId": "674d1f…",
"providerRoundId": "r_88231",
"playerId": "user_1001",
"gameId": "aurelian-studio-gilded-pharaoh",
"gameName": "Gilded Pharaoh",
"currency": "INR",
"betAmount": 50,
"winAmount": 120,
"settledAt": "2026-12-02T10:00:00.000Z"
},
"sentAt": "2026-12-02T10:00:00.120Z"
}- Apply
winAmount − betAmountto the player's balance. - Store
roundIdand ignore repeats. We retry until you answer with any 2xx status. - Retries back off over about 30 minutes. Failed deliveries show in the dashboard webhook log.
- A
pingevent is sent when you press "Send test webhook".
import crypto from "node:crypto";
import express from "express";
const app = express();
app.post("/game-callback", express.text({ type: "*/*" }), async (req, res) => {
const ts = req.header("x-webhook-timestamp");
const expected = crypto.createHmac("sha256", process.env.WEBHOOK_SECRET)
.update(`${ts}.${req.body}`).digest("hex");
if (expected !== req.header("x-webhook-signature")) return res.sendStatus(401);
const { event, data } = JSON.parse(req.body);
if (event === "round.settled") {
// Idempotent: skip if data.roundId was already applied
await wallet.apply(data.playerId, data.winAmount - data.betAmount, data.roundId);
}
res.sendStatus(200);
});Errors
| Status | Code | What to do |
|---|---|---|
| 400 | BAD_REQUEST | Check details for the field that failed. |
| 401 | UNAUTHORIZED | Key unknown or revoked, signature mismatch, or clock more than 5 minutes off. |
| 402 | INSUFFICIENT_CREDIT | Top up credit, then retry. |
| 403 | FORBIDDEN | Account suspended, plan expired, or IP not whitelisted. |
| 404 | NOT_FOUND | Game id does not exist or is disabled. |
| 429 | RATE_LIMITED | Slow down. Default limit is 300 requests per minute per key, 600 for launches. |
| 502 | UPSTREAM_ERROR | The game studio did not answer. Retry after a few seconds. |
Go-live checklist
- Keys are stored server-side only, never in the browser or app bundle.
- Your callback verifies the signature and ignores repeated
roundIdvalues. - Your callback answers in under 2 seconds. Do slow work after responding.
- Server clock is synced with NTP.
- Your server IPs are added to the whitelist.
- Credit is topped up and low-balance alerts go to your team.
- Players from restricted countries are geo-blocked.