RGS Overview
This spec lists the API endpoints providers use to talk to Stake Engine. Those APIs cover placing bets, finishing bets, checking sessions, and reading player balances.
Overview
This page explains how a provider's frontend talks to Stake Engine endpoints. It covers the core API behavior plus the request and response shapes that go with it.
The API is the link between your game and the server. Each call asks the server to do something — for example, authenticate a session, play a round, or close a round. The APIs are listed here.
Stake Engine NPM Client
Talk to the RGS more easily with the Stake Engine client. The package includes helpers that cut down the work of calling the RGS.
Package details and usage notes live here.
API flows
Every flow starts with a call to the /wallet/authenticate API when the game first loads. That step authorizes the sessionID for /wallet/play, /wallet/balance, and /wallet/end-round. If the game never calls /wallet/authenticate, later API calls come back as a 400 ERR_IS error because the session is invalid.
The recommended way to use the Stake Engine RGS API is the Basic Flow. That flow opens a round and closes it after animations finish. It does so by calling /wallet/play and then /wallet/end-round once the round is over.
Basic flow
[Basic flow diagram placeholder]
In a basic flow you call /wallet/play and /wallet/end-round — the simplest way to use the API. For a longer round with several steps (for example a slot bonus), you may want to store how far the player has watched in case they drop off. On the next load, use the round.event value from the /wallet/authenticate response to resume animations from that point.
URL Structure
Games sit under a fixed URL pattern. Providers should use the parameters below to talk to the RGS for the player and to show the right game information.
https://{{.TeamName}}.cdn.stakeengine.org/{{.GameID}}/{{.GameVersion}}/index.html?sessionID={{.SessionID}}&lang={{.Lang}}&device={{.Device}}&rgs_url={{.RgsUrl}}Query Params in URL
| Field | Description |
|---|---|
| sessionID | A unique session ID for the player. Required on every request the game sends. |
| lang | The language used to present the game. |
| device | Set to 'mobile' or 'desktop'. |
| rgs_url | The URL used to authenticate, place bets, and finish rounds. Do not hardcode this URL — it can change at runtime. |