Game sessions API
Request and response reference for POST /api/v1/game-sessions/start, including demo game launch examples.
POST /api/v1/game-sessions/start
Create a game session with a server-side Bearer API key. In the sandbox, use the endpoint sent with your sandbox key and a demo game ID.
Request fields
The homepage sample uses exactly these fields.
- game_id — game identifier
- player_id — your player identifier
- currency — session fiat currency
- country_code — country code
- ip_address — player IP address
- locale — session locale
- device — device value
- return_url — return destination
Request examples
CASINO201_ENDPOINT is the endpoint sent with your key. Keep CASINO201_API_KEY on your server. Example values are taken from the homepage sample.
curl -X POST "$CASINO201_ENDPOINT/api/v1/game-sessions/start" \
-H "Authorization: Bearer $CASINO201_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"game_id": 123,
"player_id": "player_456",
"currency": "EUR",
"country_code": "US",
"ip_address": "203.0.113.24",
"locale": "en",
"device": "mobile",
"return_url": "https://yourcasino.com/lobby"
}'const response = await fetch(`${process.env.CASINO201_ENDPOINT}/api/v1/game-sessions/start`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CASINO201_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
game_id: 123,
player_id: 'player_456',
currency: 'EUR',
country_code: 'US',
ip_address: request.ip,
locale: 'en',
device: 'mobile',
return_url: 'https://yourcasino.com/lobby',
}),
});
const { data: gameSession } = await response.json();
// Load gameSession.iframe_url for the player$payload = json_encode([
'game_id' => 123,
'player_id' => 'player_456',
'currency' => 'EUR',
'country_code' => 'US',
'ip_address' => $_SERVER['REMOTE_ADDR'],
'locale' => 'en',
'device' => 'mobile',
'return_url' => 'https://yourcasino.com/lobby',
]);
$curl = curl_init(getenv('CASINO201_ENDPOINT') . '/api/v1/game-sessions/start');
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CASINO201_API_KEY'),
'Content-Type: application/json',
],
]);
$gameSession = json_decode(curl_exec($curl), true)['data'];
// Load $gameSession['iframe_url'] for the playerResponse fields
The response shown on the homepage contains success and data.session_id, data.session_token, data.expires_at and data.iframe_url.
{
"success": true,
"data": {
"session_id": 918274,
"session_token": "8f2c41d9e7a3b5…",
"expires_at": "2026-10-04T12:00:00+00:00",
"iframe_url": "https://api.casino201.com/start_game?token=8f2c41d9e7a3b5…"
}
}Full reference
Full field reference is included with your sandbox key. Consult it for field constraints, errors and rate limits.