Slot Engine is in Beta - Stable, but may contain minor bugs
Slot EngineSlot Engine

Engine RGS

The Engine RGS endpoints that EngineLgs serves.


EngineLgs mimics the Engine RGS. It serves the wallet and bet endpoints with the request and response shapes of the wallet API, so a front end built for Engine plays against it without code changes. Only the protocol differs: the LGS serves plain HTTP.

Money format

Every amount over HTTP is an integer with six decimals. 1000000 is 1.00 of the session's currency. amount in a play request is the base bet. The LGS debits amount × costMultiplier of the mode from the wallet.

Endpoints

Every endpoint except the replay endpoint takes a POST with a JSON body and answers with JSON. A body that is not valid JSON, or that misses a field, answers with status 400 and the plain text Bad Request.

POST /wallet/authenticate

Marks the session as authenticated. Every other endpoint requires this call first.

Request
{ "sessionID": "wYv1...", "language": "en" }

language is optional. When set and not empty, the LGS stores it on the session.

Response
{
  "balance": { "amount": 10000000000, "currency": "USD" },
  "config": {
    "minBet": 100000,
    "maxBet": 1000000000,
    "stepBet": 10000,
    "defaultBetLevel": 1000000,
    "betLevels": [100000, 200000, 400000, "..."],
    "gameModes": [
      { "mode": "base", "costMultiplier": 1, "maxBet": 1000000000 },
      { "mode": "bonus", "costMultiplier": 70, "maxBet": 14280000 }
    ],
    "user": { "id": "Qf8c..." },
    "jurisdiction": {
      "socialCasino": false,
      "disabledFullscreen": false,
      "...": false,
      "minimumRoundDuration": 0
    }
  },
  "round": null
}
FieldDescription
balanceWallet balance and currency.
config.minBetbets.min of the configuration.
config.maxBetbets.max.
config.stepBetbets.step.
config.defaultBetLevelbets.default.
config.betLevelsbets.levels.
config.gameModesOne entry per game mode with its cost multiplier and the maximum base bet of that mode.
config.user.idThe wallet ID.
config.jurisdictionThe jurisdiction flags. socialCasino is true for social sessions.
roundThe open round, or null. A front end uses it to resume a round after a reload.

POST /wallet/balance

Request
{ "sessionID": "wYv1..." }
Response
{ "balance": { "amount": 10000000000, "currency": "USD" } }

POST /wallet/play

Places a bet, draws an outcome from the game's math and opens a round.

Request
{ "sessionID": "wYv1...", "mode": "base", "amount": 1000000 }

The LGS checks, in this order: the session is authenticated, the mode exists, no round is open, the amount follows the bet rules, and the cost is within the balance. Then it draws a book, debits the cost and creates the round.

Response
{
  "balance": { "amount": 9999000000, "currency": "USD" },
  "round": {
    "betID": 1,
    "amount": 1000000,
    "payout": 1200000,
    "payoutMultiplier": 1.2,
    "active": true,
    "mode": "base",
    "state": [{ "index": 0, "type": "reveal", "...": "..." }]
  }
}
FieldDescription
round.betIDID of the bet. The storage assigns it. InMemoryStorage counts from 1.
round.amountThe base bet.
round.payoutamount × payoutMultiplier, rounded to an integer. Credited on end-round.
round.payoutMultiplierPayout of the drawn book as a plain multiplier. 1.2 is 1.2x.
round.activetrue while the round waits for end-round.
round.modeThe requested mode.
round.stateThe events of the drawn book, exactly as the simulation wrote them.
round.eventThe last event recorded through /bet/event. Only present after an event was recorded.

A round with a payout of 0 is closed as soon as it is created. Its active is false and it needs no end-round. A round with a payout above 0 stays open until end-round.

POST /wallet/end-round

Credits the payout of the open round to the wallet and closes the round.

Request
{ "sessionID": "wYv1..." }
Response
{ "balance": { "amount": 10000200000, "currency": "USD" } }

POST /bet/event

Records a client-side progress marker on the open round. The event must be 1 to 32 bytes of UTF-8.

Request
{ "sessionID": "wYv1...", "event": "reveal-done" }
Response
{ "event": "reveal-done" }

The next authenticate returns the event in round.event, so a front end can continue a round where it left off.

GET /bet/replay/{game}/{version}/{mode}/{event}

Returns one book for bet replay. The endpoint needs no session and no authentication. A front end in replay mode calls it with the values of its replay launch parameters.

Request
curl http://localhost:7771/bet/replay/my-game/1/bonus/812
SegmentDescription
gameID of a registered game.
versionMath version of the game. The LGS has no math versions. It accepts any value and ignores it.
modeName of a mode of the game.
eventBook ID, an integer of 0 or more.
Response
{
  "payoutMultiplier": 8,
  "costMultiplier": 70,
  "state": [{ "index": 0, "type": "reveal", "...": "..." }]
}
FieldDescription
payoutMultiplierPayout of the book from the lookup table, as a plain multiplier. 8 is 8x.
costMultiplierCost multiplier of the mode.
stateThe events of the book. A play of the same book returns the same value as round.state.

An unknown game, an unknown mode or an unknown book answers with status 404 and an empty body, without JSON. An event that is not an integer of 0 or more also answers with 404. A mode without a lookup table answers with status 500 and ERR_GEN, like a play.

Round lifecycle

  1. /wallet/authenticate opens the session. When round is not null, continue that round.
  2. /wallet/play debits the bet and returns the outcome.
  3. /bet/event records progress while the client plays the outcome. Optional, repeatable.
  4. /wallet/end-round credits the payout. Skip it when round.active is false.

A replay needs no session. A front end in replay mode calls only the replay endpoint.

Bet rules

A play request passes when the amount:

  • is at least bets.min and at most bets.max,
  • is a multiple of bets.step,
  • is at most the maximum of the mode.

The maximum of a mode is the largest multiple of bets.step whose cost stays within bets.max. With the default limits, a bonus mode with a cost multiplier of 70 allows base bets up to 14.28, reported as maxBet: 14280000 in config.gameModes.

A valid amount still fails with ERR_IPB when amount × costMultiplier is above the wallet balance.

Errors

A failed request answers with { "error": "<code>", "message": "<reason>: <detail>" }.

CodeStatusWhen
ERR_VAL400Unknown session, session not authenticated, unknown mode, invalid amount, a round is open, no round is open, invalid event, unknown forced book.
ERR_IPB400The cost of the bet is above the balance.
ERR_GEN500The game is not registered, the lookup table or the book is missing, or an unexpected error.
{ "error": "ERR_VAL", "message": "a round is already active: Round 3 is still active" }

A missing lookup table or book means the game was not simulated. Run the simulation, then play again.

Differences from the Engine RGS

  • Sessions come from POST /lgs/sessions, not from Engine.
  • The LGS serves plain HTTP. Set protocol: "http" on the official client.
  • Sessions do not expire, and there are no rate limits.
  • The replay endpoint ignores the version segment and serves the books of the last simulation.
  • config.user.id is the wallet ID.
  • Wallets, sessions and rounds live only as long as the storage. InMemoryStorage forgets them when the process exits.

Use of AI on this page: Some texts were improved with or written by AI.

On this page