Create a session

Real mode creates a game session whose 256-bit launch token is stored only as its SHA-256; demo mode creates no session and accepts no callbacks. A session expires 24 hours after its last callback, or after the client's shorter idle time.

POST/v1/sessions

Request

A client sends this request signed with its credential. The example is signed with the test API key test-key-test-key and the test secret docs-example-signing, at the timestamp 1767225600 with the nonce docs-example-nonce-0001; see Authentication and signing.

Headers

  • Name
    X-Api-Key
    Type
    string, required
    Description

    The credential id. Sent together with X-Timestamp, X-Nonce and X-Signature.

  • Name
    X-Signature
    Type
    string, required
    Description

    Base64 HMAC-SHA256 of the method, the path with its query, X-Timestamp, X-Nonce and the lowercase hex SHA-256 of the raw body, joined by newlines. Compared in constant time; 30 seconds of tolerance; each nonce is used once.

  • Name
    X-Timestamp
    Type
    string, required
    Description

    Unix seconds; within 30 seconds of the receiver's clock. Matches ^[0-9]{1,12}$.

  • Name
    X-Nonce
    Type
    string, required
    Description

    Single use per credential, kept until the timestamp plus 30 seconds. At least 16 characters. At most 128 characters.

Body

  • Name
    player_id
    Type
    string, required
    Description

    The client's own player id, at most 44 characters so that every provider can carry it namespaced. At least 1 character. At most 44 characters.

  • Name
    currency
    Type
    string, required
    Description

    One of TRY, EUR, USD, USDT, TON, BTC, AED, AFN, ALL, AMD, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLF, CLP, CNY, COP, COU, CRC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLE, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TTD, TWD, TZS, UAH, UGX, USN, UYI, UYU, UYW, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XCG, XOF, XPF, YER, ZAR, ZMW, ZWG.

  • Name
    game_id
    Type
    string (uuid), required
    Description

    A UUID v7.

  • Name
    language
    Type
    string, required
    Description

    ISO 639-1. Matches ^[a-z]{2}$.

  • Name
    country
    Type
    string, required
    Description

    ISO 3166-1 alpha-2. Matches ^[A-Z]{2}$.

  • Name
    device
    Type
    string, required
    Description

    One of desktop, mobile.

  • Name
    return_url
    Type
    string (uri), required
    Description

    Where the game sends the player back: an https URL only. A javascript:, data: or http: URL is a 400 MALFORMED_REQUEST and is never sent to a provider. A URL that fails the raw-text check is also a 400 MALFORMED_REQUEST and never sent to a provider. The raw-text check fails on a non-ASCII host or a mixed-script xn-- label, user information, or an empty authority. It also fails on a space, a backslash or a control or invisible character, raw or percent-escaped. Cocktail receives it as its returnUrl and lobbyUrl, and as its depositUrl on a real launch without deposit_url. Matches ^https://.

  • Name
    deposit_url
    Type
    string (uri)
    Description

    The client's cashier, optional and checked like return_url. Cocktail receives it as depositUrl on a real launch. Cocktail requires a depositUrl there, so a real launch without one sends return_url in its place. The other providers' launch calls have no field for it, so they ignore it. Matches ^https://.

  • Name
    mode
    Type
    string, required
    Description

    One of real, demo.

Request

POST
/v1/sessions
curl -X POST "https://aggregator.asteriks.casino/v1/sessions" \
  -H "X-Api-Key: test-key-test-key" \
  -H "X-Timestamp: 1767225600" \
  -H "X-Nonce: docs-example-nonce-0001" \
  -H "X-Signature: YbZLU0ILy257UKRsiwpiFYVuvQtQFTR4pLciHtI1t64=" \
  -H "Content-Type: application/json" \
  -d '{
  "player_id": "player-1001",
  "currency": "EUR",
  "game_id": "0199c5a0-0000-7000-8000-000000000002",
  "language": "en",
  "country": "DE",
  "device": "desktop",
  "return_url": "https://casino.example.com/lobby",
  "deposit_url": "https://example.com",
  "mode": "real"
}'
201

Response

