Operator API
Launches a game and returns the launch_url
post
/v1/game/launchOpens a game for the player and returns the launch_url. It takes no balance: the provider reads the balance through the wallet callback.
Authentication#
Request signed with HMAC-SHA256: headers X-Merchant-Id, X-Timestamp, X-Nonce and X-Signature. See Authentication.
Body#
application/json
| Field | Description |
|---|---|
player_idstringrequired | Player id at the merchant; comes back as player_id in the wallet callback 1–128 characters |
gamestringrequired | Game code (GET /games) 1–128 characters |
providerstring | Provider code; required when the game code exists in more than one provider 1–64 characters |
currencystring | Currency (ISO 4217); must be the merchant currency. Default: the merchant's 3–8 characters |
langstring | Language (pt, es, en or a regional tag such as en-US). Default: the merchant's, otherwise pt 2–10 characters |
countrystring | Player country (ISO 3166-1 alpha-2). Default: the currency country (USD: none) 2–2 characters |
demoboolean | Fun mode, without wallet (only games with demo_available) |
lobby_urlstring (uri) | URL the game returns to on exit |
Example#
# TALOS_API_HOST (without /v1), TALOS_MERCHANT and TALOS_SECRET are provided by TALOS
TS=$(($(date +%s) * 1000))
NONCE=$(openssl rand -hex 16)
REQ_PATH='/v1/game/launch'
BODY='{"player_id":"user-123","game":"fortune-tiger","lang":"pt"}'
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"import { talos } from './talos' // signed client (see Authentication)
const res = await talos('POST', '/v1/game/launch', {
"player_id": "user-123",
"game": "fortune-tiger",
"lang": "pt"
})
if (!res.success) throw new Error(`${res.error.code}: ${res.message}`)
console.log(res.data)Responses#
200Success
| Field | Description |
|---|---|
successtruerequired | — |
messagestringrequired | — |
statusCodenumberrequired | — |
dataobjectrequired | — |
data.launch_urlstringrequired | URL to open the game (iframe or new window) |
data.gamestringrequired | — |
data.providerstringrequired | — |
data.demobooleanrequired | — |
Response example
{
"success": true,
"message": "OK",
"statusCode": 200,
"data": {
"launch_url": "https://launch.exemplo/fortune-tiger?token=eyJhbGciOi...",
"game": "fortune-tiger",
"provider": "PGSOFT",
"demo": true
}
}| HTTP | Code (error.code) |
|---|---|
| 400 | INVALID_BODYUNSUPPORTED_CURRENCYINVALID_COUNTRY |
| 401 | MISSING_AUTH_HEADERSINVALID_MERCHANTMERCHANT_BLOCKEDREQUEST_EXPIREDINVALID_SIGNATURENONCE_REUSEDIP_NOT_ALLOWED |
| 402 | BILLING_BALANCE_EXHAUSTEDBILLING_CREDIT_LIMIT_EXCEEDEDBILLING_INVOICE_OVERDUE |
| 403 | CURRENCY_NOT_ENABLEDPRODUCT_NOT_ENABLEDGAME_NOT_ENABLEDCOUNTRY_NOT_ALLOWED |
| 404 | GAME_NOT_FOUND |
| 409 | WALLET_NOT_CONFIGUREDAMBIGUOUS_GAME |
| 422 | PROVIDER_NOT_SUPPORTED |
| 429 | RATE_LIMITED |
| 500 | LAUNCH_GAME_FAILED |
| 503 | AUTH_UNAVAILABLELAUNCH_FAILED |
Error format and the meaning of each code in Errors.