Skip to content
JinBaoGAME API

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.settled webhook 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.

HeaderValue
X-Api-KeyYour public key id, starts with pk_
X-TimestampCurrent Unix time in seconds. Must be within 5 minutes of our clock.
X-SignatureHex 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

FieldTypeNotes
playerIdstringYour player id. Letters, numbers, _ . -, up to 40 characters.
balancenumberThe player's current balance in major units, for example 2500.50.
currencystringISO code such as USD, INR, BDT, THB.
gameIdstringFrom /v1/games or the catalog.
returnUrlstring, optionalWhere the lobby button sends the player.
languagestring, optionalTwo-letter code, default en.
nicknamestring, optionalDisplay 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 − betAmount to the player's balance.
  • Store roundId and 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 ping event 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

StatusCodeWhat to do
400BAD_REQUESTCheck details for the field that failed.
401UNAUTHORIZEDKey unknown or revoked, signature mismatch, or clock more than 5 minutes off.
402INSUFFICIENT_CREDITTop up credit, then retry.
403FORBIDDENAccount suspended, plan expired, or IP not whitelisted.
404NOT_FOUNDGame id does not exist or is disabled.
429RATE_LIMITEDSlow down. Default limit is 300 requests per minute per key, 600 for launches.
502UPSTREAM_ERRORThe 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 roundId values.
  • 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.