Skip to Content
Launch & close

Launch & close

You bring a player in with a launch and end the player session with a close. Both are JSON POSTs to your base URL, signed.

Launch

POST /markets/start

FieldRequiredRule
secureLoginyesyour operator code
externalPlayerIdyesyour player’s id, at most 255 characters; the first launch of an id creates the player
currencynoone of your operator currencies (see below)
languagenoat most 255 characters, upper-cased; EN when absent
lobbyUrl, cashierUrlnoabsolute http(s) addresses, at most 255 characters
marketIdnothe slug of the market to open first; a landing hint, not checked
playModenoREAL (default) or DEMO, exactly; a label only, the wallet calls are the same
themenothe player app’s look as text (a preset name such as hera-dark, or theme JSON); without it the launch uses your default theme set in the backoffice, else the standard hera-light
hashyesthe signature
POST /markets/start Content-Type: application/json { "secureLogin": "demo-operator", "externalPlayerId": "player-1001", "currency": "TRY", "language": "TR", "lobbyUrl": "https://operator.example/lobby", "cashierUrl": "https://operator.example/cashier", "marketId": "btc-above-100k-2026-12-31", "playMode": "REAL", "theme": "hera-dark", "hash": "eb7e53a6861c66db89be02682331ef1a" }
HTTP/1.1 201 Content-Type: application/json { "token": "5f2b9c0e7a1d4b3f8e6c2a9d0b7f4e1c", "sessionId": "d4c3b2a1-6f5e-4d7c-8b9a-0e1f2a3b4c5d", "marketURL": "https://play.example/?token=5f2b9c0e7a1d4b3f8e6c2a9d0b7f4e1c&lang=TR&cur=TRY&marketId=btc-above-100k-2026-12-31&theme=hera-dark" }

The answer is 201:

  • token: the launch token, 32 hex characters. /authenticate and /bet carry it, and a close takes it.
  • sessionId: the player session’s id.
  • marketURL: the player app, ready to open for the player.

Currency. Without currency, the session takes the player’s previous session’s currency while it is still one of yours, else your only currency, else the launch is refused with 21.

Relaunch. A launch with the same currency and playMode as the player’s open session continues it: same token, same sessionId, its language and links updated. Any other launch ends it (we send /session/expired) and opens a new one. A session ends after 30 minutes unused and 12 hours after it opened.

Changed in v1.1: marketId takes the market slug. A currency that is not one of your operator currencies is refused with 21; v1.0 took any currency the platform supported. A field v1.0 could not store is refused with 7 instead of v1.0’s 500, and so is a lobbyUrl or cashierUrl that is not an absolute http(s) address, which v1.0 did not check. See Changes from v1.0.

Refusals

Nothing is created on a refusal. A launch is checked in this order and refused at the first rule it breaks. The first eight rows apply to the close too, in the same order.

HTTPerrordescriptionWhen
403——your address is not on the environment’s allowlist; the body is error.code FORBIDDEN (Errors)
4001Missing secureLogin or hashsecureLogin or hash is missing or empty
4031Unknown or inactive operatorno operator has that code
4031Operator is pausedyour operator is suspended (checked before the signature)
4031Operator is archivedyour operator is archived (checked before the signature)
4031Unknown or inactive operatoryour operator has no live secret key
4011Invalid signaturethe hash does not match
4031IP not allowedyour address is not on your operator’s allowlist
4007Invalid parameters: <field>externalPlayerId, language or playMode breaks its rule above, or currency or marketId is not text
4001invalid theme: <reason>the theme is not a valid theme
4007Invalid parameters: <field>lobbyUrl or cashierUrl breaks its rule above
40021Invalid currencythe currency is not one of yours, or none can be chosen
HTTP/1.1 400 Content-Type: application/json { "error": 21, "description": "Invalid currency" }

Close a session

POST /sessions/close takes secureLogin, token and hash, nothing else. We then send /session/expired for the session.

POST /sessions/close Content-Type: application/json { "secureLogin": "demo-operator", "token": "5f2b9c0e7a1d4b3f8e6c2a9d0b7f4e1c", "hash": "650433a4f0020aef7c38e7f7cf2de6d8" }
HTTP/1.1 201 Content-Type: application/json { "error": 0, "description": "OK" }

A token with no open session answers 22, also 201: an empty or unknown token, another operator’s, or a session already ended. A session whose time had already run out answers 22 too, and still gets its /session/expired.

HTTP/1.1 201 Content-Type: application/json { "error": 22, "description": "Session not found" }

A missing token, a token that is not text, or any other field is refused 400 with v1.0’s validation body, one message per extra field, then the token’s:

HTTP/1.1 400 Content-Type: application/json { "message": [ "property reason should not exist" ], "error": "Bad Request", "statusCode": 400 }