The answer is 201 with application/json.

  • Name
    session_id
    Type
    string (uuid) | null, required
    Description

    In SessionCreated. Null in demo mode.

  • Name
    game_url
    Type
    string (uri), required
    Description

    In SessionCreated. The provider's game frame is handed on as the provider wrote it. This is an https URL that passes the same raw-text check as return_url. The URL has an ASCII host, no user information, and no control, invisible or backslash character, raw or percent-escaped. A provider answer that fails it is a 502 INTERNAL_ERROR, never repaired. Matches ^https://.

  • Name
    expires_at
    Type
    string (date-time) | null, required
    Description

    In SessionCreated. Null in demo mode.

  • Name
    session_id
    Type
    string (uuid), required
    Description

    In SportsbookSessionCreated.

  • Name
    frame
    Type
    object, required
    Description

    In SportsbookSessionCreated. This is BSW's frame bootstrap data. Load both scripts, then boot the frame in the element container_id with server, token, sport_partner and language (SportFrame.frame on desktop, Bootstrapper.bootIframe on mobile).

  • Name
    frame.server
    Type
    string (uri), required
    Description

    In SportsbookSessionCreated. The frame's server, BSW's frame domain. Matches ^https://.

  • Name
    frame.scripts
    Type
    string (uri)[], required
    Description

    In SportsbookSessionCreated. Exactly two scripts: the integration loader and the bootstrapper, loaded in this order (the server's contract holds the pair as a tuple). Each item: matches ^https://.

  • Name
    frame.sport_partner
    Type
    string (uuid), required
    Description

    In SportsbookSessionCreated. The aggregator's sportPartner at BSW.

  • Name
    frame.token
    Type
    string, required
    Description

    In SportsbookSessionCreated. BSW's one-time token from /api/front/token for this launch; a credential, never logged. At least 1 character.

  • Name
    frame.device
    Type
    string, required
    Description

    In SportsbookSessionCreated. One of desktop, mobile.

  • Name
    frame.container_id
    Type
    string, required
    Description

    In SportsbookSessionCreated. The element the frame boots in: sport_div_iframe on desktop, application-container on mobile. One of sport_div_iframe, application-container.

  • Name
    frame.language
    Type
    string, required
    Description

    In SportsbookSessionCreated. The request's language, as the client sent it.

  • Name
    expires_at
    Type
    string (date-time), required
    Description

    In SportsbookSessionCreated.

Errors

Each error carries one of these codes in the error object of Errors.

  • Name
    MALFORMED_REQUEST
    Type
    400
    Description

    MALFORMED_REQUEST: a body, query or path value fails its schema.

  • Name
    UNAUTHORIZED
    Type
    401
    Description

    UNAUTHORIZED: a missing or wrong key, signature, timestamp or nonce.

  • Name
    NOT_FOUND
    Type
    404
    Description

    NOT_FOUND: an unknown id, another client's id or an unknown path; one body for every 404.

  • Name
    CURRENCY_NOT_SUPPORTED
    Type
    422
    Description

    A launch is refused before any session is written or any provider is called. CURRENCY_NOT_SUPPORTED is sent when the provider or the client cannot serve the currency. DEMO_NOT_SUPPORTED is sent when the game has no demo mode. COUNTRY_RESTRICTED is sent when the request's country is one the sportsbook may not serve.

  • Name
    DEMO_NOT_SUPPORTED
    Type
    422
    Description

    A launch is refused before any session is written or any provider is called. CURRENCY_NOT_SUPPORTED is sent when the provider or the client cannot serve the currency. DEMO_NOT_SUPPORTED is sent when the game has no demo mode. COUNTRY_RESTRICTED is sent when the request's country is one the sportsbook may not serve.

  • Name
    COUNTRY_RESTRICTED
    Type
    422
    Description

    A launch is refused before any session is written or any provider is called. CURRENCY_NOT_SUPPORTED is sent when the provider or the client cannot serve the currency. DEMO_NOT_SUPPORTED is sent when the game has no demo mode. COUNTRY_RESTRICTED is sent when the request's country is one the sportsbook may not serve.

  • Name
    INTERNAL_ERROR
    Type
    502
    Description

    INTERNAL_ERROR: the provider failed to answer.

Response

{
  "session_id": "0199c5a0-0000-7000-8000-000000000001",
  "game_url": "https://games.example.com/launch/0199c5a0",
  "expires_at": "2026-10-20T12:00:00Z"
}

Was this page helpful?