Skip to main content

Code examples

All examples assume your key in the API_KEY environment variable and your game domain as the base URL. Get the key under API in the portal.

curl — quick checks

Who am I / key sanity check
curl -s https://your-domain.com/api/v1/me \
-H "Authorization: Bearer $API_KEY"
Funnel stats for the last 7 days
curl -s "https://your-domain.com/api/v1/stats?from=$(date -v-7d +%Y-%m-%d)" \
-H "Authorization: Bearer $API_KEY"
Earnings summary + recent payouts
curl -s https://your-domain.com/api/v1/earnings \
-H "Authorization: Bearer $API_KEY"

Node.js — poll conversions into your system

/v1/conversions is an ascending stream: persist the last nextCursor and pass it on the next poll to get only new events (registrations and deposits) — ideal for feeding CAPI or your own database.

poll-conversions.mjs
const BASE = "https://your-domain.com/api/v1";
const KEY = process.env.API_KEY;

let cursor = await loadCursor(); // persist between runs (file/db)

async function poll() {
const url = new URL(BASE + "/conversions");
url.searchParams.set("limit", "500");
if (cursor) url.searchParams.set("cursor", cursor);

const res = await fetch(url, {
headers: { Authorization: `Bearer ${KEY}` },
});
if (res.status === 429) {
const wait = Number(res.headers.get("retry-after") ?? 30);
return setTimeout(poll, wait * 1000);
}
const { ok, data, error } = await res.json();
if (!ok) throw new Error(error.message);

for (const conv of data.items) {
// conv: { type: "registration"|"deposit", clickId, value, currency,
// eventId, externalId, ip, userAgent, fbp, fbc, ... }
await handleConversion(conv); // your side: CAPI event, DB row, etc.
}
if (data.nextCursor) {
cursor = data.nextCursor;
await saveCursor(cursor);
}
setTimeout(poll, 60_000); // poll every minute
}

poll();

Python — daily stats snapshot

stats_snapshot.py
import os
import requests

BASE = "https://your-domain.com/api/v1"
KEY = os.environ["API_KEY"]
HEADERS = {"Authorization": f"Bearer {KEY}"}

def get(path, **params):
r = requests.get(f"{BASE}{path}", headers=HEADERS, params=params, timeout=15)
r.raise_for_status()
body = r.json()
if not body["ok"]:
raise RuntimeError(body["error"]["message"])
return body["data"]

stats = get("/stats", **{"from": "2026-07-01"})
earnings = get("/earnings")

print("visits:", stats["funnel"]["visits"])
print("registrations:", stats["funnel"]["registrations"])
print("depositors:", stats["funnel"]["depositors"])
print("my earnings:", stats["money"]["earnings"])
print("pending USD:", earnings["pendingUsd"])
note

Field names in the payloads are documented per endpoint in the endpoint reference. Treat these snippets as transport scaffolding and check the reference for exact shapes.

warning

The API is server-to-server. Never call it from a browser or mobile app — the bearer key would be exposed to anyone who opens devtools.