# TALOS: game aggregator > TALOS integration documentation for merchants (online casino operators). With one integration your site offers slots and live casino from many providers, with the player's balance always kept in your wallet (seamless model). Two ends: the operator API (you call TALOS) and the wallet callback (TALOS calls you). Important notes: - API base: `https:///v1`, provided by TALOS for each environment (staging and production), together with the merchant code and secret. Start with staging. - Authentication: every API call and every wallet callback is signed with HMAC-SHA256 using the merchant secret. Headers `X-Merchant-Id`, `X-Timestamp` (epoch milliseconds), `X-Nonce` (unique per request) and `X-Signature` = hex(HMAC_SHA256(secret, `timestamp.nonce.METHOD.path_with_query.raw_body`)). The path includes `/v1`; on GET the body is empty. 5-minute window. - Sign the body exactly as it is sent (raw text): re-serializing the JSON changes the signature. The secret stays on the server. - A merchant operates in a single currency. For several currencies there is one merchant per currency (own code and secret) in the same group (brand). - Amounts in the major unit of the currency: `2.5` = R$ 2.50 (up to 2 decimals; CLP has none), both in the API and in the wallet. - API responses: `{ success, message, statusCode, data }`; on error, `{ success: false, message, statusCode, error: { code } }` with the HTTP status equal to `statusCode`. Always decide by `error.code`; the `message` is English text and may change. - Seamless wallet: TALOS keeps no balance. It POSTs to your `walletUrl` with `action` = `balance`, `bet`, `win`, `refund` or `rollback` and you reply `{ "ok": true, "balance": 97.5 }` (balance after the transaction) or `{ "ok": false, "error": "INSUFFICIENT_FUNDS" }`. - Idempotency: `tx_id` is the key. The same `tx_id` can arrive more than once and must never be applied twice; return the same result. A round without a win sends no `win`, and the win may arrive before the bet. - No reply within 8 seconds, network failure, HTTP 5xx or an invalid body = unknown result: TALOS resends with the same `tx_id` or reverses it with a `refund` (reply `TRANSACTION_NOT_FOUND` if you never applied the bet). - The launch (`POST /v1/game/launch`) takes no balance and creates the player on first access (`player_id` is your own id). Open the `launch_url` in an iframe; it is for immediate use. --- Page: https://docs.talosigaming.com/en/introduction ## Introduction TALOS is a game aggregator: with a single integration your site (the **merchant**) offers slots and live casino to its players, with the balance always kept in your wallet. ### How it works The integration has two ends, both signed with HMAC-SHA256 using your merchant secret: - **Operator API** — you call TALOS to launch games (`POST /v1/game/launch`), list the catalog, and query transactions and reports. - **Wallet callback** — TALOS calls your wallet URL (`walletUrl`) on every balance query, bet, win and reversal. TALOS **does not store balances**: your wallet is always the source of truth (*seamless* model). 1. Player → Your site: opens a game 2. Your site → TALOS: POST /v1/game/launch (signed) 3. TALOS → Your site: launch_url 4. Your site → Player: iframe with the launch_url 5. Provider → TALOS: game bet / win 6. TALOS → Your site: wallet callback (bet / win) 7. Your site → TALOS: { ok, balance } 8. TALOS → Provider: updated balance ### Products | Product | Catalog type | How to open | | --- | --- | --- | | Slots | `slot` | `POST /v1/game/launch` with the game code | | Live casino | `live` | `POST /v1/game/launch` with the game code | TALOS enables the products of each merchant; launching a game of a product that is not enabled returns `PRODUCT_NOT_ENABLED`. ### Concepts - **Merchant** — your operation at TALOS, identified by a code (`X-Merchant-Id`) and a secret. **A merchant operates in a single currency.** - **Group / brand** — the merchants of the same operator belong to a group. The group code is your **brand** (`brand`, in `GET /v1/merchant`). An operator with BRL and MXN has two merchants in the same group. - **Player** — identified by your own id (`player_id`). TALOS requires no registration: the player is created on the first launch. - **Seamless wallet** — every transaction is sent to your wallet with a unique `tx_id`, which is the idempotency key. ### Environments For each environment, TALOS provides the API URL (e.g. `https:///v1`) and the merchant credentials. Start with staging and only then request the production credentials. ### Next steps 1. [Getting started](https://docs.talosigaming.com/en/getting-started): what you receive from TALOS and the integration checklist. 2. [Authentication](https://docs.talosigaming.com/en/authentication): how to sign requests and validate callbacks. 3. [Game launch](https://docs.talosigaming.com/en/game-launch) and [Seamless wallet](https://docs.talosigaming.com/en/wallet): the money flow. ### AI assistants Integrating with the help of an assistant (ChatGPT, Claude, Cursor, Copilot)? Give it the [llms.txt](https://docs.talosigaming.com/en/llms.txt), the index of this documentation with the main rules, or the [llms-full.txt](https://docs.talosigaming.com/en/llms-full.txt), with every guide and the API reference in a single file. --- Page: https://docs.talosigaming.com/en/getting-started ## Getting started What you receive from TALOS, what you need to configure and the recommended order to integrate. ### What you receive | Item | What it is for | | --- | --- | | **Merchant code** | Goes in the `X-Merchant-Id` header of every request and arrives in the same header of the callbacks. | | **Merchant secret** | HMAC-SHA256 key (both directions). It is shown **only once** when created; if a new one is generated, the previous one stops working. | | **Merchant currency** | The operation currency (BRL, MXN, ARS, COP, CLP, PEN or USD). One merchant = one currency. | | **Brand (`brand`)** | The merchant group code, the same for every currency. It is returned by `GET /v1/merchant`. | | **API URL** | Base of the environment `/v1/...` routes. | > **Keep the secret on the server** > > The secret signs requests that move money. Never put it in the browser, in the mobile app or in the repository: use an environment variable or a secrets manager. ### What you tell TALOS - **Wallet URL (`walletUrl`)** — the HTTPS endpoint that will receive the [wallet callbacks](https://docs.talosigaming.com/en/wallet). Without it, real-money launches return `WALLET_NOT_CONFIGURED`. - **Your server outgoing IPs** — TALOS can restrict your merchant API to an IP list. Calls from another IP get `IP_NOT_ALLOWED`. - **Default language** — used when the launch has no `lang`. - **Products** — slots and/or live casino. ### Operating in several currencies Each currency is its own merchant (with its own code and secret), all in the same group (the same brand). On your server, pick the merchant by the player's currency: ```ts // one code/secret pair per currency, from environment variables const MERCHANTS = { BRL: { code: process.env.TALOS_MERCHANT_BRL!, secret: process.env.TALOS_SECRET_BRL! }, MXN: { code: process.env.TALOS_MERCHANT_MXN!, secret: process.env.TALOS_SECRET_MXN! } } ``` The wallet can be the same URL for all merchants: the callback carries the `X-Merchant-Id` and the `currency`, and it is signed with that merchant's secret. ### Integration checklist 1. Sign a simple call: `GET /v1/merchant` must return your code, currency and brand. See [Authentication](https://docs.talosigaming.com/en/authentication). 2. Implement the wallet endpoint with the `balance`, `bet`, `win`, `refund` and `rollback` actions, **idempotent by `tx_id`**. See [Seamless wallet](https://docs.talosigaming.com/en/wallet). 3. Validate the callback signature before touching the balance. 4. Launch a game with `POST /v1/game/launch` and play a few rounds; check the transactions in `GET /v1/transactions`. 5. Test reversals: a bet rejected for lack of balance, a refund of an applied bet and a refund of a bet you never received (`TRANSACTION_NOT_FOUND`). 6. Reconcile the [GGR report](https://docs.talosigaming.com/en/reference/get-reports-ggr) against your own ledger. --- Page: https://docs.talosigaming.com/en/authentication ## Authentication Every call to the operator API and every wallet callback is signed with HMAC-SHA256 using the **merchant secret**. The scheme is the same in both directions. ### Headers | Header | Value | | --- | --- | | `X-Merchant-Id` | Merchant code. | | `X-Timestamp` | Time of sending in **milliseconds** since 1970 (epoch), as text. | | `X-Nonce` | Random value, unique per request (e.g. 16 bytes in hex). | | `X-Signature` | Signature in lowercase hex (64 characters). | | `Content-Type` | `application/json` when there is a body. | ### Signed string ```text {timestamp}.{nonce}.{METHOD}.{path with query}.{raw body} ``` - `METHOD` in uppercase (`GET`, `POST`). - `path with query` exactly as in the URL, including the version prefix: `/v1/game/launch`, `/v1/games?page=2&limit=20`. - `raw body` is the exact text sent in the body. In `GET` (no body) it is empty — the string ends with `.`. ```text X-Signature = hex( HMAC_SHA256( secret, signed_string ) ) ``` > **Sign the text you send** > > Serialize the JSON **once**, sign that text and send the same text in the body. Re-serializing after signing (different field order, spaces, escapes) invalidates the signature. ### Validation rules TALOS rejects the request (HTTP 401, or 503 for `AUTH_UNAVAILABLE`) when: | Code | When | | --- | --- | | `MISSING_AUTH_HEADERS` | One of the four headers is missing. | | `REQUEST_EXPIRED` | `X-Timestamp` outside the **5-minute** window (ahead or behind) — keep the server clock in sync (NTP). | | `INVALID_MERCHANT` | Unknown merchant code. | | `MERCHANT_BLOCKED` | Merchant is blocked. | | `INVALID_SIGNATURE` | The signature does not match. | | `IP_NOT_ALLOWED` | The merchant has an IP list and the request came from another IP. | | `NONCE_REUSED` | The same `X-Nonce` was already used by this merchant (generate a new one for every request, retries included). | | `AUTH_UNAVAILABLE` | Temporary failure while recording the nonce; retry with a new nonce. | Authentication happens before body validation: an unauthenticated request never gets a 422. ### Examples A minimal client that signs and sends. The examples on the reference pages use the `talos` function below. ```ts // talos.ts — Node 18+ / Bun import { createHmac, randomBytes } from 'node:crypto' const HOST = process.env.TALOS_API_HOST! // e.g. https:// (without /v1) const MERCHANT = process.env.TALOS_MERCHANT! const SECRET = process.env.TALOS_SECRET! export async function talos(method: 'GET' | 'POST', path: string, payload?: unknown) { const body = payload === undefined ? '' : JSON.stringify(payload) const timestamp = Date.now().toString() const nonce = randomBytes(16).toString('hex') const signature = createHmac('sha256', SECRET) .update(`${timestamp}.${nonce}.${method}.${path}.${body}`, 'utf8') .digest('hex') const res = await fetch(`${HOST}${path}`, { method, headers: { ...(payload === undefined ? {} : { 'Content-Type': 'application/json' }), 'X-Merchant-Id': MERCHANT, 'X-Timestamp': timestamp, 'X-Nonce': nonce, 'X-Signature': signature }, body: payload === undefined ? undefined : body }) return res.json() } // usage const me = await talos('GET', '/v1/merchant') ``` ```php strtoupper($method), CURLOPT_HTTPHEADER => $headers, CURLOPT_RETURNTRANSFER => true, ]); if ($payload !== null) { curl_setopt($ch, CURLOPT_POSTFIELDS, $body); } $response = curl_exec($ch); curl_close($ch); return json_decode($response, true); } $me = talos('GET', '/v1/merchant'); ``` ```python # talos.py — Python 3.9+ import hashlib, hmac, json, os, secrets, time import urllib.error, urllib.request def talos(method: str, path: str, payload=None) -> dict: body = '' if payload is None else json.dumps(payload, separators=(',', ':'), ensure_ascii=False) timestamp = str(int(time.time() * 1000)) nonce = secrets.token_hex(16) message = f'{timestamp}.{nonce}.{method.upper()}.{path}.{body}' signature = hmac.new(os.environ['TALOS_SECRET'].encode(), message.encode('utf-8'), hashlib.sha256).hexdigest() headers = { 'X-Merchant-Id': os.environ['TALOS_MERCHANT'], 'X-Timestamp': timestamp, 'X-Nonce': nonce, 'X-Signature': signature, } if payload is not None: headers['Content-Type'] = 'application/json' request = urllib.request.Request( os.environ['TALOS_API_HOST'] + path, # host without /v1 data=body.encode('utf-8') if payload is not None else None, headers=headers, method=method.upper(), ) try: with urllib.request.urlopen(request) as response: return json.load(response) except urllib.error.HTTPError as error: # 4xx/5xx also carry the JSON envelope return json.load(error) me = talos('GET', '/v1/merchant') ``` #### Test vector Use it to check your implementation: | Input | Value | | --- | --- | | secret | `segredo-de-teste` | | timestamp | `1767225600000` | | nonce | `0f1e2d3c4b5a69788796a5b4c3d2e1f0` | | method / path | `POST` `/v1/game/launch` | | body | `{"player_id":"user-123","game":"fortune-tiger"}` | ```text 1767225600000.0f1e2d3c4b5a69788796a5b4c3d2e1f0.POST./v1/game/launch.{"player_id":"user-123","game":"fortune-tiger"} ``` Expected signature (computed with the same function TALOS uses): ```text 6c3a614460cc673c9a247c3e8ced9de5e2d14e5e31b4d0493693f8b6703b2a7a ``` ### Validating calls from TALOS Wallet callbacks arrive with the same four headers, signed with the secret of the merchant given in `X-Merchant-Id`. Before touching the balance: 1. Read the **raw body** (text) before any JSON parsing. 2. Check that `X-Merchant-Id` is one of your merchants and use its secret. 3. Reject an `X-Timestamp` outside a 5-minute window. 4. Recompute the signature with the method (`POST`), the **path + query of your `walletUrl`** and the raw body, and compare in constant time. 5. Recommended: keep the received nonces for at least 10 minutes and reject repeated ones. 6. Only then parse the JSON. Reply `401` with `{ "ok": false, "error": "INVALID_SIGNATURE" }` when validation fails. ```ts import { createHmac, timingSafeEqual } from 'node:crypto' const SECRETS: Record = { [process.env.TALOS_MERCHANT!]: process.env.TALOS_SECRET! } const WINDOW_MS = 5 * 60_000 export function verifyTalos(request: Request, rawBody: string): boolean { const merchant = request.headers.get('x-merchant-id') const timestamp = request.headers.get('x-timestamp') const nonce = request.headers.get('x-nonce') const signature = request.headers.get('x-signature') const secret = merchant ? SECRETS[merchant] : undefined if (!secret || !timestamp || !nonce || !signature) return false if (Math.abs(Date.now() - Number(timestamp)) > WINDOW_MS) return false const url = new URL(request.url) const expected = createHmac('sha256', secret) .update(`${timestamp}.${nonce}.${request.method}.${url.pathname}${url.search}.${rawBody}`, 'utf8') .digest() const given = Buffer.from(signature, 'hex') return given.length === expected.length && timingSafeEqual(given, expected) } ``` ```php getenv('TALOS_SECRET')]; $merchant = $_SERVER['HTTP_X_MERCHANT_ID'] ?? ''; $timestamp = $_SERVER['HTTP_X_TIMESTAMP'] ?? ''; $nonce = $_SERVER['HTTP_X_NONCE'] ?? ''; $signature = $_SERVER['HTTP_X_SIGNATURE'] ?? ''; $secret = $secrets[$merchant] ?? null; if (!$secret || $timestamp === '' || $nonce === '' || $signature === '') { return false; } if (abs(microtime(true) * 1000 - (float) $timestamp) > 5 * 60 * 1000) { return false; } $expected = hash_hmac('sha256', "$timestamp.$nonce." . strtoupper($method) . ".$pathWithQuery.$rawBody", $secret); return hash_equals($expected, strtolower($signature)); } $raw = file_get_contents('php://input'); if (!verify_talos($raw, $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI'])) { http_response_code(401); echo json_encode(['ok' => false, 'error' => 'INVALID_SIGNATURE']); exit; } ``` ```python import hashlib, hmac, os, time SECRETS = {os.environ['TALOS_MERCHANT']: os.environ['TALOS_SECRET']} def verify_talos(headers, method: str, path_with_query: str, raw_body: str) -> bool: secret = SECRETS.get(headers.get('X-Merchant-Id', '')) timestamp = headers.get('X-Timestamp') nonce = headers.get('X-Nonce') signature = headers.get('X-Signature') if not secret or not timestamp or not nonce or not signature: return False if abs(time.time() * 1000 - float(timestamp)) > 5 * 60 * 1000: return False message = f'{timestamp}.{nonce}.{method.upper()}.{path_with_query}.{raw_body}' expected = hmac.new(secret.encode(), message.encode('utf-8'), hashlib.sha256).hexdigest() return hmac.compare_digest(expected, signature.lower()) ``` > **Behind a proxy** > > The signed path is the one of the `walletUrl` configured at TALOS. If a proxy rewrites the path before it reaches your application, use the original `walletUrl` path in the calculation. --- Page: https://docs.talosigaming.com/en/game-launch ## Game launch `POST /v1/game/launch` opens a game for a player and returns the `launch_url`. The same route serves slots and live casino. ### Request | Field | Required | Description | | --- | --- | --- | | `player_id` | yes | Player id in your system (1–128 characters). It is the `player_id` returned in the wallet callbacks. | | `game` | yes | Game code, from [`GET /v1/games`](https://docs.talosigaming.com/en/reference/get-games). | | `provider` | no | Provider code. Required when the same game code exists in more than one provider (`AMBIGUOUS_GAME`). | | `currency` | no | Currency (ISO 4217). It must be the merchant currency; default: the merchant's. | | `lang` | no | Language (`pt`, `es`, `en` or a regional tag such as `en-US`). Default: the merchant language; without one, `pt`. | | `country` | no | Player country, ISO 3166-1 alpha-2 (e.g. `MX`). Default: the currency country. Some games and providers do not open in certain countries (`COUNTRY_NOT_ALLOWED`): send the player's real country. `GET /v1/games` already hides what is blocked in the merchant's currency country. See [Currencies, languages and countries](https://docs.talosigaming.com/en/currencies-languages-countries). | | `demo` | no | `true` opens in fun mode, without wallet (only games with `demo_available`). | | `lobby_url` | no | URL the game returns to when the player leaves. | The game gets no balance at launch: the provider queries the balance through the [wallet callback](https://docs.talosigaming.com/en/wallet) (`action: "balance"`) as soon as it opens. ```ts import { talos } from './talos' // see Authentication const res = await talos('POST', '/v1/game/launch', { player_id: 'user-123', game: 'fortune-tiger', // code from GET /v1/games lang: 'en-US', lobby_url: 'https://your-site.com/casino' }) if (!res.success) throw new Error(`${res.error.code}: ${res.message}`) // open res.data.launch_url in an iframe or a new window ``` ```bash TS=$(($(date +%s) * 1000)) NONCE=$(openssl rand -hex 16) REQ_PATH='/v1/game/launch' BODY='{"player_id":"user-123","game":"fortune-tiger","lang":"en-US"}' SIG=$(printf '%s' "$TS.$NONCE.POST.$REQ_PATH.$BODY" | openssl dgst -sha256 -hmac "$TALOS_SECRET" | sed 's/^.* //') curl -X POST "$TALOS_API_HOST$REQ_PATH" \ -H "Content-Type: application/json" \ -H "X-Merchant-Id: $TALOS_MERCHANT" \ -H "X-Timestamp: $TS" \ -H "X-Nonce: $NONCE" \ -H "X-Signature: $SIG" \ -d "$BODY" ``` ### Response ```json { "success": true, "message": "Game launched", "statusCode": 200, "data": { "launch_url": "https://...", "game": "fortune-tiger", "provider": "PGSOFT", "demo": false } } ``` - Open the `launch_url` in an `iframe` (or in a new window on mobile). It is for immediate use: generate a new one on every open, do not store it for reuse. - If a provider has more than one integration source, TALOS automatically tries the next one when the first does not open the game. It is transparent on your side. - The `message` is in English; always decide by the fields and by `error.code`. ### Errors | HTTP | Code | Cause | | --- | --- | --- | | 400 | `UNSUPPORTED_CURRENCY` | `currency` is not one of the supported currencies. | | 400 | `INVALID_COUNTRY` | `country` is not a valid ISO 3166-1 alpha-2 code. | | 402 | `BILLING_BALANCE_EXHAUSTED` | The merchant's prepaid GGR balance ran out; contact TALOS to top it up. In games already open, the next bets are refused too (the player sees an error from the provider); wins from bets already placed are always paid. `demo` mode is not affected. | | 402 | `BILLING_CREDIT_LIMIT_EXCEEDED` | The open (postpaid) balance is above the merchant's credit limit. | | 402 | `BILLING_INVOICE_OVERDUE` | There is an overdue, unpaid GGR invoice. | | 403 | `CURRENCY_NOT_ENABLED` | `currency` differs from the merchant currency — use the merchant of that currency (same group). | | 403 | `PRODUCT_NOT_ENABLED` | The game type (slot, live) is not enabled on the merchant. | | 403 | `GAME_NOT_ENABLED` | The game (or its provider) is not offered by this merchant. | | 403 | `COUNTRY_NOT_ALLOWED` | The player country (`country`, or the currency one) is blocked for the merchant, the provider or the game. | | 404 | `GAME_NOT_FOUND` | Game does not exist, is inactive or belongs to an inactive provider. | | 409 | `WALLET_NOT_CONFIGURED` | The merchant has no `walletUrl` yet (only with `demo: false`). | | 409 | `AMBIGUOUS_GAME` | The code exists in more than one provider; send `provider`. | | 422 | `PROVIDER_NOT_SUPPORTED` | The game provider has no launch integration. | | 422 | `VALIDATION_ERROR` | Body does not match the schema (missing required field, length, format). | | 500 | `LAUNCH_GAME_FAILED` | Internal error; try again. | | 503 | `LAUNCH_FAILED` | The provider could not open the game. | See also the [authentication](https://docs.talosigaming.com/en/authentication#validation-rules) errors and the general format in [Errors](https://docs.talosigaming.com/en/errors). --- Page: https://docs.talosigaming.com/en/wallet ## Seamless wallet TALOS does not store the player balance. On every balance query and every transaction it sends a **callback** to your `walletUrl`, and your reply is the source of truth. The full specification is in [Wallet callback](https://docs.talosigaming.com/en/reference/wallet-callback). ### Request `POST` to your `walletUrl`, with `Content-Type: application/json` and the signed headers (see [Validating calls from TALOS](https://docs.talosigaming.com/en/authentication#validating-calls-from-talos)). | Field | Present in | Description | | --- | --- | --- | | `action` | all | `balance`, `bet`, `win`, `refund` or `rollback`. | | `player_id` | all | The `player_id` you sent at launch. | | `currency` | all | Merchant currency. | | `provider` | all | Game provider code. | | `game` | all | Game code. | | `tx_id` | transactions | Unique transaction id. **Idempotency key.** | | `round_id` | transactions | Round the transaction belongs to. | | `amount` | transactions | Amount, always positive, in the **major currency unit** (e.g. `2.5` = US$ 2.50; up to 2 decimals; CLP has none). | | `ref_tx_id` | refund, rollback | `tx_id` of the reverted transaction. | Treat `tx_id`, `round_id` and `ref_tx_id` as opaque strings. ### Actions | Action | Balance effect | What to do | | --- | --- | --- | | `balance` | none | Return the current balance. | | `bet` | debit of `amount` | Debit. Without funds, reject with `INSUFFICIENT_FUNDS`. | | `win` | credit of `amount` | Credit. A round without a win generates no `win`. | | `refund` | credit | Return the `ref_tx_id` bet (same amount). If you never applied that bet, reply `TRANSACTION_NOT_FOUND`. | | `rollback` | debit | Undo the `ref_tx_id` win (same amount). If you never applied that win, reply `TRANSACTION_NOT_FOUND`. | The normal order of a round is `bet` → `win`. Some providers send the win before the bet; do not rely on the order, rely on the `tx_id`. ### Response Always reply with JSON: ```json { "ok": true, "balance": 97.5 } ``` ```json { "ok": false, "error": "INSUFFICIENT_FUNDS", "balance": 1.2 } ``` - `balance` is the balance **after** the transaction, in the major currency unit. It is required when `ok` is `true`. - In rejections, `balance` is optional (it helps the provider show the right balance). - The `error` code is read in uppercase. Use these when they apply: | `error` | When | | --- | --- | | `INSUFFICIENT_FUNDS` | Not enough balance for the bet. | | `PLAYER_NOT_FOUND` | Unknown `player_id`. | | `PLAYER_BLOCKED` | Player blocked (self-exclusion, fraud, limit). | | `TRANSACTION_NOT_FOUND` | In `refund`/`rollback`: you never applied the `ref_tx_id` transaction. | Any other code is also accepted and treated as a rejection. ### Idempotency **The same `tx_id` can arrive more than once** — resends after a timeout, retries from the provider. For each `tx_id`: 1. The first time, apply it and store the result (success with the balance, or the rejection). 2. The following times, **do not apply it again**: return the same result (with the current balance, if you prefer). Do the check and the debit in one database transaction (e.g. `tx_id` with a unique index), so two simultaneous requests with the same `tx_id` never debit twice. > **Never apply the same tx_id twice** > > TALOS reuses the same `tx_id` when resending the same transaction precisely so you can deduplicate. If your endpoint is not idempotent, a timeout followed by a resend debits the player twice. ### Unknown result and resends TALOS considers the reply **unavailable** — the result on your side is unknown — when: - there is no reply within **8 seconds** (default timeout); - the connection fails; - the HTTP status is **5xx**; - the body is not JSON, has no boolean `ok`, or has `ok: true` without a numeric `balance`. In those cases the transaction stays pending. It is resolved by a resend with the **same `tx_id`** (when the provider repeats the operation) or by a `refund` that references it. So, if you received and applied the bet but the reply did not arrive, the resend must return the same success; and if you never received the bet, its `refund` must reply `TRANSACTION_NOT_FOUND`. Replies with an HTTP status below 500 are read from the body: a `401` or `400` with `{ "ok": false, "error": "..." }` is a rejection, not an outage. ### Final rejections - A rejected **bet** (`bet`) or **rollback** is final: a resend of the same `tx_id` returns the same rejection without calling you again. - A rejected **credit** (`win`, `refund`) is resent when the provider repeats the operation. Avoid rejecting credits for business rules — the money belongs to the player. - The same `tx_id` with a **different amount** is rejected by TALOS (`TRANSACTION_MISMATCH`) without calling your wallet. ### Endpoint example ```ts // app/api/talos/wallet/route.ts (Next.js) — sketch; adapt it to your database import { verifyTalos } from './verify' // see Authentication export async function POST(request: Request) { const raw = await request.text() if (!verifyTalos(request, raw)) { return Response.json({ ok: false, error: 'INVALID_SIGNATURE' }, { status: 401 }) } const cb = JSON.parse(raw) if (cb.action === 'balance') { const balance = await wallet.balanceOf(cb.player_id, cb.currency) return Response.json({ ok: true, balance }) } // idempotency: the same tx_id returns the stored result const previous = await wallet.findMove(cb.tx_id) if (previous) return Response.json(previous.reply) const reply = await wallet.apply(cb) // debit/credit + store tx_id and reply in the same transaction return Response.json(reply) } ``` ```php false, 'error' => 'INVALID_SIGNATURE'])); } $cb = json_decode($raw, true); header('Content-Type: application/json'); if ($cb['action'] === 'balance') { exit(json_encode(['ok' => true, 'balance' => wallet_balance($cb['player_id'], $cb['currency'])])); } $previous = wallet_find_move($cb['tx_id']); // idempotency by tx_id if ($previous) { exit($previous['reply']); } echo json_encode(wallet_apply($cb)); // apply and store tx_id + reply in the same transaction ``` ### Reconciliation Every transaction sent to your wallet, with its status (`success`, `pending`, `failed`) and the returned error, is in [`GET /v1/transactions`](https://docs.talosigaming.com/en/reference/get-transactions). Use it to reconcile with your ledger. --- Page: https://docs.talosigaming.com/en/currencies-languages-countries ## Currencies, languages and countries ### Currencies A merchant operates in **one** currency. To operate in several, TALOS creates one merchant per currency in the same group (same brand). The launch rejects any other currency with `CURRENCY_NOT_ENABLED`. | Code | Currency | Decimals | Country (player default) | | --- | --- | --- | --- | | `BRL` | Brazilian real | 2 | `BR` | | `MXN` | Mexican peso | 2 | `MX` | | `ARS` | Argentine peso | 2 | `AR` | | `COP` | Colombian peso | 2 | `CO` | | `CLP` | Chilean peso | 0 | `CL` | | `PEN` | Peruvian sol | 2 | `PE` | | `USD` | US dollar | 2 | — (no default country) | #### Amount units | Where | Unit | Example (US$ 2.50) | | --- | --- | --- | | Wallet callback (`amount`, `balance`) | major unit | `2.5` | | Operator API (transactions, GGR) | major unit | `2.5` | `CLP` has no cents: `1500` is $1,500. ### Languages The launch `lang` field accepts the language code (`pt`, `es`, `en`) or a regional tag (`pt-BR`, `es-MX`). Without `lang`, the merchant default language applies; without one, `pt`. The language is passed to the provider, which may have its own list of languages. ### Player country The launch `country` field (ISO 3166-1 alpha-2, e.g. `MX`) tells the player country. Without it, the currency country applies (table above); with `USD` there is no country. An invalid code returns `INVALID_COUNTRY`. The country also drives availability: a game, provider or merchant blocked in the player's country refuses the launch with `COUNTRY_NOT_ALLOWED`. --- Page: https://docs.talosigaming.com/en/errors ## Errors ### Format API responses have an envelope. On error, the HTTP status is the same `statusCode` as in the body and the stable code is in `error.code`: ```json { "success": false, "message": "This merchant operates in BRL; use your group's MXN merchant", "statusCode": 403, "error": { "code": "CURRENCY_NOT_ENABLED" } } ``` Decide by `error.code`; the `message` is text for people (in English) and may change. #### Validation error (422) A body or query that does not match the schema has its own format, with the list of invalid fields: ```json { "data": null, "status": 422, "error": "VALIDATION_ERROR", "message": "Validation error", "details": [{ "path": "/player_id", "message": "Expected string" }] } ``` ### Catalog #### General (all routes) | HTTP | Code | Cause | | --- | --- | --- | | 400 | `INVALID_BODY` | Body sent as `application/json` that is not valid JSON. | | 404 | `ROUTE_NOT_FOUND` | Route does not exist (check the method, the path and the `/v1` version). | | 429 | `RATE_LIMITED` | Too many requests from the same IP in a minute; wait a few seconds and resend. | #### Authentication (all routes) | HTTP | Code | Cause | | --- | --- | --- | | 401 | `MISSING_AUTH_HEADERS` | `X-Merchant-Id`, `X-Timestamp`, `X-Nonce` or `X-Signature` is missing. | | 401 | `REQUEST_EXPIRED` | `X-Timestamp` outside the 5-minute window. | | 401 | `INVALID_MERCHANT` | Unknown merchant. | | 401 | `MERCHANT_BLOCKED` | Merchant is blocked. | | 401 | `INVALID_SIGNATURE` | The signature does not match. | | 401 | `IP_NOT_ALLOWED` | Source IP not in the merchant list. | | 401 | `NONCE_REUSED` | Repeated nonce. | | 503 | `AUTH_UNAVAILABLE` | Temporary failure; resend with a new nonce. | #### Game launch | HTTP | Code | Cause | | --- | --- | --- | | 400 | `UNSUPPORTED_CURRENCY` | Currency not in the supported list. | | 400 | `INVALID_COUNTRY` | Country is not a valid ISO 3166-1 alpha-2 code. | | 402 | `BILLING_BALANCE_EXHAUSTED` | Prepaid GGR balance exhausted: games open again after a top-up. | | 402 | `BILLING_CREDIT_LIMIT_EXCEEDED` | Open balance above the credit limit (postpaid). | | 402 | `BILLING_INVOICE_OVERDUE` | GGR invoice overdue and unpaid. | | 403 | `CURRENCY_NOT_ENABLED` | Currency differs from the merchant currency. | | 403 | `PRODUCT_NOT_ENABLED` | The game product is not enabled. | | 403 | `GAME_NOT_ENABLED` | Game or provider not offered by this merchant. | | 403 | `COUNTRY_NOT_ALLOWED` | Player country blocked for the merchant, the provider or the game. | | 404 | `GAME_NOT_FOUND` | Game does not exist or is inactive. | | 409 | `WALLET_NOT_CONFIGURED` | Merchant without `walletUrl`. | | 409 | `AMBIGUOUS_GAME` | Code exists in more than one provider; send `provider`. | | 422 | `PROVIDER_NOT_SUPPORTED` | Provider without a launch integration. | | 500 | `LAUNCH_GAME_FAILED` | Internal error. | | 503 | `LAUNCH_FAILED` | The provider did not open the game. | #### Queries | HTTP | Code | Route | | --- | --- | --- | | 400 | `INVALID_RANGE` | `GET /v1/reports/ggr`: `from` is not before `to`. | | 400 | `RANGE_TOO_LARGE` | `GET /v1/reports/ggr`: period longer than 93 days. | | 500 | `GGR_REPORT_FAILED` | `GET /v1/reports/ggr` | | 500 | `LIST_GAMES_FAILED` | `GET /v1/games` | | 500 | `LIST_PROVIDERS_FAILED` | `GET /v1/providers` | | 500 | `LIST_TRANSACTIONS_FAILED` | `GET /v1/transactions` | #### Your wallet replies Codes your wallet returns in `{ "ok": false, "error": "..." }` (see [Seamless wallet](https://docs.talosigaming.com/en/wallet#response)): | Code | When to use | | --- | --- | | `INSUFFICIENT_FUNDS` | Not enough balance for the bet. | | `PLAYER_NOT_FOUND` | Unknown player. | | `PLAYER_BLOCKED` | Player is blocked. | | `TRANSACTION_NOT_FOUND` | `refund`/`rollback` of a transaction you never applied. | | `INVALID_SIGNATURE` | Callback with an invalid signature (reply HTTP 401). | ### Retries | Situation | Can you resend? | | --- | --- | | 5xx, timeout, network error | Yes, with a **new** `X-Nonce` and `X-Timestamp`. | | `AUTH_UNAVAILABLE` (503) | Yes, with a new nonce. | | `RATE_LIMITED` (429) | Yes, after a few seconds, with a new nonce. | | `REQUEST_EXPIRED` | Yes, after fixing the clock. | | Other 4xx | No — fix the request. | A failed launch leaves nothing pending: just open it again. --- Page: https://docs.talosigaming.com/en/changelog ## Changelog Changes to the merchant integration, from newest to oldest. ### 2026-10-01 First version of this documentation, covering the operator API v2: - HMAC-SHA256 authentication with `X-Merchant-Id`, `X-Timestamp`, `X-Nonce` and `X-Signature`. - `POST /v1/game/launch` with `currency`, `lang` and `country` (player country, optional). - One merchant per currency (BRL, MXN, ARS, COP, CLP, PEN, USD), grouped by brand. - `GET /v1/merchant` with the merchant code, currency and brand (`brand`). - Single wallet callback (`balance`, `bet`, `win`, `refund`, `rollback`), idempotent by `tx_id`. - Documentation available in Portuguese, Spanish and English. --- # API reference --- ## Authenticated merchant details (currency, language, products) `GET /v1/merchant` · Page: https://docs.talosigaming.com/en/reference/get-merchant Details of the authenticated merchant: code, operation currency, enabled products and brand (`brand`). Signed request (HMAC-SHA256): see Authentication. ### Responses - **200** Success - **401** `MISSING_AUTH_HEADERS`, `INVALID_MERCHANT`, `MERCHANT_BLOCKED`, `REQUEST_EXPIRED`, `INVALID_SIGNATURE`, `NONCE_REUSED`, `IP_NOT_ALLOWED` - **422** Body or query does not match the schema - **429** `RATE_LIMITED` - **503** `AUTH_UNAVAILABLE` Response example: ```json { "success": true, "message": "OK", "statusCode": 200, "data": { "code": "minha-bet", "name": "Minha Bet", "currency": "BRL", "lang": "pt", "products": [ "slots" ], "wallet_configured": true, "brand": "minha-marca" } } ``` --- ## Launches a game and returns the launch_url `POST /v1/game/launch` · Page: https://docs.talosigaming.com/en/reference/post-game-launch Opens a game for the player and returns the `launch_url`. It takes no balance: the provider reads the balance through the wallet callback. Signed request (HMAC-SHA256): see Authentication. ### Body | Field | Type | Required | Description | | --- | --- | --- | --- | | `player_id` | string | yes | Player id at the merchant; comes back as player_id in the wallet callback; 1–128 characters | | `game` | string | yes | Game code (GET /games); 1–128 characters | | `provider` | string | | Provider code; required when the game code exists in more than one provider; 1–64 characters | | `currency` | string | | Currency (ISO 4217); must be the merchant currency. Default: the merchant's; 3–8 characters | | `lang` | string | | Language (pt, es, en or a regional tag such as en-US). Default: the merchant's, otherwise pt; 2–10 characters | | `country` | string | | Player country (ISO 3166-1 alpha-2). Default: the currency country (USD: none); 2–2 characters | | `demo` | boolean | | Fun mode, without wallet (only games with demo_available) | | `lobby_url` | string (uri) | | URL the game returns to on exit | Example: ```json { "player_id": "user-123", "game": "fortune-tiger", "lang": "pt" } ``` ### Responses - **200** Success - **400** `INVALID_BODY`, `UNSUPPORTED_CURRENCY`, `INVALID_COUNTRY` - **401** `MISSING_AUTH_HEADERS`, `INVALID_MERCHANT`, `MERCHANT_BLOCKED`, `REQUEST_EXPIRED`, `INVALID_SIGNATURE`, `NONCE_REUSED`, `IP_NOT_ALLOWED` - **402** `BILLING_BALANCE_EXHAUSTED`, `BILLING_CREDIT_LIMIT_EXCEEDED`, `BILLING_INVOICE_OVERDUE` - **403** `CURRENCY_NOT_ENABLED`, `PRODUCT_NOT_ENABLED`, `GAME_NOT_ENABLED`, `COUNTRY_NOT_ALLOWED` - **404** `GAME_NOT_FOUND` - **409** `WALLET_NOT_CONFIGURED`, `AMBIGUOUS_GAME` - **422** `PROVIDER_NOT_SUPPORTED` - **429** `RATE_LIMITED` - **500** `LAUNCH_GAME_FAILED` - **503** `AUTH_UNAVAILABLE`, `LAUNCH_FAILED` Response example: ```json { "success": true, "message": "OK", "statusCode": 200, "data": { "launch_url": "https://launch.exemplo/fortune-tiger?token=eyJhbGciOi...", "game": "fortune-tiger", "provider": "PGSOFT", "demo": true } } ``` --- ## Lists available games `GET /v1/games` · Page: https://docs.talosigaming.com/en/reference/get-games Paginated catalog of the active games of the products enabled for the merchant. Signed request (HMAC-SHA256): see Authentication. ### Parameters | Field | Type | Required | Description | | --- | --- | --- | --- | | `page` | number | | Page (starts at 1) | | `limit` | number | | Items per page | | `provider` | string | | Provider code | | `type` | "slot" \| "live" | | Game type | | `category` | string | | Game category | | `search` | string | | Search by part of the name (case-insensitive) | ### Responses - **200** Success - **401** `MISSING_AUTH_HEADERS`, `INVALID_MERCHANT`, `MERCHANT_BLOCKED`, `REQUEST_EXPIRED`, `INVALID_SIGNATURE`, `NONCE_REUSED`, `IP_NOT_ALLOWED` - **422** Body or query does not match the schema - **429** `RATE_LIMITED` - **500** `LIST_GAMES_FAILED` - **503** `AUTH_UNAVAILABLE` Response example: ```json { "success": true, "message": "OK", "statusCode": 200, "data": [ { "code": "minha-bet", "name": "Minha Bet", "provider": "PGSOFT", "type": "slot", "category": "string", "rtp": 0, "volatility": "string", "banner": "string", "tags": [ "string" ], "featured": true, "is_new": true, "demo_available": true } ], "meta": { "page": 1, "limit": 50, "total": 120, "totalPages": 3 } } ``` --- ## Lists available providers `GET /v1/providers` · Page: https://docs.talosigaming.com/en/reference/get-providers Providers of the enabled products, with the count of active games. Signed request (HMAC-SHA256): see Authentication. ### Responses - **200** Success - **401** `MISSING_AUTH_HEADERS`, `INVALID_MERCHANT`, `MERCHANT_BLOCKED`, `REQUEST_EXPIRED`, `INVALID_SIGNATURE`, `NONCE_REUSED`, `IP_NOT_ALLOWED` - **422** Body or query does not match the schema - **429** `RATE_LIMITED` - **500** `LIST_PROVIDERS_FAILED` - **503** `AUTH_UNAVAILABLE` Response example: ```json { "success": true, "message": "OK", "statusCode": 200, "data": [ { "code": "minha-bet", "name": "Minha Bet", "type": "slot", "games": 0 } ] } ``` --- ## Wallet transaction history `GET /v1/transactions` · Page: https://docs.talosigaming.com/en/reference/get-transactions Paginated history of the merchant wallet transactions (what was sent to the callback and the result). Signed request (HMAC-SHA256): see Authentication. ### Parameters | Field | Type | Required | Description | | --- | --- | --- | --- | | `page` | number | | Page (starts at 1) | | `limit` | number | | Items per page | | `player_id` | string | | Player id at the merchant | | `round_id` | string | | Round (round_id from the callback) | | `tx_id` | string | | tx_id sent in the wallet callback | | `action` | "bet" \| "win" \| "refund" \| "rollback" | | Callback action | | `status` | "pending" \| "success" \| "failed" | | pending = no definitive answer from the wallet; failed = rejected | | `from` | string (date-time) | | Start (ISO 8601) | | `to` | string (date-time) | | End (ISO 8601, exclusive) | ### Responses - **200** Success - **401** `MISSING_AUTH_HEADERS`, `INVALID_MERCHANT`, `MERCHANT_BLOCKED`, `REQUEST_EXPIRED`, `INVALID_SIGNATURE`, `NONCE_REUSED`, `IP_NOT_ALLOWED` - **422** Body or query does not match the schema - **429** `RATE_LIMITED` - **500** `LIST_TRANSACTIONS_FAILED` - **503** `AUTH_UNAVAILABLE` Response example: ```json { "success": true, "message": "OK", "statusCode": 200, "data": [ { "tx_id": "PGSOFT:982341:bet", "ref_tx_id": "string", "action": "bet", "status": "pending", "player_id": "user-123", "provider": "PGSOFT", "game": "fortune-tiger", "round_id": "982341", "amount": 0, "currency": "BRL", "balance_after": 0, "error": "string", "created_at": "2026-10-01T12:00:00.000Z" } ], "meta": { "page": 1, "limit": 50, "total": 120, "totalPages": 3 } } ``` --- ## GGR / turnover report `GET /v1/reports/ggr` · Page: https://docs.talosigaming.com/en/reference/get-reports-ggr Merchant GGR and turnover for the period (maximum of 93 days), total or grouped. Signed request (HMAC-SHA256): see Authentication. ### Parameters | Field | Type | Required | Description | | --- | --- | --- | --- | | `from` | string (date-time) | yes | Period start (ISO 8601) | | `to` | string (date-time) | yes | Period end (ISO 8601); maximum of 93 days | | `group_by` | "day" \| "provider" \| "game" \| "player" | | Grouping; without it, a single total row | ### Responses - **200** Success - **400** `INVALID_RANGE`, `RANGE_TOO_LARGE` - **401** `MISSING_AUTH_HEADERS`, `INVALID_MERCHANT`, `MERCHANT_BLOCKED`, `REQUEST_EXPIRED`, `INVALID_SIGNATURE`, `NONCE_REUSED`, `IP_NOT_ALLOWED` - **422** Body or query does not match the schema - **429** `RATE_LIMITED` - **500** `GGR_REPORT_FAILED` - **503** `AUTH_UNAVAILABLE` Response example: ```json { "success": true, "message": "OK", "statusCode": 200, "data": { "from": "2026-10-01T12:00:00.000Z", "to": "2026-10-01T12:00:00.000Z", "group_by": "total", "currency": "BRL", "rows": [ { "key": "total", "currency": "BRL", "bets": 0, "wins": 0, "refunds": 0, "rollbacks": 0, "turnover": 0, "payout": 0, "ggr": 0, "rounds": 0, "players": 0 } ] } } ``` --- ## Wallet callback `POST {walletUrl}` · Page: https://docs.talosigaming.com/en/reference/wallet-callback JSON POST to the `walletUrl` configured on the merchant. Default timeout of 8 s (`WALLET_TIMEOUT_MS`). Always reply with JSON; HTTP 5xx, a timeout or an invalid body leave the transaction with an unknown result. TALOS calls your `walletUrl` with the same signed headers; check the signature before touching the balance. ### Body | Field | Type | Required | Description | | --- | --- | --- | --- | | `action` | "balance" \| "bet" \| "win" \| "refund" \| "rollback" | yes | | | `player_id` | string | yes | Player id at the merchant (the launch `player_id`) | | `currency` | string | yes | Merchant currency | | `provider` | string | yes | Game provider code | | `game` | string | yes | Game code | | `tx_id` | string | | Unique transaction id (absent in `balance`). Idempotency key: the same tx_id must never be applied twice. | | `ref_tx_id` | string | | Only in refund/rollback: tx_id of the reverted bet (refund) or win (rollback) | | `round_id` | string | | Round/bet at the provider (absent in `balance`) | | `amount` | number | | Amount in the major currency unit (up to 2 decimals; CLP has no cents). Absent in `balance`.; minimum 0 | Example: ```json { "action": "balance", "player_id": "user-123", "currency": "BRL", "provider": "PGSOFT", "game": "fortune-tiger" } ``` ### Responses - **200** Operation result (any status < 500 with JSON is read from the body) Response example: ```json { "ok": true, "balance": 0 } ```