# REST & AsyncAPI reference

Complete REST API, seamless wallet callback, and WebSocket protocol reference compiled from the [OpenAPI 3.1](/api/openapi.yaml) and [AsyncAPI 3.1](/api/asyncapi.yaml) specifications.

- **OpenAPI version:** `3.1.0` (BetPlug API `v0.1.0`)
- **AsyncAPI version:** `3.1.0` (BetPlug live games and webhooks `v0.1.0`)
- **REST base URL:** `https://api.betrail.example` (example hostname)
- **Live WebSocket host:** `wss://live.betrail.example/v1/live/{game}`

## Shared HTTP errors & retry matrix

Every REST error returns RFC 9457 `application/problem+json` ([`Problem`](#problem)) with a unique `Betrail-Request-Id` header (`type`, `title`, `status`, `detail`, `instance`, `code` ([`ProblemCode`](#problemcode)), plus `max_stake` on `422 max_stake` and `elapsed_seconds`/`net_result` on `409 reality_check_due`).

```json
{
  "type": "https://betrail.example/problems/max_stake",
  "title": "Stake exceeds maximum allowed for this target",
  "status": 422,
  "detail": "Stake exceeds the brand max_profit cap.",
  "instance": "/v1/rounds",
  "code": "max_stake",
  "max_stake": "5.00000000"
}
```

| HTTP | `ProblemCode` values | Retryability |
|---|---|---|
| `400` | `invalid_request` | No — fix malformed JSON, headers, or schema |
| `401` | `unauthorized`, `session_expired` | Re-sign with fresh timestamp & nonce (or re-launch if `session_expired`) |
| `402` | `credits_exhausted`, `plan_inactive` | After topping up live USD credits or reactivating plan |
| `403` | `forbidden`, `origin_not_allowed`, `player_blocked`, `jurisdiction_not_allowed` | No — fix key scope, allowed origin, player status, or jurisdiction policy |
| `404` | `unknown_game`, `unknown_version`, `not_found` | No — verify resource ID and canonical `GameSlug` |
| `409` | `not_offered`, `odds_changed`, `closed`, `limit`, `pending`, `seed_not_revealed`, `idempotency_key_in_use`, `insufficient_funds`, `limit_exceeded`, `max_exposure`, `round_open`, `reality_check_due` | `idempotency_key_in_use`/`pending` only: retry same `Idempotency-Key` + fresh nonce; resolve state for others |
| `413` | `body_too_large` | No — keep request body <= 64 KB |
| `415` | `unsupported_encoding` | No — send uncompressed `identity` JSON |
| `422` | `invalid_input`, `invalid_action`, `stake_out_of_range`, `max_stake`, `unknown_profile`, `idempotency_key_reused` | No — fix parameters or mint a new `Idempotency-Key` |
| `429` | `rate_limited` | Yes — wait `Retry-After` seconds, reuse `Idempotency-Key`, fresh nonce |
| `500` | `no_acceptable_draw`, `internal` | Yes — retry same `Idempotency-Key` + body with fresh timestamp & nonce |
| `503` | `wallet_unavailable` | Only when `Retry-After` is present (bulkhead); without it the round voided |

For the complete per-game parameter, action, and RNG matrix across every mounted catalog game, see [Game catalog & live protocol](/docs/live-games-and-catalog) or the single-file [`/llms-full.txt`](/llms-full.txt) bundle.

## Public & operator REST operations

### `getHealthz` — `GET /healthz`

- **Summary:** Liveness probe
- **Tag:** `probes`
- **Authentication and signing:** public (`security: []`)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** `none`
- **Responses:**
  - `200` -> [`Liveness`](#liveness) (`application/json`) (headers: `Cache-Control`): The process is alive.

**Contract notes**

Answers 200 as soon as the process serves HTTP. It never checks a dependency. The public answer is `{"ok":true}` and nothing else; `/readyz` and `/metrics` live on the private ops listener.

**Response example (`200`)**

```json
{
  "ok": true
}
```

### `listRounds` — `GET /v1/rounds`

- **Summary:** List rounds
- **Tag:** `rounds`
- **Authentication and signing:** `apiKey` (`Bearer`) + `requestSignature` (`betrail-v1`)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** `none`
- **Parameters:** `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required), `cursor` (query), `limit` (query), `player_ref` (query), `game` (query)
- **Shared errors:** `400`, `401`, `403`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`RoundPage`](#roundpage) (`application/json`): A page of rounds.

**Contract notes**

The operator's rounds (instant/session rounds and revealed live show bets), newest first by id, optionally filtered to one player or game (including live show slugs `trapdoor`, `kombat-multiplayer`, `crash` and `meme-trade`) and cursor-paged deterministically across both.

**Response example (`200`)**

```json
{
  "data": [],
  "next_cursor": null
}
```

### `createRound` — `POST /v1/rounds`

- **Summary:** Open a round
- **Tag:** `rounds`
- **Authentication and signing:** `apiKey` (`Bearer`) + `requestSignature` (`betrail-v1`)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** [`RoundCreate`](#roundcreate)
- **Parameters:** `Idempotency-Key` (header, required), `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Shared errors:** `400`, `401`, `403`, `404`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `201` -> [`Round`](#round) (`application/json`): The round, settled (I and SL games) or open (S games).
  - `402` -> [`Problem`](#problem) (`application/problem+json`) (headers: `Betrail-Request-Id`): The operator cannot open live rounds: its credits are exhausted (`credits_exhausted`) or its plan has lapsed (`plan_inactive`). Open rounds still finish, and sandbox keeps working.

**Contract notes**

Opens a round in headless mode. The operator debits the stake and credits the payout itself from this answer. Instant and slot games settle immediately; session games answer `open` and continue via actions. Every refusal is decided before the draw, so a refusal consumes no randomness. The nonce is reserved from the player's seed pair, and a round that fails after its draw is `void` and keeps its nonce.

- **`404 unknown_game`** answers an unrecognized `game` slug before any offering gate is evaluated.
- **`409 not_offered`** refuses, before any claim or nonce reservation: a disabled brand or environment; a game or currency not offered on the brand; an active game kill switch; in `live`, a currency with no FX rate in force at the start of the current UTC hour (USD is always in force, and `sandbox` never checks FX rates); or a bet or configuration the engine does not offer. A STACKOPASS hand (`stack-o-pass`) is played at a live table through a player session and the seamless wallet (`createSessionRound`), so this call refuses it.
- **`403 jurisdiction_not_allowed`** refuses, before any claim or nonce reservation, a round whose optional operator-asserted `jurisdiction` is blocked by the brand environment's responsible-gaming settings (`sandbox` and `live`) or outside the operator's platform live allowlist (`live` only). This is an enforcement hook over operator-asserted and configured settings, not a legal compliance certification.
- **`429 rate_limited`** refuses, in addition to per-key and public rate limits, a `sandbox` (`btr_test_`) open that would pass the operator's daily UTC sandbox round or stake cap, with `Retry-After` set to the seconds remaining until the next UTC day, before any claim, seed or nonce is spent; an idempotent replay of an already-reserved round still replays, and `live` (`btr_live_`) rounds are never capped.

**Request example**

```json
{
  "game": "dice",
  "brand": "br_casino_main",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "stake": "0.00100000",
  "params": {
    "direction": "under",
    "chance": "47.98",
    "payout": "1.97999"
  }
}
```

**Response example (`201`)**

```json
{
  "id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA",
  "game": "dice",
  "version": 1,
  "brand": "br_casino_main",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "status": "settled",
  "step": 1,
  "stake": "0.00100000",
  "payout": "0.00197999",
  "refund": "0.00000000",
  "max_profit": "1.00000000",
  "cap_rule": "truncate",
  "cap_source": "brand",
  "view": {
    "roll": 3317,
    "win": true
  },
  "seed": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "ñandú-42",
    "nonce": 42
  },
  "created_at": "2026-10-29T01:45:00Z",
  "settled_at": "2026-10-29T01:45:00Z"
}
```

### `getRound` — `GET /v1/rounds/{id}`

- **Summary:** Read a round
- **Tag:** `rounds`
- **Authentication and signing:** `apiKey` (`Bearer`) + `requestSignature` (`betrail-v1`)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** `none`
- **Parameters:** `id` (path, required), `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Shared errors:** `401`, `403`, `404`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`Round`](#round) (`application/json`): The round.

**Contract notes**

One round of this operator. Another operator's round answers 404, never 403.

A live show bet (`bet_id` as `id`) is readable as soon as it settles, before its show reveals the link seed: a final settled bet carries its public settle view, snapshotted `max_profit` and public seed commitment with zero unrevealed `server_seed`, and a provisional mid-round `meme-trade` sidebet (`settled_in_play`, voidable on outage) reads as `status: open` with zero `payout`/`refund`, empty `view` and `settled_at: null` until finalized. Once its show reveals, this route serves the full revealed show record (`round.settled`'s `data`). In-flight unsettled (`placed`) and voided show bets answer 404 (in-flight bets are observed via `POST /v1/live/{game}/bets` and the live WebSocket snapshot).

**Response example (`200`)**

```json
{
  "id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA",
  "game": "dice",
  "version": 1,
  "brand": "br_casino_main",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "status": "settled",
  "step": 1,
  "stake": "0.00100000",
  "payout": "0.00197999",
  "refund": "0.00000000",
  "max_profit": "1.00000000",
  "cap_rule": "truncate",
  "cap_source": "brand",
  "view": {
    "roll": 3317,
    "win": true
  },
  "seed": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "ñandú-42",
    "nonce": 42
  },
  "created_at": "2026-10-29T01:45:00Z",
  "settled_at": "2026-10-29T01:45:00Z"
}
```

### `actRound` — `POST /v1/rounds/{id}/actions`

- **Summary:** Play one step of an open round
- **Tag:** `rounds`
- **Authentication and signing:** `apiKey` (`Bearer`) + `requestSignature` (`betrail-v1`)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** [`RoundAction`](#roundaction)
- **Parameters:** `id` (path, required), `Idempotency-Key` (header, required), `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Shared errors:** `400`, `401`, `403`, `404`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`Round`](#round) (`application/json`): The round after the step.

**Contract notes**

One step of a session game (the game engine step handler). `step` numbers the step this action makes, the round's `step` plus one: a repeat of an applied step finds the round already there and is refused (`409 closed`), so one click never applies twice even without its `Idempotency-Key`. A `409 closed` on a round that is still open means the step was already taken: read the round for its current `step` before acting again. The answer says whether the step added stake (a double): the operator takes that increase.

A force-close is not a step a player takes here: an action whose `do` is `force_close` is `422 invalid_action` in every game, nothing is drawn, and the round stays as it was (`RoundAction`). Close a player's rounds with `POST /v1/players/{player_ref}/force-close`.

**Request example**

```json
{
  "action": {
    "do": "cashout"
  },
  "step": 3
}
```

**Response example (`200`)**

```json
{
  "id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA",
  "game": "mines",
  "version": 1,
  "brand": "br_casino_main",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "status": "settled",
  "step": 3,
  "stake": "0.00100000",
  "payout": "0.00107000",
  "refund": "0.00000000",
  "max_profit": "1.00000000",
  "cap_rule": "truncate",
  "cap_source": "brand",
  "view": {
    "status": "CASHED_OUT",
    "mines": 3,
    "sweeped_tiles": [
      0
    ],
    "mine_locations": [
      2,
      11,
      19
    ],
    "multiplier": "1.07",
    "win": true,
    "payout": "0.00107000",
    "profit": "0.00007000",
    "max_profit_hit": false,
    "floats_used": 24,
    "game_result": {
      "status": "CASHED_OUT",
      "sweeped_tiles": [
        0
      ],
      "mine_locations": [
        2,
        11,
        19
      ]
    }
  },
  "seed": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "seed-1",
    "nonce": 42
  },
  "created_at": "2026-10-28T17:00:00Z",
  "settled_at": "2026-10-28T17:00:04Z"
}
```

### `verifyRound` — `GET /v1/rounds/{id}/verify`

- **Summary:** Verify a round
- **Tag:** `rounds`
- **Authentication and signing:** `apiKey` (`Bearer`) + `requestSignature` (`betrail-v1`)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** `none`
- **Parameters:** `id` (path, required), `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Shared errors:** `401`, `403`, `404`, `409`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`Verification`](#verification) (`application/json`): The verification, with the record it replayed.

**Contract notes**

Replays the round's record through the engine's `Verify` once its server seed is revealed. A record that does not replay is an answer, `result: verify_mismatch`, never a problem. Before the reveal the answer is `409 seed_not_revealed`. The record's amounts are decimal strings at its own currency's scale.

**Response example (`200`)**

```json
{
  "result": "ok",
  "record": {
    "v": 1,
    "game": "DICE",
    "version": 1,
    "tables": [
      {
        "name": "paytable",
        "fingerprint": "7c145a94276eb256705c4c6d326824f70891fbc1120b33eea0433f432f702b4e"
      }
    ],
    "stream": {
      "kind": "dice-sha512",
      "server_seed_hash": "a8ae6e6ee929abea3afcfc5258c8ccd6f85273e0d4626d26c7279f3250f77c8e",
      "server_seed": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
      "client_seed": "ñandú-42",
      "nonce": 42
    },
    "input": {
      "profile": "source",
      "currency": {
        "code": "BTC",
        "scale": 8
      },
      "stake": "0.00100000",
      "limits": {
        "min_stake": "0.00000001",
        "max_stake": "0.10000000",
        "max_profit": "1.00000000"
      },
      "params": {
        "direction": "under",
        "chance": "49.50"
      }
    },
    "steps": [
      {
        "outcome": {
          "status": "settled",
          "stake": "0.00100000",
          "payout": "0.00191919",
          "refund": "0.00000000",
          "exposure": "0.00191919",
          "trace": {
            "from": 0,
            "to": 1
          },
          "view": {
            "direction": "under",
            "chance": "49.50",
            "multiplier": "1.91919",
            "roll": 2396,
            "lucky": 762396,
            "windows": 1,
            "win": true,
            "payout": "0.00191919",
            "profit": "0.00091919",
            "capped": false,
            "game_result": {
              "type": 1,
              "payout": "1.91919"
            }
          }
        }
      }
    ]
  }
}
```

### `getSeeds` — `GET /v1/players/{player_ref}/seeds/{game}`

- **Summary:** Read a player's seeds
- **Tag:** `seeds`
- **Authentication and signing:** `apiKey` (`Bearer`) + `requestSignature` (`betrail-v1`)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** `none`
- **Parameters:** `player_ref` (path, required), `game` (path, required), `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Shared errors:** `401`, `403`, `404`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`SeedState`](#seedstate) (`application/json`): The seed state.

**Contract notes**

The player's seed pair for one game: the current server seed's commitment, client seed and next nonce, the next pair's commitment, and the previous pair revealed. A server seed is never shown before its rotation.

**Response example (`200`)**

```json
{
  "current": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "ñandú-42",
    "nonces_used": 43
  },
  "next": {
    "server_seed_hash": "5c4b3a29180716f5e4d3c2b1a09f8e7d6c5b4a3928170615f4e3d2c1b0a99887",
    "client_seed": "🎲 lucky",
    "nonces_used": 0
  },
  "previous": null
}
```

### `rotateSeeds` — `POST /v1/players/{player_ref}/seeds/{game}/rotate`

- **Summary:** Rotate a player's seeds
- **Tag:** `seeds`
- **Authentication and signing:** `apiKey` (`Bearer`) + `requestSignature` (`betrail-v1`)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** `none`
- **Parameters:** `player_ref` (path, required), `game` (path, required), `Idempotency-Key` (header, required), `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Shared errors:** `401`, `403`, `404`, `409`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`SeedState`](#seedstate) (`application/json`): The seed state after the rotation, with the previous pair revealed.

**Contract notes**

Reveals the current server seed, makes the committed next pair current (with the next client seed), and commits a new next pair; the nonce restarts at 0.

It is refused with `409 round_open` while **any round on the current pair is unfinished**: `reserved` (its nonce reserved, nothing drawn yet), `debiting` (a seamless round whose outcome is drawn but hidden until its debit is confirmed), open, or, in a live game, an unresolved placement. Revealing the seed would reveal that round's outcome, or let a `reserved` round draw on a public seed, and a player who sees a loss before the debit could make it fail.

One transaction locks the seed row that the nonce reservation updates (`SELECT … FOR UPDATE`), checks the pair for unfinished rounds, reveals the seed, promotes the next pair and commits a new one. A concurrent open has therefore either committed its reservation before the rotation, and its `reserved` round refuses the rotation, or it reserves its nonce on the new pair.

**Response example (`200`)**

```json
{
  "current": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "ñandú-42",
    "nonces_used": 43
  },
  "next": {
    "server_seed_hash": "5c4b3a29180716f5e4d3c2b1a09f8e7d6c5b4a3928170615f4e3d2c1b0a99887",
    "client_seed": "🎲 lucky",
    "nonces_used": 0
  },
  "previous": null
}
```

### `setPlayerStatus` — `PUT /v1/players/{player_ref}/status`

- **Summary:** Set a player's status
- **Tag:** `players`
- **Authentication and signing:** `apiKey` (`Bearer`) + `requestSignature` (`betrail-v1`)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** [`PlayerStatusSet`](#playerstatusset)
- **Parameters:** `player_ref` (path, required), `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Shared errors:** `400`, `401`, `403`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`PlayerStatus`](#playerstatus) (`application/json`): The player's status after the call.

**Contract notes**

Sets the player's status. A player who is not `active` cannot open a round, mint a live join ticket, place a live bet or buy in on MEME_TRADE (`403 player_blocked`), while settled rounds still pay out through the outbox. When `status` is `self_excluded` or `blocked` (repeat calls included), BetPlug also revokes the player's active live sessions for `(operator, environment, player_ref)` immediately, closing open live sockets (`1008`) and refusing further socket commands or re-wagering of a MEME_TRADE round balance; if session revocation cannot be persisted, the call fails closed with `500 internal` so the operator retries. To end a self-excluded player's force-closeable open rounds at once, follow this call with force-close.

**Request example**

```json
{
  "status": "self_excluded"
}
```

**Response example (`200`)**

```json
{
  "player_ref": "p_8f3a2c",
  "status": "self_excluded",
  "updated_at": "2026-10-29T01:45:00Z"
}
```

### `forceClosePlayer` — `POST /v1/players/{player_ref}/force-close`

- **Summary:** Force-close a player's open rounds
- **Tag:** `players`
- **Authentication and signing:** `apiKey` (`Bearer`) + `requestSignature` (`betrail-v1`)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** [`ForceCloseRequest`](#forcecloserequest)
- **Parameters:** `player_ref` (path, required), `Idempotency-Key` (header, required), `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Shared errors:** `400`, `401`, `403`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`ForceCloseResult`](#forcecloseresult) (`application/json`): The rounds this call settled; an empty list when the player had none open.

**Contract notes**

Settles every open round of the player, or of one game, with platform force-close. It sends each game's force-close action, which a player cannot send on the actions routes (`RoundAction`). Each round settles under its game's rule, which reads only the player's view and draws nothing hidden. The answer lists the rounds this call settled, and `round.settled` goes out for each.

- **A live show bet is not a platform force-close round.** `live` sends its game's force-close command to the show's writer (TRAPDOOR's `bank` with `DISCONNECT`, CRASH's `force_close`), one bet at a time, and the show runs on for everyone else. This call reaches them for live shows. Neither KOMBATMP nor MEME_TRADE v2 has a force-close: a KOMBATMP bet has no in-round action and settles with its round within about a minute, and under the MEME_TRADE settlement rules an in-flight MEME_TRADE position, sidebet or round balance rides to its armed `auto_sell`, liquidation or rug on the 250 ms server clock while `setPlayerStatus` revokes live sessions at once, so this call leaves both open and lists them nowhere.
- **A STACKOPASS hand is a platform force-close round**: this call settles it as any round, a cash-out at `⌊100 S⌋ / 100` or a full refund before its first pack, and its table shows the seat closed and tells the player's sockets (`settled_by: force_close`).
- **A round with money in flight is left alone.** A round still `reserved` or `debiting`, or one with a debit attempt unresolved (`409 pending` for its next step), is not settled here, because its outcome depends on what the sweep decides. The answer's `pending` counts them: call again with a new `Idempotency-Key` once the sweep has resolved them, within about 2 minutes.
- **The time is the operator's choice, so it sees only public state**. No hidden draw reaches the operator before its reveal, so no force-close can be timed against the player.
- In seamless mode each settled round's credit goes out through the outbox. In headless mode the operator pays the payouts listed.

**Request example**

```json
{
  "game": "dice"
}
```

**Response example (`200`)**

```json
{
  "rounds": [],
  "pending": 0
}
```

### `createLaunch` — `POST /v1/launch`

- **Summary:** Launch a game for a player
- **Tag:** `launch`
- **Authentication and signing:** `apiKey` (`Bearer`) + `requestSignature` (`betrail-v1`)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** [`LaunchCreate`](#launchcreate)
- **Parameters:** `Idempotency-Key` (header, required), `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Shared errors:** `400`, `401`, `403`, `404`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `201` -> [`Launch`](#launch) (`application/json`) (headers: `Cache-Control`): The launch token and the play URL.
  - `402` -> [`Problem`](#problem) (`application/problem+json`) (headers: `Betrail-Request-Id`): The operator cannot open live rounds: its credits are exhausted (`credits_exhausted`) or its plan has lapsed (`plan_inactive`). Open rounds still finish, and sandbox keeps working.

**Contract notes**

Starts seamless play. The operator's backend gets a **launch token**: 32 random bytes, single-use, valid for 60 s, consumed in Postgres. It also gets the play URL for the iframe host; the Web Component takes the token as an attribute instead. The client exchanges the token once for a session token (`POST /v1/sessions`), and its own calls are the `session` operations.

- **The token in the URL**: the play page answers with `Referrer-Policy: no-referrer`, removes the token from the address bar with `history.replaceState` before anything else loads, and BetPlug's access logs drop the query string.
- **The token is never replayed.** Only its hash is stored, in the launch row and in the idempotency claim. A repeat of the `Idempotency-Key` mints a **fresh** token for the same launch and invalidates the previous one. It never returns the stored answer's token.
- `return_url` must be on one of the brand's configured origins, or the launch is refused (`400 invalid_request`).
- A `real` launch for a player whose status is not `active` is refused (`403 player_blocked`). A `demo` launch is never refused for `credits_exhausted` or `plan_inactive`, since it touches no wallet and is never billed.
- **`403 jurisdiction_not_allowed`** refuses a `real` launch (its idempotent repeat) when the optional operator-asserted `jurisdiction` is blocked by the brand environment's responsible-gaming settings (`sandbox` and `live`) or outside the operator's platform live allowlist (`live` only). The session keeps the launch's jurisdiction and re-checks it on every subsequent exchange, round open, live bet and MEME_TRADE buy-in.
- **`409 not_offered`** refuses, before any launch row or token is written: a disabled brand or environment; a game or currency not offered on the brand; an active game kill switch; for `mode: real` in `live`, a currency with no FX rate in force at the start of the current UTC hour (USD is always in force, and `sandbox` and `demo` never check FX rates); or, for a live show or live table game (`LiveGameSlug` including `stack-o-pass`), `mode: demo` (live games have no demo play) or a show not running in that environment.
- **`404 unknown_game`** answers an unrecognized `game` slug before any offering gate is evaluated.

**Request example**

```json
{
  "game": "dice",
  "brand": "br_casino_main",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "mode": "real",
  "locale": "es-AR"
}
```

**Response example (`201`)**

```json
{
  "token": "EXAMPLE_launch_token_0000000000000000000000",
  "url": "https://play.betrail.example/dice?token=EXAMPLE_launch_token_0000000000000000000000",
  "expires_at": "2026-10-29T01:46:00Z",
  "reality_check": {
    "interval_seconds": 1800,
    "due_at": "2026-10-29T02:15:00Z"
  }
}
```

### `createSession` — `POST /v1/sessions`

- **Summary:** Exchange a launch token for a session token
- **Tag:** `launch`
- **Authentication and signing:** public (launch-token)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** [`SessionCreate`](#sessioncreate)
- **Parameters:** `Idempotency-Key` (header, required)
- **Shared errors:** `400`, `401`, `403`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `201` -> [`Session`](#session) (`application/json`) (headers: `Cache-Control`): The session.

**Contract notes**

The embedded client's first call. The launch token in the body is the credential, so the call carries no credential header (`security: []`, enforced to this path).

- **One exchange per launch token.** The token is consumed in Postgres under a unique constraint. A second exchange, an expired token or an unknown one gets `401 unauthorized`, with the same body for all three.
- **The session token is never replayed.** Only its hash is stored. A repeat of the `Idempotency-Key` with the same launch token, within that token's 60 s, mints a fresh session token for the same session and invalidates the previous one, as a launch's repeat does, so a client whose answer was lost is not locked out. After the 60 s a repeat is `401`, like any other exchange.
- **The key must be random.** For those 60 s it is what stops a stranger who saw the launch token from minting a fresh session, so the client generates it with `crypto.getRandomValues` and never derives it from the token.
- **Nothing is written for a bad token.** The key is scoped to the launch token and is claimed only once the token has been found, so an unauthenticated caller cannot grow the claims table.
- **Origins are a browser control**, as `sessionToken` says. An `Origin` outside the brand's allowed set is `403 origin_not_allowed`, and that refusal does not consume the token. A call with no `Origin` is allowed: the launch token alone binds it.
- **A live real launch asks the live gate again.** Once live play is no longer enabled for the operator, the exchange of a live real launch token, and its repeat, are `403 forbidden` ("Live play is not enabled for this operator.") and do not consume the token, as a repeat of the launch is. Likewise, if the launch's operator-asserted `jurisdiction` is now blocked by the brand environment's settings (`sandbox` or `live`) or outside the operator's live allowlist (`live`), the exchange and its repeat answer `403 jurisdiction_not_allowed` without consuming the token.

**Request example**

```json
{
  "launch_token": "EXAMPLE_launch_token_0000000000000000000000"
}
```

**Response example (`201`)**

```json
{
  "session_token": "bts_<token>",
  "expires_at": "2026-10-29T09:45:10Z",
  "idle_timeout_seconds": 900,
  "game": "dice",
  "currency": "BTC",
  "mode": "real",
  "reality_check": {
    "interval_seconds": 1800,
    "due_at": "2026-10-29T02:15:00Z"
  }
}
```

### `createDemoSession` — `POST /v1/demo/sessions`

- **Summary:** Start a demo session
- **Tag:** `launch`
- **Authentication and signing:** public (demo)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** [`DemoSessionCreate`](#demosessioncreate)
- **Parameters:** `Idempotency-Key` (header, required)
- **Shared errors:** `400`, `403`, `404`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `201` -> [`Session`](#session) (`application/json`) (headers: `Cache-Control`): The demo session.

**Contract notes**

Demo mode: the real engines, on an ephemeral seed pair, with fun money (`FUN`) from a fixed balance. It needs no key (`security: []`, enforced to this path). Its rounds never touch a wallet, the rounds table or the ledger, are never billed, and have no record or proof that anything but their own session can read.

- **Only BetPlug's own sites** may call it: an absent `Origin`, or one that is not ours, is `403 origin_not_allowed`. Per-IP and global caps bound sessions and rounds (`429 rate_limited`). CORS does not bind a server-to-server caller, so the caps and the missing proofs are what stop an operator from settling real money on demo outcomes.
- **The token works on the session calls, and nothing else sees its rounds.** `GET /v1/rounds/{id}` answers `404` for a demo round. In a keyless demo round `brand` and `player_ref` are both `demo`, and `currency` is `FUN`. `POST /v1/session/seeds/rotate` is how the session sees its ephemeral seed revealed, since a session that has ended can be told nothing.
- **No row for a keyless caller.** The session, its rounds and its `Idempotency-Key`s live in Valkey for an hour, never in Postgres, so this call cannot grow a table. A repeat of the key from the same address mints a fresh token for the same demo session, which the caps count once.
- **All single-player games supported.** All 36 instant, slot, and session games play with fun money (`FUN`) and never check FX rates. Live shows and live table games (`stack-o-pass`) answer `409 not_offered` (live games have no demo play); an unrecognized game slug answers `404 unknown_game`.

**Request example**

```json
{
  "game": "dice",
  "locale": "en"
}
```

**Response example (`201`)**

```json
{
  "session_token": "bts_<token>",
  "expires_at": "2026-10-29T09:45:10Z",
  "idle_timeout_seconds": 900,
  "game": "dice",
  "currency": "BTC",
  "mode": "real",
  "reality_check": {
    "interval_seconds": 1800,
    "due_at": "2026-10-29T02:15:00Z"
  }
}
```

### `listSessionRounds` — `GET /v1/session/rounds`

- **Summary:** List the session player's rounds
- **Tag:** `session`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** `none`
- **Parameters:** `cursor` (query), `limit` (query)
- **Shared errors:** `400`, `401`, `403`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`RoundPage`](#roundpage) (`application/json`): A page of the session player's rounds.

**Contract notes**

The session player's rounds in the session's game (including revealed live show bets in a live show session), newest first, for the client's history panel: the same page as `GET /v1/rounds`, with no filter to name. It sees no other player, brand or game.

**Response example (`200`)**

```json
{
  "data": [],
  "next_cursor": null
}
```

### `createSessionRound` — `POST /v1/session/rounds`

- **Summary:** Open a round in the session
- **Tag:** `session`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** [`SessionRoundCreate`](#sessionroundcreate)
- **Parameters:** `Idempotency-Key` (header, required)
- **Shared errors:** `400`, `401`, `403`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `201` -> [`Round`](#round) (`application/json`): The round, settled for an instant game.
  - `402` -> [`Problem`](#problem) (`application/problem+json`) (headers: `Betrail-Request-Id`): The operator cannot open live rounds: its credits are exhausted (`credits_exhausted`) or its plan has lapsed (`plan_inactive`). Open rounds still finish, and sandbox keeps working.
  - `503` -> [`Problem`](#problem) (`application/problem+json`) (headers: `Betrail-Request-Id`, `Retry-After`): The operator's wallet did not answer in time (`wallet_unavailable`). One of three cases: the debit's result is unknown, so the round is voided, the debit rolled back and nothing revealed (a repeat of the `Idempotency-Key` gets this answer again); the operator's in-flight wallet calls are at the bulkhead, so nothing was written and `Retry-After` says when to try again; a balance read got no answer, or one that is not bound, so nothing was written.

**Contract notes**

`POST /v1/rounds` for the embedded client in seamless mode. The session supplies the brand, player, game and currency. In a `real` session BetPlug debits the operator's wallet before revealing the outcome. A refused debit answers with the wallet's code (`409 insufficient_funds`, `409 limit_exceeded`, `403 player_blocked`, `400 invalid_request`), and an unknown failure answers `503 wallet_unavailable` with the round voided. A `demo` session plays from its fun balance and calls no wallet.

- **`409 not_offered`** applies the same pre-draw offering gates as `POST /v1/rounds`, before any claim, debit or nonce reservation: a disabled brand or environment; a game or currency not offered on the brand; an active game kill switch; in a `real` `live` session, a currency with no FX rate in force at the start of the current UTC hour (USD is always in force, and `sandbox` and `demo` never check FX rates); or a bet or configuration the engine does not offer.
- **`404 unknown_game`** answers an unrecognized game slug before any offering gate is evaluated.
- **`403 jurisdiction_not_allowed`** refuses a `real` session round before any claim, wallet debit or nonce reservation when the session's operator-asserted `jurisdiction` is blocked by the brand environment's responsible-gaming settings (`sandbox` and `live`) or outside the operator's live allowlist (`live`), including when an allowlist narrowing or new brand block takes effect mid-session; open rounds continue to settle.
- **`409 reality_check_due`** refuses a `real` session round before any claim, wallet debit or nonce reservation once the session reaches or passes its snapshotted `reality_check.due_at` (`now >= due_at`), carrying `elapsed_seconds` and `net_result` from this session's settled rounds. Acknowledge with `POST /v1/sessions/current/reality-check` to advance `due_at` by one interval and resume play. Demo sessions and sessions launched while reality checks are off are unaffected.
- **`429 rate_limited`** refuses, in addition to rate limits, a `real` `sandbox` session round that would pass the operator's daily UTC sandbox round or stake cap (7), with `Retry-After` set to the seconds remaining until the next UTC day, before any claim, wallet debit or nonce is spent; `live` and `demo` sessions are unaffected (`demo` uses its own session limits).
- **STACKOPASS's buy-in** (`stack-o-pass`): a hand at a live table is a session round on the player's own seed pair, so its buy-in is this call, never a live bet. The body names the seat, `live_seat` (`LiveTableSeat`), and `params` is `StackOPassParams`. The steps run in this order, and a repeat of the key never takes or loses a seat: 1. **The key.** A repeat of a claimed `Idempotency-Key` replays its stored answer (the `201`, a refusal stored in step 4, or the `409 closed` of step 5) and asks `live` nothing; while the first request still runs it is `409 idempotency_key_in_use`. A repeat whose round is open but not seated (the first request stopped after its debit) asks `live` to seat that round again, which answers as step 5 does. 2. **The checks** of any session round (the offering gates, the player's status, credits, limits and `max_exposure`'s early read), and the body's: `live_seat` on another game, or none on STACKOPASS, is `400 invalid_request`; a `demo` session is `403 forbidden` (demo play has no seat at a live table). 3. **The seat hold.** `live` holds the seat for this key, at most 30 s. It looks the table up among the player's operator's tables first (5), so another operator's table is `409 closed`, with the same `detail` as a gone table, before any other check; then `409 closed` (no writer answers), `409 idempotency_key_in_use` (this key already holds the seat: the first request still runs), `409 not_offered` (another player's seat), `409 limit` (a seat at another table, or an open hand), `409 pending` (this player's buy-in for the seat under another key still in flight), `409 odds_changed` (`params.risk` is not the table's). These move nothing, a refused repeat releases no hold, and a repeat decides them again. 4. **The round**, as any session round: the engine's refusals before the claim (`422 invalid_input`, `422 stake_out_of_range`, `422 max_stake` with `max_stake`), decided again on a repeat; then the claim, the nonce and the exposure in one transaction (`409 max_exposure` writes none of them); then the debit, whose refusal (the wallet's codes) or unknown answer (`503 wallet_unavailable`, the round voided) is the key's stored answer; then `Open`. Every refusal releases this request's hold. 5. **The seat.** `live` seats the open round in the seat this key holds (idempotent by round id), and the answer is `201`, its `view` the engine's open view (`hand`, with `blocks` for all three risks as its record keeps them; the socket shows the table's alone). If the hold is gone (it ran out, `live` failed over), the platform force-closes the round at once, a full refund (`kind: refund`), and `409 closed` is the key's stored answer. A round no table holds 60 s after it opened, whatever stopped (this call, its seat call, `api` itself), is force-closed by the live server's sweep within 10 s more, a full refund (`settled_by: force_close`), and a repeat of its key answers `409 closed`. The hand's moves then go over the socket (`asyncapi.yaml`, `StackOPassCommand`).

**Request example**

```json
{
  "stake": "0.00100000",
  "params": {
    "direction": "under",
    "chance": "47.98"
  }
}
```

**Response example (`201`)**

```json
{
  "id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA",
  "game": "dice",
  "version": 1,
  "brand": "br_casino_main",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "status": "settled",
  "step": 1,
  "stake": "0.00100000",
  "payout": "0.00197999",
  "refund": "0.00000000",
  "max_profit": "1.00000000",
  "cap_rule": "truncate",
  "cap_source": "brand",
  "view": {
    "roll": 3317,
    "win": true
  },
  "seed": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "ñandú-42",
    "nonce": 42
  },
  "created_at": "2026-10-29T01:45:00Z",
  "settled_at": "2026-10-29T01:45:00Z"
}
```

### `getSessionRound` — `GET /v1/session/rounds/{id}`

- **Summary:** Read a round of the session's player
- **Tag:** `session`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** `none`
- **Parameters:** `id` (path, required)
- **Shared errors:** `400`, `401`, `403`, `404`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`Round`](#round) (`application/json`): The session player's round.

**Contract notes**

A round of the session's player in the session's game, as `GET /v1/rounds/{id}` shows it, including a settled live show bet read by its `rnd_` id before or after its show reveals its seed (provisional in-play `meme-trade` sidebets read as `open` with an empty `view` until finalized, and no unrevealed server seed ever leaves). An in-flight unsettled (`placed`) or voided show bet, and any round of another player, brand, environment or game, answers 404, the same as for an id that exists nowhere. A MEME_TRADE session also reads by the `bet_id` of its `settled` frame (`MemeTradeSettlement`), once the show round has revealed its seed: the show round's id (`<chain>-<index>`) reads the player's own trade record, and a sidebet's frame id (`sb-<chain>:<index>-<n>`, URL-encoded in the path) reads that sidebet's own record — each returning the same `Round` its `rnd_` id reads. A player who only bought in (only placed sidebets) has no trade record, so the show round id answers 404 (a buy-in-only player's balance still returns in full as its round-balance credit); a sidebet's frame id answers 404 until its show round has revealed its seed, and answers 404 for any other player, brand, environment, game or operator, identical to an unknown id.

**Response example (`200`)**

```json
{
  "id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA",
  "game": "dice",
  "version": 1,
  "brand": "br_casino_main",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "status": "settled",
  "step": 1,
  "stake": "0.00100000",
  "payout": "0.00197999",
  "refund": "0.00000000",
  "max_profit": "1.00000000",
  "cap_rule": "truncate",
  "cap_source": "brand",
  "view": {
    "roll": 3317,
    "win": true
  },
  "seed": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "ñandú-42",
    "nonce": 42
  },
  "created_at": "2026-10-29T01:45:00Z",
  "settled_at": "2026-10-29T01:45:00Z"
}
```

### `actSessionRound` — `POST /v1/session/rounds/{id}/actions`

- **Summary:** Play one step of a round in the session
- **Tag:** `session`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** [`RoundAction`](#roundaction)
- **Parameters:** `id` (path, required), `Idempotency-Key` (header, required)
- **Shared errors:** `400`, `401`, `403`, `404`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`Round`](#round) (`application/json`): The session player's round after the step.
  - `503` -> [`Problem`](#problem) (`application/problem+json`) (headers: `Betrail-Request-Id`, `Retry-After`): The operator's wallet did not answer in time (`wallet_unavailable`). One of three cases: the debit's result is unknown, so the round is voided, the debit rolled back and nothing revealed (a repeat of the `Idempotency-Key` gets this answer again); the operator's in-flight wallet calls are at the bulkhead, so nothing was written and `Retry-After` says when to try again; a balance read got no answer, or one that is not bound, so nothing was written.

**Contract notes**

`POST /v1/rounds/{id}/actions` for the embedded client: the same `{action, step}`, the same `409 closed` for a step already taken, and the same `422 invalid_action` for an action whose `do` is `force_close`, the platform's move, refused before any debit or draw (`RoundAction`). A step that adds stake is debited from the wallet first, as an open is. A STACKOPASS hand (`stack-o-pass`) is played at its table, which orders its moves, so its moves go over the socket (`StackOPassCommand` in `asyncapi.yaml`) and this route refuses it with `409 not_offered` before anything is read or drawn. For a `real` session with an active reality-check interval, actions at or after `reality_check.due_at` answer `409 reality_check_due` (carrying `elapsed_seconds` and `net_result`) before any draw or debit until acknowledged via `POST /v1/sessions/current/reality-check`; operator force-close and inactivity settlement remain unaffected.

**Request example**

```json
{
  "action": {
    "do": "cashout"
  },
  "step": 3
}
```

**Response example (`200`)**

```json
{
  "id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA",
  "game": "mines",
  "version": 1,
  "brand": "br_casino_main",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "status": "settled",
  "step": 3,
  "stake": "0.00100000",
  "payout": "0.00107000",
  "refund": "0.00000000",
  "max_profit": "1.00000000",
  "cap_rule": "truncate",
  "cap_source": "brand",
  "view": {
    "status": "CASHED_OUT",
    "mines": 3,
    "sweeped_tiles": [
      0
    ],
    "mine_locations": [
      2,
      11,
      19
    ],
    "multiplier": "1.07",
    "win": true,
    "payout": "0.00107000",
    "profit": "0.00007000",
    "max_profit_hit": false,
    "floats_used": 24,
    "game_result": {
      "status": "CASHED_OUT",
      "sweeped_tiles": [
        0
      ],
      "mine_locations": [
        2,
        11,
        19
      ]
    }
  },
  "seed": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "seed-1",
    "nonce": 42
  },
  "created_at": "2026-10-28T17:00:00Z",
  "settled_at": "2026-10-28T17:00:04Z"
}
```

### `getSessionBalance` — `GET /v1/session/balance`

- **Summary:** Read the session player's balance
- **Tag:** `session`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** `none`
- **Shared errors:** `401`, `403`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`SessionBalance`](#sessionbalance) (`application/json`) (headers: `Cache-Control`): The session player's balance.
  - `503` -> [`Problem`](#problem) (`application/problem+json`) (headers: `Betrail-Request-Id`, `Retry-After`): The operator's wallet did not answer in time (`wallet_unavailable`). One of three cases: the debit's result is unknown, so the round is voided, the debit rolled back and nothing revealed (a repeat of the `Idempotency-Key` gets this answer again); the operator's in-flight wallet calls are at the bulkhead, so nothing was written and `Retry-After` says when to try again; a balance read got no answer, or one that is not bound, so nothing was written.

**Contract notes**

The player's balance in the session's currency, so the balance the client shows is the server's. It reads the operator's wallet (`POST {base}/balance`) and stores nothing. A settled round's credit goes out through the outbox, so it may not be in this figure yet. A `demo` session reads its fun balance and calls no wallet.

- **The answer is bound.** The wallet's `currency` must equal the session's, `balance` must parse as an `Amount`, and a live brand's answer is signed. Anything else is `503 wallet_unavailable`.
- **Its own bulkhead.** At most 8 of these reads per operator are in flight on each `api` instance (a setting), so a burst of page loads cannot take the debits' slots. Past it the answer is `503 wallet_unavailable` with `Retry-After`.

**Response example (`200`)**

```json
{
  "balance": "0.01250000",
  "currency": "BTC"
}
```

### `getSessionSeeds` — `GET /v1/session/seeds`

- **Summary:** Read the session player's seeds
- **Tag:** `session`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** `none`
- **Shared errors:** `401`, `403`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`SeedState`](#seedstate) (`application/json`): The session player's seed state.

**Contract notes**

The seed state of the session's player and game, as `GET /v1/players/{player_ref}/seeds/{game}` shows it.

**Response example (`200`)**

```json
{
  "current": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "ñandú-42",
    "nonces_used": 43
  },
  "next": {
    "server_seed_hash": "5c4b3a29180716f5e4d3c2b1a09f8e7d6c5b4a3928170615f4e3d2c1b0a99887",
    "client_seed": "🎲 lucky",
    "nonces_used": 0
  },
  "previous": null
}
```

### `setSessionClientSeed` — `PUT /v1/session/client-seed`

- **Summary:** Set the session player's next client seed
- **Tag:** `session`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** [`ClientSeedSet`](#clientseedset)
- **Shared errors:** `400`, `401`, `403`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`SeedState`](#seedstate) (`application/json`): The session player's seed state, with the new next client seed.

**Contract notes**

Sets the client seed of the session player's **next** seed pair. It takes effect at the next rotation, so a seed pair in use never changes. Setting the same value again is a no-op. Only the player's own session may set a client seed; operator API keys cannot alter it.

**Request example**

```json
{
  "client_seed": "🎲 lucky"
}
```

**Response example (`200`)**

```json
{
  "current": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "ñandú-42",
    "nonces_used": 43
  },
  "next": {
    "server_seed_hash": "5c4b3a29180716f5e4d3c2b1a09f8e7d6c5b4a3928170615f4e3d2c1b0a99887",
    "client_seed": "🎲 lucky",
    "nonces_used": 0
  },
  "previous": null
}
```

### `rotateSessionSeeds` — `POST /v1/session/seeds/rotate`

- **Summary:** Rotate the session player's seeds
- **Tag:** `session`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** `none`
- **Parameters:** `Idempotency-Key` (header, required)
- **Shared errors:** `401`, `403`, `409`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`SeedState`](#seedstate) (`application/json`): The session player's seed state after the rotation, with the previous pair revealed.

**Contract notes**

`POST /v1/players/{player_ref}/seeds/{game}/rotate` for the embedded client: the same reveal, and the same `409 round_open` while a round drawn from the current pair is unfinished.

**Response example (`200`)**

```json
{
  "current": {
    "server_seed_hash": "3b1f0c6f9d2a4e8b7c5d1e0f2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
    "client_seed": "ñandú-42",
    "nonces_used": 43
  },
  "next": {
    "server_seed_hash": "5c4b3a29180716f5e4d3c2b1a09f8e7d6c5b4a3928170615f4e3d2c1b0a99887",
    "client_seed": "🎲 lucky",
    "nonces_used": 0
  },
  "previous": null
}
```

### `acknowledgeRealityCheck` — `POST /v1/sessions/current/reality-check`

- **Summary:** Acknowledge a due reality check on the current player session
- **Tag:** `session`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** `none`
- **Parameters:** `Idempotency-Key` (header, required)
- **Shared errors:** `400`, `401`, `403`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `200` -> [`RealityCheckAck`](#realitycheckack) (`application/json`) (headers: `Cache-Control`): The recorded reality-check acknowledgement and updated next due timestamp.

**Contract notes**

Records one player acknowledgement for a due reality check on the authenticated real-money seamless session (part 2; operator-configured hook, not a legal compliance certification; policy defaults pending platform policy). Takes a 0-byte empty body (`400 invalid_request` if any body or query parameter is sent).

- **Due-only enforcement (anti-stacking):** succeeds only when the session has an active reality-check interval and `now >= reality_check.due_at`. Calling before `due_at`, on a `demo` session, or on a session launched while reality checks were off answers `409 closed` without writing an idempotency claim or mutating the session.
- **State transition:** locks the `player_sessions` row, computes `elapsed_seconds` and `net_result` from this session's settled rounds, advances `reality_check.due_at` to `now + interval_seconds`, and appends an immutable row to `session_reality_checks`.
- **Idempotent replay and stale keys:** repeating the same `Idempotency-Key` within the same session replays the stored `200` answer without advancing `due_at` a second time — including after a subsequent interval becomes due, where the next round open remains refused with `409 reality_check_due` until a fresh `Idempotency-Key` is sent. Reusing a key from another session of the same player answers `422 idempotency_key_reused`.

**Response example (`200`)**

```json
{
  "acknowledged_at": "2026-10-29T02:15:05Z",
  "elapsed_seconds": 1805,
  "net_result": "-0.00050000",
  "reality_check": {
    "interval_seconds": 1800,
    "due_at": "2026-10-29T02:45:05Z"
  }
}
```

### `createLiveTicket` — `POST /v1/live/{game}/tickets`

- **Summary:** Get a join ticket for a live game's socket
- **Tag:** `live`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** `none`
- **Parameters:** `game` (path, required), `Idempotency-Key` (header, required)
- **Shared errors:** `400`, `401`, `403`, `404`, `413`, `415`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `201` -> [`LiveTicket`](#liveticket) (`application/json`) (headers: `Cache-Control`): The join ticket.

**Contract notes**

The live client's call before each socket it opens. The answer is a join ticket for the socket `/v1/live/{game}` on the live server (`asyncapi.yaml`, channel `liveGame`), which the client sends as a subprotocol, `Sec-WebSocket-Protocol: betrail.v1, ticket.<ticket>` (scheme `joinTicket`), never in a URL. The call takes the session token alone, as the `session` operations do, and no body (`400 invalid_request`).

- **The ticket** is `v1.<base64url(payload)>.<base64url(HMAC-SHA256)>`, signed with the live ticket key. Its payload, `{sid, operator, brand, environment, player, game, exp, jti}`, comes from the session and never from the request. It names the session by its own random id (`sid`) and holds no session token, no hash of one and no other secret, because it is signed, not encrypted: anyone who sees a ticket can read it.
- **30 s, one socket.** `exp` is 30 s after the mint. `live` checks the MAC, then `exp`, the game and the environment, then the handshake's `Origin`, and consumes the `jti` last, so a refused handshake does not burn the ticket. A client gets a fresh ticket for every socket it opens, a reconnect included: a ticket is never refreshed or extended.
- **Nothing is claimed or stored.** The `Idempotency-Key` is required and checked for shape, but a ticket is a 30 s credential, not a resource: every call, a repeat of the key included, mints a fresh ticket with a fresh `jti`, and neither the ticket nor a claim is written. A client whose answer was lost asks again, and the ticket it never saw expires unused.
- **`{game}` is the session's game.** A session is bound to one game, so another live game is `403 forbidden`, and a slug that is not a live game is `404 not_found`. A `demo` session is `403 forbidden`: demo play has no seat in a live show, and allowing it later is additive.
- **Player status and money gates.** A player whose status is `self_excluded` or `blocked` is refused (`403 player_blocked`). A ticket moves no money and opens nothing, so the call checks neither the operator's credits, plan nor offering gates: an `active` player with a bet in a show can rejoin and finish it, while those gates refuse new bets and buy-ins over REST.
- **Origins are a browser control**, as `sessionToken` says, and `live` checks the handshake's `Origin` again against the brand's set.
- Minting is rate-limited per session (`429 rate_limited` with `Retry-After`).

**Response example (`201`)**

```json
{
  "ticket": "v1.EXAMPLE_payload.EXAMPLE_ticket_mac_000000000000000000000000",
  "expires_at": "2026-10-29T01:45:30Z"
}
```

### `createLiveBet` — `POST /v1/live/{game}/bets`

- **Summary:** Place a bet on a live show
- **Tag:** `live`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** [`LiveBetCreate`](#livebetcreate)
- **Parameters:** `game` (path, required), `Idempotency-Key` (header, required)
- **Shared errors:** `400`, `401`, `403`, `404`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `201` -> [`LiveBet`](#livebet) (`application/json`): The bet, placed in the show.
  - `202` -> [`LiveBet`](#livebet) (`application/json`): The bet's debit is confirmed and its placement is not yet known; repeat the key to learn it.
  - `402` -> [`Problem`](#problem) (`application/problem+json`) (headers: `Betrail-Request-Id`): The operator cannot open live rounds: its credits are exhausted (`credits_exhausted`) or its plan has lapsed (`plan_inactive`). Open rounds still finish, and sandbox keeps working.
  - `503` -> [`Problem`](#problem) (`application/problem+json`) (headers: `Betrail-Request-Id`, `Retry-After`): The operator's wallet did not answer in time (`wallet_unavailable`). One of three cases: the debit's result is unknown, so the round is voided, the debit rolled back and nothing revealed (a repeat of the `Idempotency-Key` gets this answer again); the operator's in-flight wallet calls are at the bulkhead, so nothing was written and `Retry-After` says when to try again; a balance read got no answer, or one that is not bound, so nothing was written.

**Contract notes**

A live player's bet on the show now open for bets (bets go through REST in both integration modes). One call for every live game whose money goes in as a bet, as the join ticket is one call: the path names the game, `params` is the game's own, and the sequence behind it is the same for all of them (check, debit, place, else roll back). TRAPDOOR, KOMBATMP and CRASH take it. MEME_TRADE's buy-in is not a bet, nor is STACKOPASS's: a hand is a session round on the player's own seed pair, bought in with `createSessionRound` (`live_seat`). Money always runs through the operator's seamless wallet.

- **The session's game.** `{game}` must be the session's game (`403 forbidden`); a slug outside the enum is `404 not_found`, and a game in it whose live server does not run on this deployment is `409 not_offered` (TRAPDOOR, KOMBATMP, CRASH, and MEME_TRADE all run live servers). A `demo` session is `403 forbidden`: demo play has no seat in a live show.
- **The show.** `show` names the show the client bets on, by its chain index (the `show` of TRAPDOOR's `lobby` frame, the `round_id` of KOMBATMP's `round` frame, the `index` of CRASH's `lobby` frame). A show that is not the one open for bets, or one that no longer takes bets, is `409 closed`: TRAPDOOR's once past its lobby's close plus 1,500 ms, inclusive; the open KOMBATMP round once its fight has ended or the round was aborted, and at no time before: `live` runs the bell at `bell_at` plus 251 ms, so a bet that reaches `live` at or before `bell_at` plus 250 ms is pre-fight, and a later one meets the fight (a winner bet at the exchanges revealed as of its arrival; a side bet `409 not_offered`), under the arrival rule; CRASH's once its lobby has closed (`lobby_closes_at`, 5,000 ms after it opened, when `live` runs its first step): a bet that reaches `live` before then is placed before that step, however many others are queued with it (the arrival rule).
- **Before the debit**: the session and the `Idempotency-Key`; the offering gates (`409 not_offered`, including brand/environment, kill-switch, and live hourly FX-rate checks); the player's status (`403 player_blocked`); the operator's credits and plan (`402`); the live gate (`403 forbidden`) and the session's operator-asserted jurisdiction against brand blocks and the live allowlist (`403 jurisdiction_not_allowed`); the session's reality-check schedule (`409 reality_check_due` with `elapsed_seconds` and `net_result` when `now >= reality_check.due_at`); the limits; `max_exposure` (`409`); and the show's public state, as a cheap early refusal. The wallet's refusal answers with the wallet's code (`409 insufficient_funds`, `409 limit_exceeded`, `403 player_blocked`); an unknown debit is `503 wallet_unavailable` with nothing placed.
- **The show's refusals** are decided by its writer when the bet is placed, after the debit, which a refusal rolls back: `params` not valid for the game (`422 invalid_input`; TRAPDOOR's `door1` and `plan` are read as sent, so `1.0` or `"1"` is refused), the stake outside the limits (`422 stake_out_of_range`), a stake whose `stake + max_profit` does not fit an amount (`422 invalid_input`), a stake whose winnings could pass the maximum profit (`422 max_stake`, with `max_stake` the largest stake it takes: TRAPDOOR's at its first bank, KOMBATMP's at the bet's `pay`, its exact profit `stake · (pay − 1)`, CRASH's at its `auto_cashout`, else at 1.01x), the show no longer taking bets (`409 closed`), and the game's own: TRAPDOOR's and CRASH's second bet by the same player in the show (`409 limit`, a force-closed one included); CRASH's `auto_cashout` outside `1.01` to `1000000.00` with at most 2 decimals (`422 invalid_input`); KOMBATMP's `at` other than the exchanges revealed as of the bet's arrival at `live`, or a `pay` other than the offer there (`409 odds_changed`; the new offer is in the round's `prices` and the bettor's socket `error`), a market not offered at the bet's arrival (`409 not_offered`: a side bet after the bell, a side bet the paytable drops, a side whose quote is outside `1.01.. 1000.00`), and a player's 13th bet in the round, or its 9th at `at` ≥ 1 (`409 limit`).
- **KOMBATMP's round pool** (the game specification's `ROUND_FULL`, scoped to the brand): before the debit, the sum of the `reserved_profit` of the brand's bets in the round, in the bet's currency, plus this bet's (`⌊stake · pay / 100⌋ − stake`, from `params.pay`) may not pass 10 × the brand's `max_profit` for that currency (equality is taken); otherwise `409 max_exposure` with `detail` `This round is full for <coin>. Try a smaller stake or the next round.` A bet's reservation is released when it settles, is refunded or its placement is voided. The same `reserved_profit` is what the bet holds against the brand's `max_exposure`, which applies as well; when both would refuse, the pool's `detail` is the answer. Both read the caller's brand alone, so no answer tells of another brand's or operator's bets. A client must not parse `detail`: the two differ only in that the next round may take the same bet after a full round, while the brand's exposure cap holds until the brand's other bets settle.
- **Placed or pending.** `201` with `status: placed` once the show's journal holds the bet: it then takes part in the show and settles with it. When the placement's outcome is unknown (a timeout, a failover mid-call), `202` with `status: pending`: BetPlug resolves it (a void tombstone), and a repeat of the `Idempotency-Key` answers `202` again until it is resolved, then `201` with `status: placed` if the show took the bet, or `409 closed` if it did not, its debit rolled back.
- **After the answer** the bet is the player's on the socket: TRAPDOOR's picks, banks and pre-plan are socket commands, and its settlement is a `settled` frame (`asyncapi.yaml`, `TrapdoorFrame`), then one credit through the outbox. A KOMBATMP bet has no in-round action: it settles when its fight ends, with `paid` and `settled` frames (`KombatmpFrame`), then one credit. A CRASH bet cashes out on its own at its `auto_cashout` or cap, or by the socket's `cashout`, and settles with a `settled` frame (`CrashFrame`); there is no REST cash-out. `bet_id` is the bet's round id: `GET /v1/rounds/{id}`, `round.settled`, the frame's `LiveSettlement.bet_id`, and the wallet's `round_id` and transaction ids (`<bet_id>:0:<n>:debit`, `<bet_id>:credit`) all carry it.

**Request example**

```json
{
  "show": 1001,
  "stake": "0.00100000",
  "params": {
    "door1": 2,
    "plan": {
      "bank_at": 3,
      "doors": {
        "2": 1,
        "3": 4
      }
    }
  }
}
```

**Response example (`201`)**

```json
{
  "bet_id": "bet_01JBX7Q2W3E4R5T6Y7U8I9O0PA",
  "game": "trapdoor",
  "show": 1001,
  "show_round_id": "chain_2026_11-1001",
  "status": "placed",
  "currency": "BTC",
  "stake": "0.00100000",
  "view": {
    "show": 1001,
    "index": 1001,
    "format": "CLASSIC",
    "bean": 1,
    "bet_amt": "0.00100000",
    "cap_gate": 8,
    "max_multiplier": "85.50",
    "reserved_profit": "0.08450000",
    "door1": 2,
    "plan": {
      "bank_at": null,
      "doors": {}
    }
  }
}
```

### `createMemeTradeBuyIn` — `POST /v1/live/meme-trade/buy-ins`

- **Summary:** Buy into the open MEME_TRADE round balance
- **Tag:** `live`
- **Authentication and signing:** `sessionToken` (`Bearer bts_<token>` + `Origin` check)
- **Requires `Idempotency-Key`:** yes
- **Request body schema:** [`MemeTradeBuyInCreate`](#memetradebuyincreate)
- **Parameters:** `Idempotency-Key` (header, required)
- **Shared errors:** `400`, `401`, `403`, `404`, `409`, `413`, `415`, `422`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `201` -> [`MemeTradeBuyIn`](#memetradebuyin) (`application/json`) (headers: `Cache-Control`): The buy-in, booked in the player's round balance.
  - `202` -> [`MemeTradeBuyIn`](#memetradebuyin) (`application/json`) (headers: `Cache-Control`): The buy-in's debit is confirmed and its booking is being reconciled; repeat the key to learn it.
  - `402` -> [`Problem`](#problem) (`application/problem+json`) (headers: `Betrail-Request-Id`): The operator cannot open live rounds: its credits are exhausted (`credits_exhausted`) or its plan has lapsed (`plan_inactive`). Open rounds still finish, and sandbox keeps working.
  - `503` -> [`Problem`](#problem) (`application/problem+json`) (headers: `Betrail-Request-Id`, `Retry-After`): The operator's wallet did not answer in time (`wallet_unavailable`). One of three cases: the debit's result is unknown, so the round is voided, the debit rolled back and nothing revealed (a repeat of the `Idempotency-Key` gets this answer again); the operator's in-flight wallet calls are at the bulkhead, so nothing was written and `Retry-After` says when to try again; a balance read got no answer, or one that is not bound, so nothing was written.

**Contract notes**

Funds the session player's round balance in the open MEME_TRADE v2 show round. MEME_TRADE's trades (`open`, `close`, `sidebet`, `auto_sell`) move value inside `round_balances` over the socket; money enters only through this REST call via the operator's seamless wallet, and exits once after the round's rug (outage void) as `<player_round_id>:credit` through the outbox.

- **The session's game.** The session must be a `real` session bound to `meme-trade` (`403 forbidden`).
- **Before the debit**: the session and `Idempotency-Key`; the offering gates (`409 not_offered`, MEME_TRADE settlement rules); the player's status (`403 player_blocked`); the operator's credits and plan (`402`); the live gate (`403 forbidden`) and the session's operator-asserted jurisdiction against brand blocks and the live allowlist (`403 jurisdiction_not_allowed`); the session's reality-check schedule (`409 reality_check_due` with `elapsed_seconds` and `net_result` when `now >= reality_check.due_at`); the brand's stake limits (`422 stake_out_of_range`); currency lock on subsequent buy-ins in the same round (`422 invalid_action`); and that `round` names the open MEME_TRADE show round (`409 closed`). `max_exposure` does not run on a buy-in.
- **Placed or pending.** `201` with `status: placed` and the updated round `balance` once `round_balance_entries` holds the `+B` entry. When the handoff's outcome is unknown, `api` retries under the same debit id within its budget, else answers `202` with `status: pending` while `DebitSweep` reconciles against `round_balance_entries` and `show_rounds`; if the round closed or fenced the buy-in without booking it, the attempt is voided and its debit rolled back (`409 closed`).

**Request example**

```json
{
  "round": "chain_2026_11:1001",
  "amount": "0.00100000"
}
```

**Response example (`201`)**

```json
{
  "show": 1001,
  "round": "chain_2026_11:1001",
  "show_round_id": "chain_2026_11-1001",
  "status": "placed",
  "currency": "BTC",
  "amount": "0.00100000",
  "balance": "0.00100000"
}
```

### `receiveTopupEvent` — `POST /v1/topup-events/{provider}`

- **Summary:** Top-up provider: report a checkout's event
- **Tag:** `topup`
- **Authentication and signing:** provider-signature (`security: []`, verified before body decode)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** [`TopupMockEvent`](#topupmockevent)
- **Parameters:** `provider` (path, required)
- **Shared errors:** `400`, `401`, `404`, `413`, `415`, `429`, `500` — see [Shared HTTP errors & retry matrix](#shared-http-errors--retry-matrix).
- **Responses:**
  - `204` -> no body: The event is recorded, or was already.

**Contract notes**

The webhook a top-up provider calls. There is one path per provider. It carries no BetPlug credential (`security: []`, enforced to this path): **the provider's own signature** is the credential.

- **The order.** The per-address and global limits, the 64 KB body cap and the refusal of a compressed body, then the provider, then the signature, and only then the body. An unsigned caller writes nothing, and is never told more than `401`, or `404` for a provider this deployment lacks.
- **The signature.** It is compared in constant time, with a timestamp within 300 s of BetPlug's clock, and both secrets are accepted during a 24 h rotation. For `mock` it is the scheme (`Betrail-Timestamp`, `Betrail-Nonce`, `Betrail-Signature`), keyed with the mock's key, over the target `/v1/topup-events/mock`. A real provider brings its own scheme and its own body schema here.
- **The body** is decoded strictly (strict JSON decoding). A repeated key, an unknown field or trailing data is `400`.
- **`204` means recorded, never credited.** `api` only records the event. `worker` asks the provider for the checkout's state, and applies that. The event says when to ask, and the provider's answer is what pays.
- **A redelivered event id is a `204`** and changes nothing. If it carries different content, it is still a `204`, the first row stands and an alert fires: the row is only a wake-up, and the provider's answer decides, so a retry could not help.
- **A signed event naming a top-up BetPlug does not know is `404`,** with an alert and nothing written. A genuine event always finds its row, because the row is written before the checkout exists.
- **No `Idempotency-Key`.** A provider sends none. The event id, unique per provider, does that job.
- **An unknown provider, or one this deployment has not configured, is `404`.** `mock` exists only where the start-up guard allows it.

**Request example**

```json
{
  "id": "mock_5b2e9c7a-1f4d-4e8b-a3c6-9d0e7f1a2b3c:succeeded",
  "topup_id": "3f1c8f7e-6d2b-4a8e-9c11-0b7a2d4e5f60",
  "operator_id": "8a7b6c5d-4e3f-4a1b-9c8d-7e6f5a4b3c2d",
  "checkout_id": "mock_5b2e9c7a-1f4d-4e8b-a3c6-9d0e7f1a2b3c",
  "status": "succeeded",
  "amount_micro": 10000000,
  "currency": "USD"
}
```

## Seamless wallet callbacks

BetPlug calls these four endpoints on your brand's wallet base URL (`POST {wallet_base}/balance`, `/debit`, `/credit`, `/rollback`). Every verified call on a live brand must return `Betrail-Timestamp` and `Betrail-Signature` (`betrail-v1-answer`, `ed25519=` or `v1=`), including `4xx` [`WalletRefusal`](#walletrefusal) / [`WalletProtocolRefusal`](#walletprotocolrefusal) responses.

### `walletBalance` — `POST {wallet_base}/balance`

- **Summary:** Wallet: read a player's balance
- **Tag:** `wallet`
- **Authentication and signing:** `walletSignature` (`betrail-v1` request + `betrail-v1-answer` response)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** [`WalletBalanceRequest`](#walletbalancerequest)
- **Parameters:** `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Responses:**
  - `200` -> [`WalletBalance`](#walletbalance) (`application/json`) (headers: `Betrail-Timestamp`, `Betrail-Signature`): The player's balance.
  - `4XX` -> [`WalletProtocolRefusal`](#walletprotocolrefusal) (`application/json`) (headers: `Betrail-Timestamp`, `Betrail-Signature`): The wallet refuses a balance read, a credit or a rollback as malformed: `invalid_request` only. A credit or rollback is never refused for balance, limits or the player's status. BetPlug keeps a refused or unacknowledged credit or rollback retrying, and alerts when it goes `dead`; the money is never dropped.

**Contract notes**

`POST {base}/balance`, called by BetPlug on the operator's wallet at the brand's configured base URL, through BetPlug's egress guard. Every wallet call is signed with the brand's wallet secret, carries a JSON body, and has a 3 s timeout and a 64 KB answer cap.

**Request example**

```json
{
  "player_ref": "p_8f3a2c",
  "currency": "BTC"
}
```

**Response example (`200`)**

```json
{
  "balance": "0.05000000",
  "currency": "BTC",
  "status": "active"
}
```

### `walletDebit` — `POST {wallet_base}/debit`

- **Summary:** Wallet: take a stake
- **Tag:** `wallet`
- **Authentication and signing:** `walletSignature` (`betrail-v1` request + `betrail-v1-answer` response)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** [`WalletDebitRequest`](#walletdebitrequest)
- **Parameters:** `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Responses:**
  - `200` -> [`WalletAnswer`](#walletanswer) (`application/json`) (headers: `Betrail-Timestamp`, `Betrail-Signature`): The debit is booked.
  - `4XX` -> [`WalletRefusal`](#walletrefusal) (`application/json`) (headers: `Betrail-Timestamp`, `Betrail-Signature`): The wallet refuses the debit, and booked nothing. **Only a 4xx whose body is this `WalletRefusal`**, with a `code` from its enum and the echoed `transaction_id`, and, for a `btr_live_` brand, a valid answer signature (`walletSignature`, line 2 being this 4xx), is a refusal. BetPlug then voids the round without a rollback and passes the code to the client. Every other answer is **unknown**, and BetPlug rolls the debit back: a 4xx without this body, an unsigned or badly signed live refusal, a 5xx, a timeout, an unreadable or oversized body.

**Contract notes**

`POST {base}/debit`. BetPlug calls it once per debit attempt, and never retries an unknown one.

- **A success** is a 200 whose `WalletAnswer` echoes `transaction_id`, `amount` and `currency`, carries its own `operator_transaction_id`, and, for a `btr_live_` brand, carries a valid answer signature (`walletSignature`). Any other success counts as unknown.
- **A refusal** is a 4xx whose body is a `WalletRefusal`, with a `code` from its enum and the echoed `transaction_id`. For a `btr_live_` brand, it also carries a valid answer signature, whose line 2 is the refusal's own status. Only then does BetPlug void the round without a rollback, since nothing was booked. An unsigned live refusal is unknown and rolled back, which is harmless: the rollback leaves a tombstone.
- **Anything else is unknown**, and BetPlug rolls the debit back. That includes a 4xx without that body (a gateway's 408, 413 or 429 page), a 5xx, a timeout, and an unreadable or oversized answer.
- **An answer holds exactly its schema's fields.** BetPlug decodes every wallet answer strictly: a field the schema does not list, a repeated field, or a name that differs in case makes the answer unknown. So a debit is rolled back, and a credit or a rollback retries until it goes `dead`. The wallet tester reports it, so it shows before go-live.
- **`transaction_id` is the only key to rely on.** On a MEME_TRADE show, several players, and one player's several buy-ins, share a `round_id`.
- The same `transaction_id` must get the first answer again, signed afresh for the call it answers (`walletSignature`).
- A debit whose id was already rolled back (a tombstone) is refused with `invalid_request`.

**Request example**

```json
{
  "transaction_id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA:0:1:debit",
  "round_id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "amount": "0.00100000",
  "game": "dice",
  "brand": "br_casino_main"
}
```

**Response example (`200`)**

```json
{
  "transaction_id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA:0:1:debit",
  "amount": "0.00100000",
  "currency": "BTC",
  "operator_transaction_id": "op-tx-99812",
  "balance": "0.04900000"
}
```

### `walletCredit` — `POST {wallet_base}/credit`

- **Summary:** Wallet: pay a round
- **Tag:** `wallet`
- **Authentication and signing:** `walletSignature` (`betrail-v1` request + `betrail-v1-answer` response)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** [`WalletCreditRequest`](#walletcreditrequest)
- **Parameters:** `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Responses:**
  - `200` -> [`WalletAnswer`](#walletanswer) (`application/json`) (headers: `Betrail-Timestamp`, `Betrail-Signature`): The credit is booked.
  - `4XX` -> [`WalletProtocolRefusal`](#walletprotocolrefusal) (`application/json`) (headers: `Betrail-Timestamp`, `Betrail-Signature`): The wallet refuses a balance read, a credit or a rollback as malformed: `invalid_request` only. A credit or rollback is never refused for balance, limits or the player's status. BetPlug keeps a refused or unacknowledged credit or rollback retrying, and alerts when it goes `dead`; the money is never dropped.

**Contract notes**

`POST {base}/credit`. Every settled round sends exactly one credit, 0 included, so the operator's round closes. A credit is **never refused for balance, limits or the player's status**, whatever rollbacks of the round are still pending: a player blocked or self-excluded mid-round is still paid. Only a protocol error refuses one (`invalid_request`).

- **`transaction_id` is the only key to rely on.** On a MEME_TRADE show each player has a credit of their own, under the same `round_id`, so a wallet that keys credits on `round_id` leaves the second player unpaid.
- **Acknowledged** means a 200 whose `WalletAnswer` echoes `transaction_id`, `amount` and `currency`, with its own `operator_transaction_id` and, for a `btr_live_` brand, a valid answer signature. A retry's answer is the first one, signed afresh for the retry (`walletSignature`).
- **Anything else** (a refusal, a success without the echo, a 5xx, a timeout) is not an acknowledgement. BetPlug keeps the credit retrying from its outbox with backoff. After the retry schedule (24 h) it goes `dead` and raises an alert for a human. The money is never dropped.

**Request example**

```json
{
  "transaction_id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA:credit",
  "round_id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "amount": "0.00197999",
  "kind": "payout",
  "game": "dice",
  "brand": "br_casino_main"
}
```

**Response example (`200`)**

```json
{
  "transaction_id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA:0:1:debit",
  "amount": "0.00100000",
  "currency": "BTC",
  "operator_transaction_id": "op-tx-99812",
  "balance": "0.04900000"
}
```

### `walletRollback` — `POST {wallet_base}/rollback`

- **Summary:** Wallet: undo a debit
- **Tag:** `wallet`
- **Authentication and signing:** `walletSignature` (`betrail-v1` request + `betrail-v1-answer` response)
- **Requires `Idempotency-Key`:** no
- **Request body schema:** [`WalletRollbackRequest`](#walletrollbackrequest)
- **Parameters:** `Betrail-Timestamp` (header, required), `Betrail-Nonce` (header, required)
- **Responses:**
  - `200` -> [`WalletAnswer`](#walletanswer) (`application/json`) (headers: `Betrail-Timestamp`, `Betrail-Signature`): The rollback is booked, or remembered as a tombstone.
  - `4XX` -> [`WalletProtocolRefusal`](#walletprotocolrefusal) (`application/json`) (headers: `Betrail-Timestamp`, `Betrail-Signature`): The wallet refuses a balance read, a credit or a rollback as malformed: `invalid_request` only. A credit or rollback is never refused for balance, limits or the player's status. BetPlug keeps a refused or unacknowledged credit or rollback retrying, and alerts when it goes `dead`; the money is never dropped.

**Contract notes**

`POST {base}/rollback`. It undoes one debit attempt (`rollback_of`). If the wallet never saw that debit, it succeeds as a no-op and remembers the id, so a late debit with it is refused. Such a tombstone's answer carries the tombstone's own `operator_transaction_id` and the player's current `balance`. After a booked debit, it returns the money once. Only a protocol error refuses a rollback (`invalid_request`). Acknowledgement and retries are as for a credit: a 200 with the echo acknowledges it, and anything else keeps it retrying until the outbox gives up and alerts.

**Request example**

```json
{
  "transaction_id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA:0:1:debit:rollback",
  "rollback_of": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA:0:1:debit",
  "round_id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA",
  "player_ref": "p_8f3a2c",
  "currency": "BTC",
  "amount": "0.00100000"
}
```

**Response example (`200`)**

```json
{
  "transaction_id": "rnd_01JBX7Q2W3E4R5T6Y7U8I9O0PA:0:1:debit",
  "amount": "0.00100000",
  "currency": "BTC",
  "operator_transaction_id": "op-tx-99812",
  "balance": "0.04900000"
}
```

## AsyncAPI channels, operations, and messages

### `sendLiveFrame` (`send` on `/v1/live/{game}`)

- **Summary:** The show's frames to the player's socket (snapshot, round, step, result, paid, error).

**Contract notes**

Every frame carries a per-socket sequence number; a client that sees a gap asks for a snapshot. A frame never carries another player's identity or a seed before the round closes.

### `receiveLiveCommand` (`receive` on `/v1/live/{game}`)

- **Summary:** A player's command (a fresh snapshot, or an in-round command), answered by an ack frame with the same request id.

**Contract notes**

Commands are rate-limited per connection. Money goes in over REST, so an in-round command (a pick, a bank, a cash-out, a STACKOPASS open or pass) moves no money in; its credits go out through the outbox. The exception is MEME_TRADE's trades, which move value inside the round balance: they commit before the next tick or are voided and refunded (the tick barrier).

### `sendWebhook` (`send` on `{operator_webhook_url}`)

- **Summary:** One event, POSTed to the operator's endpoint (round.settled, credits.low, credits.exhausted).

**Contract notes**

Delivered at least once from the transactional outbox, retried with backoff, and logged in the console where it can be replayed. Any 2xx answer acknowledges it. The endpoint passes the SSRF guard of on every delivery.

### AsyncAPI message payloads

- **`LiveFrame`** (`Live frame`, schema [`LiveFrame`](#liveframe)): A frame from the show to a player.
- **`LiveSettled`** (`Live bet settled`, schema [`LiveSettledFrame`](#livesettledframe)): The frame that tells a player their bet settled, by play, a force-close or an outage.
- **`StackOPassFrame`** (`STACKOPASS live frame`, schema [`StackOPassFrame`](#stackopassframe)): A frame from a STACKOPASS table to a player, its hand's settlement included.
- **`StackOPassCommand`** (`STACKOPASS live command`, schema [`StackOPassCommand`](#stackopasscommand)): A STACKOPASS player's socket command (snapshot, watch, open, pass, cashout, leave).
- **`MemeTradeFrame`** (`MEME_TRADE live frame`, schema [`MemeTradeFrame`](#memetradeframe)): A frame from the MEME_TRADE v2 show to a player, including skipped_link.
- **`LiveCommand`** (`Live command`, schema [`LiveCommand`](#livecommand)): A command from a player to the show.
- **`KombatmpFrame`** (`KOMBATMP live frame`, schema [`KombatmpFrame`](#kombatmpframe)): A frame from a KOMBATMP round to a player, its settlement included.
- **`KombatmpCommand`** (`KOMBATMP live command`, schema [`KombatmpCommand`](#kombatmpcommand)): A KOMBATMP player's socket command (snapshot only; bets go in over REST).
- **`TrapdoorFrame`** (`TRAPDOOR live frame`, schema [`TrapdoorFrame`](#trapdoorframe)): A frame from a TRAPDOOR show to a player, its settlement included.
- **`TrapdoorCommand`** (`TRAPDOOR live command`, schema [`TrapdoorCommand`](#trapdoorcommand)): A TRAPDOOR player's socket command (snapshot, pick, bank, plan).
- **`CrashFrame`** (`CRASH live frame`, schema [`CrashFrame`](#crashframe)): A frame from a CRASH show to a player, its settlement included.
- **`CrashCommand`** (`CRASH live command`, schema [`CrashCommand`](#crashcommand)): A CRASH player's socket command (snapshot, cashout).
- **`WebhookEvent`** (`Webhook event`, schema [`WebhookEvent`](#webhookevent)): One event delivered to an operator.
- **`RoundSettled`** (`round.settled`, schema [`RoundSettledEvent`](#roundsettledevent)): A round settled, in either integration mode (live games included; a MEME_TRADE player-round).
- **`CreditsLow`** (`credits.low`, schema [`CreditsLowEvent`](#creditslowevent)): The operator's credits fell below its threshold.
- **`CreditsExhausted`** (`credits.exhausted`, schema [`CreditsExhaustedEvent`](#creditsexhaustedevent)): The operator's credits reached 0 or less, so new live rounds are refused.

## OpenAPI component schemas

All object schemas enforce strict JSON decoding (`additionalProperties: false`) unless noted otherwise.

### `Amount`

An amount in the currency's units, as a decimal string, with no sign, no exponent and no leading zero other than `0.`. Never a JSON number. **BetPlug always writes exactly the currency's scale in decimals** (none at scale 0). **It reads at most that many**: `0.5` and `0.50000000` are one amount at scale 8. An amount with more decimals than the currency's scale is refused with `422 invalid_input`, never rounded. A zero stake is `422 stake_out_of_range`.

- **Type:** `string`
- **Constraints:** pattern: `^(0|[1-9][0-9]{0,29})(\.[0-9]{1,18})?$`; maxLength: `48`

### `Multiplier`

An exact multiplier as a decimal string, at the scale the game computes in (`"1.90"`, DICE's `"1.97999"`).

- **Type:** `string`
- **Constraints:** pattern: `^(0|[1-9][0-9]{0,15})(\.[0-9]{1,18})?$`; maxLength: `36`

### `CurrencyCode`

A currency enabled on the brand (`BTC`, `USDT`, `EUR`, `1INCH`). Its scale is 8 unless the brand says otherwise.

- **Type:** `string`
- **Constraints:** pattern: `^[A-Z0-9]{2,12}$`

### `JurisdictionCode`

An optional operator-asserted uppercase ISO 3166-1 alpha-2 country code (`MT`, `CA`). BetPlug enforces it as a hook against the operator's brand blocks (`sandbox` and `live`) and the platform live allowlist (`live`); BetPlug is not a licensee and does not certify legal compliance. Optionality and alpha-2 granularity are defaults pending platform policy.

- **Type:** `string`
- **Constraints:** pattern: `^[A-Z]{2}$`

### `PlayerRef`

The operator's pseudonymous player id, scoped to the operator. Never PII.

- **Type:** `string`
- **Constraints:** pattern: `^[A-Za-z0-9_.:-]{1,64}$`

### `GameSlug`

The game's slug (`dice`, `packs`, `wheel`, `grimoire-of-gains`, `limbo`, `chicken`).

- **Type:** `string`
- **Constraints:** pattern: `^[a-z][a-z0-9]*(-[a-z0-9]+)*$`; minLength: `2`; maxLength: `32`

### `LiveGameSlug`

A live game's slug: TRAPDOOR, KOMBATMP, STACKOPASS, CRASH and MEME_TRADE. The same five as the `game` of the `liveGame` channel in `asyncapi.yaml`.

- **Type:** `string`
- **Constraints:** enum: `trapdoor`, `kombat-multiplayer`, `stack-o-pass`, `crash`, `meme-trade`

### `BrandId`

The brand's id, from the console.

- **Type:** `string`
- **Constraints:** pattern: `^[A-Za-z0-9_-]{1,64}$`

### `RoundId`

A round's id.

- **Type:** `string`
- **Constraints:** pattern: `^[A-Za-z0-9_-]{1,64}$`

### `SessionRoundId`

A round's `rnd_` id, or, in a MEME_TRADE session, a show round's id (`<chain>-<index>`) for the player's trade record or a sidebet's frame id (`sb-<chain>:<index>-<n>`) for that sidebet's own record.

- **Type:** `string`
- **Constraints:** pattern: `^([A-Za-z0-9_-]{1,64}|sb-[A-Za-z0-9_-]{1,43}:[1-9][0-9]{0,19}-[1-9][0-9]*)$`; minLength: `1`; maxLength: `64`

### `ClientSeed`

A client seed: **3 to 64 bytes of valid UTF-8**, with no control character (C0, DEL, C1) and no unpaired surrogate. It is **never normalised**: the engine hashes exactly these bytes, and the record stores them, so verification is byte-exact. Emoji and accented letters are allowed.

- The byte bounds and the surrogate rule are checked by strict raw-token validation, which every handler calls on the raw JSON value; this schema checks what JSON Schema can.
- Bidi controls (U+202A–U+202E, U+2066–U+2069), zero-width characters and U+2028/U+2029 are allowed, so a seed can display as a different string. Every client, the console and the verifier render client seeds escaped. Fairness is unaffected: the hash is byte-exact.

---

- **Type:** `string`
- **Constraints:** pattern: `^[^\u0000-\u001F\u007F-\u009F]+$`; minLength: `1`; maxLength: `64`

### `DiceParams`

DICE's params. The player picks a win chance W/100 % (W in 1 … 9405) and a direction. `payout`, when sent, is the multiplier the client shows. It is compared with BetPlug's as an exact decimal value, so `"1.97999"` and `"1.979990"` are equal; any other value is refused with `409 odds_changed`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `direction` | `string` | yes | enum: `under`, `over`; Under wins on a roll below W; over wins on a roll above 9999 − W. |
| `chance` | `string` | yes | pattern: `^(0\|[1-9][0-9]?)\.[0-9]{2}$`; The win chance in percent with exactly 2 decimals, 0.01 to 94.05. |
| `payout` | [`Multiplier`](#multiplier) | no | — |

### `PacksParams`

PACKS's params (the game specification): **none**. A pack is five cards dealt from the pinned 242-card table, and nothing the player sends changes the deal, so `params` is the empty object `{}`. Any key, and a value that is not an object (`null`, `[]`), is refused with `422 invalid_input` before anything is drawn. The table's exact RTP is 19/20 (95 %), a win's profit is cut to the round's `max_profit` at settlement (`cap_rule: truncate`). The settled round's `view` is a `PacksView`.

- **Type:** `object`

### `PacksCard`

One card of a PACKS deal, with its number in the table, its tier and its multiplier.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `id` | `integer` | yes | min: `1`; max: `242`; The card's number, 1 (the rarest) to 242. |
| `tier` | `string` | yes | enum: `COMMON`, `UNCOMMON`, `RARE`, `SUPER_RARE`, `EPIC`, `LEGENDARY`; The card's rarity tier. |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]{0,3})\.[0-9]{2}$`; The card's multiplier, with exactly 2 decimals (`0.01` to `1000.00`). |

### `PacksView`

The `view` of a settled PACKS round (`Round.view`; the game specification). `cards` are the five cards dealt, in draw order, and `multiplier` is their sum (`0.05` to `5000.00`). `win` is a multiplier above `1.00` (so at least `1.01`); exactly `1.00` is a `push`, which returns the stake; below `1.00` the round is a loss with a partial return. `payout` is `⌊stake × multiplier⌋` at the currency's scale, cut to `stake + max_profit` when `capped`, and equals the round's `payout`; `profit` is `payout − stake`, negative on a partial return. `game_result` is the source's `bets.game_result`, byte for byte.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `version` | `integer` | yes | const: `1`; The card table's version. |
| `cards` | array<[`PacksCard`](#packscard)> | yes | minItems: `5`; maxItems: `5`; The five cards, in the order they were dealt. |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]{0,3})\.[0-9]{2}$`; The pack's multiplier, the sum of the five cards', with exactly 2 decimals. |
| `win` | `boolean` | yes | The multiplier is above `1.00`. |
| `push` | `boolean` | yes | The multiplier is exactly `1.00`. |
| `payout` | [`Amount`](#amount) | yes | What the round paid, as the round's `payout`. |
| `profit` | [`SignedAmount`](#signedamount) | yes | `payout − stake`. |
| `capped` | `boolean` | yes | The profit was cut to `max_profit` at settlement. |
| `game_result` | `object` | yes | The source's `bets.game_result` (`PacksEngine::gameResult`). |

### `WheelParams`

WHEEL's params (the game specification). `risk` is exactly `LOW`, `MEDIUM` or `HIGH`, with no trimming and no other case. `segments` is the wheel's size, 10, 20, 30, 40 or 50, as a plain **JSON integer** (`10`) or as its digit string (`"10"`), both of which the source plays. Anything else is refused with `422 invalid_input` before anything is drawn: a JSON float or exponent (`10.0`, `1e1`), a padded or zero-prefixed string (`" 10"`, `"010"`), another size (`15`, `0`, `100`), a lower-case or padded risk (`"low"`, `" LOW "`), a missing key or an unknown one (`"Risk"`). A key given twice, in any letter case (`risk` and `Risk`), is `400 invalid_request`, as in every body. Every wheel's nominal RTP is 19/20 (95 %), a win's profit is cut to the round's `max_profit` at settlement (`cap_rule: truncate`). The settled round's `view` is a `WheelView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `risk` | `string` | yes | enum: `LOW`, `MEDIUM`, `HIGH`; The risk, which picks the wheel with `segments`. Upper case, exactly as listed. |
| `segments` | `integer` \| `string` | yes | The number of equal segments, as a plain JSON integer or its digit string. |

### `WheelView`

The `view` of a settled WHEEL round (`Round.view`; the game specification). The pointer stops on `segment_index` of the (`risk`, `segments`) wheel, drawn from `u`, the stream's first 32-bit word (`segment = ⌊u · segments / 2^32⌋`), and `multiplier` is that segment's. `win` is a multiplier above `1.00`; no segment pays exactly `1.00`, so `push` is always false, and `0.80` (on `LOW` 10 and 20) is a loss with a partial return. `payout` is `⌊stake × multiplier⌋` at the currency's scale, cut to `stake + max_profit` when `capped`, and equals the round's `payout`; `profit` is `payout − stake`. `game_result` is the source's `bets.game_result`, byte for byte, `float` included.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `risk` | `string` | yes | enum: `LOW`, `MEDIUM`, `HIGH` |
| `segments` | `integer` | yes | enum: `10`, `20`, `30`, `40`, `50`; The wheel's size, always a JSON integer here. |
| `table_version` | `integer` | yes | const: `1` |
| `segment_index` | `integer` | yes | min: `0`; max: `49`; The segment the pointer stopped on, 0 to `segments − 1`. |
| `u` | `integer` | yes | min: `0`; max: `4294967295`; The draw, the stream's first word as an unsigned 32-bit integer. |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]?)\.[0-9]{2}$`; The segment's multiplier, with exactly 2 decimals (`0.00` to `47.50`). |
| `win` | `boolean` | yes | The multiplier is above `1.00`. |
| `push` | `boolean` | yes | Always false on table version 1. |
| `payout` | [`Amount`](#amount) | yes | What the round paid, as the round's `payout`. |
| `profit` | [`SignedAmount`](#signedamount) | yes | `payout − stake`. |
| `capped` | `boolean` | yes | The profit was cut to `max_profit` at settlement. |
| `game_result` | `object` | yes | The source's `bets.game_result` (`WheelEngine::gameResult`). |

### `DrillParams`

DRILL's params. `target` is the target multiplier as a decimal string, `1.01` to `1000000.00`, with at most 2 decimals and no leading zero (`"2"`, `"2.5"` and `"2.50"` are one target). `pick` is the drill the bet is on, `0`, `1` or `2`, as a plain JSON integer or as its digit string. Anything else is refused with `422 invalid_input` before anything is drawn: a JSON number as `target`, a float, padded or zero-prefixed pick (`1.0`, `" 1"`, `"01"`), a missing key or an unknown one. A win's profit is cut to the round's `max_profit` at settlement (`cap_rule: truncate`). The settled round's `view` is a `DrillView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `target` | `string` | yes | pattern: `^(1\.(0[1-9]\|[1-9][0-9]?)\|([2-9]\|[1-9][0-9]{1,5})(\.[0-9]{1,2})?\|1000000(\.0{1,2})?)$`; The target multiplier, `1.01` to `1000000.00`, at most 2 decimals. |
| `pick` | `integer` \| `string` | yes | The drill, as a plain JSON integer or its digit string. |

### `DrillView`

The `view` of a settled DRILL round (`Round.view`; the game specification). Each of the three drills reaches a depth drawn from its word of the stream (`words`); the bet wins when the picked drill's depth reaches `target`, and then `multiplier` is `target`, else `0.00`. `payout` is `⌊stake × multiplier⌋` at the currency's scale, cut to `stake + max_profit` when `capped`, and equals the round's `payout`; `profit` is `payout − stake`. `game_result` is the source's `bets.game_result`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `target` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$`; The target, with exactly 2 decimals. |
| `pick` | `integer` | yes | min: `0`; max: `2` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$`; `target` on a win, `0.00` on a loss. |
| `depths` | `array<string>` | yes | minItems: `3`; maxItems: `3`; Each drill's depth, as a multiplier with exactly 2 decimals. |
| `words` | `array<integer>` | yes | minItems: `3`; maxItems: `3`; The stream words each depth was drawn from, as unsigned 32-bit integers. |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | What the round paid, as the round's `payout`. |
| `profit` | [`SignedAmount`](#signedamount) | yes | `payout − stake`. |
| `capped` | `boolean` | yes | The profit was cut to `max_profit` at settlement. |
| `game_result` | `object` | yes | The source's `bets.game_result` (`DrillEngine::gameResult`). |

### `CasesParams`

CASES's params. `difficulty` is exactly `EASY`, `MEDIUM`, `HARD` or `EXPERT`, with no trimming and no other case, and picks the table. Anything else, a missing key or an unknown one, is refused with `422 invalid_input` before anything is drawn. A win's profit is cut to the round's `max_profit` at settlement (`cap_rule: truncate`). The settled round's `view` is a `CasesView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |

### `CasesView`

The `view` of a settled CASES round (`Round.view`; the game specification). `word`, the stream's first word, picks the `bucket` of the difficulty's table, and so its `multiplier` and `tier`; `strip` is the cosmetic strip of 49 buckets the client spins, drawn from the next `strip_floats_used` words. `win` is a multiplier above `1.00`. `payout` is `⌊stake × multiplier⌋` at the currency's scale, cut to `stake + max_profit` when `capped`, and equals the round's `payout`; `profit` is `payout − stake`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |
| `table_version` | `integer` | yes | const: `1` |
| `bucket` | `integer` | yes | min: `0`; The bucket drawn, an index into the difficulty's table. |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `tier` | `string` | yes | enum: `grey`, `light-blue`, `blue`, `green`, `red`, `purple`, `gold` |
| `word` | `integer` | yes | min: `0`; max: `4294967295` |
| `strip` | `array<integer>` | yes | minItems: `49`; maxItems: `49` |
| `strip_floats_used` | `integer` | yes | min: `0` |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |

### `TarotParams`

TAROT's params. `difficulty` is exactly `EASY`, `MEDIUM`, `HARD` or `EXPERT`, with no trimming and no other case. Anything else, a missing key or an unknown one, is refused with `422 invalid_input` before anything is drawn. A win's profit is cut to the round's `max_profit` at settlement (`cap_rule: truncate`). The settled round's `view` is a `TarotView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |

### `TarotCard`

One of TAROT's three cards, its entry in the card's table, the face shown and its multiplier.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `index` | `integer` | yes | min: `0` |
| `face` | `integer` | yes | min: `0` |
| `mult` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |

### `TarotView`

The `view` of a settled TAROT round (`Round.view`; the game specification). The middle (`m`), left (`l`) and right (`r`) cards are drawn from `words`; `ended_at` names the card that ended the reading, or is `null`. `payout_multiplier` is what the reading pays. `payout` is `⌊stake × payout_multiplier⌋` at the currency's scale, cut to `stake + max_profit` when `capped`, and equals the round's `payout`; `profit` is `payout − stake`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |
| `table_version` | `integer` | yes | const: `1` |
| `words` | `array<integer>` | yes | minItems: `3`; maxItems: `3` |
| `m` | [`TarotCard`](#tarotcard) | yes | — |
| `l` | [`TarotCard`](#tarotcard) | yes | — |
| `r` | [`TarotCard`](#tarotcard) | yes | — |
| `ended_at` | `string | null` | yes | enum: `m`, `l`, `r`, `null` |
| `payout_multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |

### `SlideParams`

SLIDE's params. `target` is the target multiplier as a decimal string, `1.01` to `1000000.00`, with at most 2 decimals and no leading zero. Anything else, a JSON number, a missing key or an unknown one, is refused with `422 invalid_input` before anything is drawn. A win's profit is cut to the round's `max_profit` at settlement (`cap_rule: truncate`). The settled round's `view` is a `SlideView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `target` | `string` | yes | pattern: `^(1\.(0[1-9]\|[1-9][0-9]?)\|([2-9]\|[1-9][0-9]{1,5})(\.[0-9]{1,2})?\|1000000(\.0{1,2})?)$`; The target multiplier, `1.01` to `1000000.00`, at most 2 decimals. |

### `SlideView`

The `view` of a settled SLIDE round (`Round.view`; the game specification). `word`, the stream's first word, draws the reel's `stop` (`float` is that draw as the source's decimal); the bet wins when `stop` reaches `target`, and then `multiplier` is `target`, else `0.00`. `strip` is the cosmetic reel of 39 cards, `strip_before` of them before the stop. `payout` is `⌊stake × multiplier⌋` at the currency's scale, cut to `stake + max_profit` when `capped`, and equals the round's `payout`; `profit` is `payout − stake`. `game_result` is the source's `bets.game_result`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `target` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `stop` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `float` | `string` | yes | pattern: `^0(\.[0-9]+)?$`; The draw, `word / 2^32`, as an exact decimal string. |
| `word` | `integer` | yes | min: `0`; max: `4294967295` |
| `strip` | `array<string>` | yes | minItems: `39`; maxItems: `39` |
| `strip_before` | `integer` | yes | const: `32` |
| `strip_floats_used` | `integer` | yes | min: `0` |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |
| `game_result` | `object` | yes | The source's `bets.game_result` (`SlideEngine::gameResult`). |

### `BarsView`

The `view` of a settled BARS round (`Round.view`; the game specification). Each of the 30 bars gets a multiplier drawn from its word (`bars`, `words`); the bet pays the average of the picked bars, `payout_multiplier`, and `sum` is their sum. `win` is a multiplier above `1.00`. `payout` is `⌊stake × payout_multiplier⌋` at the currency's scale, cut to `stake + max_profit` when `profit_capped`, and equals the round's `payout`; `profit` is `payout − stake`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |
| `table_version` | `integer` | yes | const: `1` |
| `picks` | `array<integer>` | yes | minItems: `1`; maxItems: `5` |
| `bars` | `array<string>` | yes | minItems: `30`; maxItems: `30` |
| `words` | `array<integer>` | yes | minItems: `30`; maxItems: `30` |
| `sum` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `payout_multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `profit_capped` | `boolean` | yes | The profit was cut to `max_profit` at settlement. |

### `DartsParams`

DARTS's params. `difficulty` is exactly `EASY`, `MEDIUM`, `HARD` or `EXPERT`, with no trimming and no other case, and picks the board. Anything else, a missing key or an unknown one, is refused with `422 invalid_input` before anything is drawn. A win's profit is cut to the round's `max_profit` at settlement (`cap_rule: truncate`). The settled round's `view` is a `DartsView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |

### `DartsView`

The `view` of a settled DARTS round (`Round.view`; the game specification). The dart lands at `angle_deg` and `radius_ratio`, drawn from `u0` and `u1` (`rejected` lists any redrawn angle draws), in `zone` and, in a wedge, on `wedge` at `level`, which give `multiplier` and `tier`. `win` is a multiplier above `1.00` and `push` exactly `1.00`. `payout` is `⌊stake × multiplier⌋` at the currency's scale, cut to `stake + max_profit` when `capped`, and equals the round's `payout`; `profit` is `payout − stake`. `game_result` is the source's `bets.game_result`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |
| `table_version` | `integer` | yes | const: `1` |
| `zone` | `string` | yes | enum: `bull`, `inner`, `wedge`, `outer` |
| `wedge` | `integer | null` | yes | min: `0`; The wedge hit, or `null` outside the wedges. |
| `level` | `integer | null` | yes | min: `0`; The wedge's level, or `null` outside the wedges. |
| `tier` | `string` | yes | enum: `gold`, `purple`, `red`, `orange`, `amber`, `green`, `blue`, `light-blue`, `grey` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `u0` | `integer` | yes | min: `0`; max: `4294967295` |
| `u1` | `integer` | yes | min: `0`; max: `4294967295` |
| `angle_deg` | `string` | yes | pattern: `^(0\|[1-9][0-9]{0,2})\.[0-9]{10}$` |
| `radius_ratio` | `string` | yes | pattern: `^[01]\.[0-9]{10}$` |
| `angle_float` | `integer` | yes | min: `0` |
| `rejected` | `array<integer>` | yes | — |
| `win` | `boolean` | yes | — |
| `push` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |
| `game_result` | `object` | yes | The source's `bets.game_result` (`DartsEngine::gameResult`). |

### `KaboomParams`

KABOOM's params. `charge` is exactly `POP`, `BANG` or `KABOOM`. `spot` is the cell of the 48-cell quarry the charge is planted on, `0` to `47`, as a plain JSON integer or its digit string with no leading zero; absent or `null`, it is `27`. Anything else, a missing `charge` or an unknown key, is refused with `422 invalid_input` before anything is drawn. A round whose top prize could pay more than the round's `max_profit` is refused at open (`cap_rule: refuse`). The settled round's `view` is a `KaboomView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `charge` | `string` | yes | enum: `POP`, `BANG`, `KABOOM` |
| `spot` | `integer` \| `string` \| `null` | no | The cell, a plain JSON integer or its digit string, or `null` for the default 27. |

### `KaboomCell`

One revealed cell of a KABOOM round, in reveal order.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `pos` | `integer` | yes | min: `0`; max: `47` |
| `by` | `integer | null` | yes | min: `0`; max: `47`; The cell whose blast revealed this one, or `null` for the charge's own reveals. |
| `u` | `integer` | yes | min: `0`; max: `4294967295` |
| `entry` | `integer` | yes | min: `0` |
| `kind` | `string` | yes | — |
| `cents` | `integer` | yes | min: `0` |
| `claims` | `array<integer>` | no | — |
| `total` | `integer` | yes | min: `0`; The running total, in hundredths of the stake. |

### `KaboomRound`

A KABOOM round's record (the round record, the game specification); `game_result` is this object as JSON text.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `version` | `integer` | yes | const: `1` |
| `table_version` | `integer` | yes | const: `1` |
| `charge` | `string` | yes | enum: `POP`, `BANG`, `KABOOM` |
| `spot` | `integer` | yes | min: `0`; max: `47` |
| `cells` | array<[`KaboomCell`](#kaboomcell)> | yes | — |
| `revealed` | `integer` | yes | min: `0` |
| `tnt` | `integer` | yes | min: `0` |
| `lode` | `boolean` | yes | — |
| `lode_at` | `integer | null` | yes | min: `0`; max: `47` |
| `spent_lodes` | `integer` | yes | min: `0` |
| `gem_cents` | `integer` | yes | min: `0` |
| `total_cents` | `integer` | yes | min: `0` |
| `max_win_cents` | `integer` | yes | min: `0` |
| `capped` | `boolean` | yes | — |
| `cents` | `integer` | yes | min: `0` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `floats_used` | `integer` | yes | min: `0` |

### `KaboomView`

The `view` of a settled KABOOM round (`Round.view`; the game specification). `round` is the round's record, and `multiplier` its total, cut to `max_multiplier` (`max_win`). `win` is a multiplier above `1.00`. `payout` is `⌊stake × multiplier⌋` at the currency's scale and equals the round's `payout`; `profit` is `payout − stake`. `game_result` is the source's `bets.game_result`, `round` as JSON text.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `charge` | `string` | yes | enum: `POP`, `BANG`, `KABOOM` |
| `spot` | `integer` | yes | min: `0`; max: `47` |
| `table_version` | `integer` | yes | const: `1` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `max_win` | `boolean` | yes | — |
| `max_multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `round` | [`KaboomRound`](#kaboomround) | yes | — |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `profit_capped` | `boolean` | yes | — |
| `game_result` | `string` | yes | The source's `bets.game_result`, `round` as JSON text. |

### `TiltParams`

TILT's params. `notch` is exactly `SOFT`, `FIRM`, `FULL` or `MAX`, the plunger's notch. Anything else, a missing key or an unknown one, is refused with `422 invalid_input` before anything is drawn. A round whose top prize could pay more than the round's `max_profit` is refused at open (`cap_rule: refuse`). The settled round's `view` is a `TiltView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `notch` | `string` | yes | enum: `SOFT`, `FIRM`, `FULL`, `MAX` |

### `TiltBall`

One ball of a TILT round.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `ball` | `integer` | yes | min: `0` |
| `lane` | `integer` | yes | min: `0` |
| `hits` | `array<integer>` | yes | — |
| `points` | `array<string>` | yes | — |
| `score` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `lock` | `boolean` | no | — |
| `ramp` | `integer` | yes | min: `0` |
| `ramp_factor` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `hole` | `integer` | yes | min: `0` |
| `hole_factor` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `payout` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `draws` | `array<integer>` | yes | minItems: `2`; maxItems: `2` |

### `TiltRound`

A TILT round's record (the round record, the game specification); `game_result` is this object as JSON text.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `v` | `integer` | yes | const: `1` |
| `notch` | `string` | yes | enum: `SOFT`, `FIRM`, `FULL`, `MAX` |
| `table_version` | `integer` | yes | const: `2` |
| `balls` | array<[`TiltBall`](#tiltball)> | yes | minItems: `1` |
| `multiball` | `boolean` | yes | — |
| `total` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `capped` | `boolean` | yes | — |
| `cap` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `u` | `array<integer>` | yes | — |
| `payout_multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |

### `TiltView`

The `view` of a settled TILT round (`Round.view`; the game specification). `round` is the round's record, and `multiplier` its payout multiplier, cut to `max_multiplier` (`capped`). `win` is a multiplier above `1.00`. `payout` is `⌊stake × multiplier⌋` at the currency's scale and equals the round's `payout`; `profit` is `payout − stake`. `game_result` is the source's `bets.game_result`, `round` as JSON text.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `notch` | `string` | yes | enum: `SOFT`, `FIRM`, `FULL`, `MAX` |
| `table_version` | `integer` | yes | const: `2` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `capped` | `boolean` | yes | The multiplier was cut to `max_multiplier`. |
| `max_multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `round` | [`TiltRound`](#tiltround) | yes | — |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `profit_capped` | `boolean` | yes | — |
| `game_result` | `string` | yes | The source's `bets.game_result`, `round` as JSON text. |

### `SlotParams`

The params of the slots GRIMOIRE (`grimoire-of-gains`), PHARAOH (`pharaoh-pump`) and SHOGUN (`shogun-shiba`) (the game specification, the game specification, the game specification): **none**. One request spins the base game and every free spin it wins, and nothing the player sends changes the spin, so `params` is the empty object `{}`. Any key, and a value that is not an object (`null`, `[]`), is refused with `422 invalid_input` before anything is drawn. A win's profit is cut to the round's `max_profit` at settlement (`cap_rule: truncate`). The settled round's `view` is a `SlotView`.

- **Type:** `object`

### `SlotView`

The `view` of a settled GRIMOIRE, PHARAOH or SHOGUN round (`Round.view`; `the specification` and each game's). `round` is the spin's record, and `multiplier` its total, cut to the theme's maximum win (`max_win`, `capped`). `free_spins_played` counts the free spins it won. `win` is a multiplier above `1.00`. `payout` is `⌊stake × multiplier⌋` at the currency's scale, cut to `stake + max_profit` when `profit_capped`, and equals the round's `payout`; `profit` is `payout − stake`. `game_result` is the source's `bets.game_result`, `round` as JSON text (its compact form, or PHARAOH's minimal form, past 60,000 bytes).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `version` | `integer` | yes | const: `1` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `win` | `boolean` | yes | — |
| `max_win` | `boolean` | yes | The spin reached the theme's maximum win. |
| `profit_capped` | `boolean` | yes | The profit was cut to `max_profit` at settlement. |
| `capped` | `boolean` | yes | The multiplier was cut to the theme's maximum win. |
| `free_spins_played` | `integer` | yes | min: `0` |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `round` | `object` | yes | The spin's record (`fp-originals-slot/1`, full form): the base spin and its free spins (`SlotSpin`, each with the theme's own keys, such as PHARAOH's `random_wilds` and `meter`) and the free spins won (`SlotFreeSpins`). `game_result` is this object as JSON text while it fits 60,000 bytes. |
| `game_result` | `string` | yes | The source's `bets.game_result`, `round` as JSON text, or its compact form (PHARAOH's minimal form) when that passes 60,000 bytes. |

### `SlotSpin`

One spin of a slot round's record (`SlotView.round.spins`, the full form). `floats` is the spin's first stream position and how many floats it read, `rejected` the positions it drew again, `stops` the reel stops, and `grid` the symbols each reel shows, top to bottom, reels separated by `|`. `steps` are the evaluation steps, one per cascade: `wins` are line wins `[line, symbol, count, wild, cents]` (GRIMOIRE) or ways wins `[symbol, count, ways, wild ways, cents]` (PHARAOH, SHOGUN). Theme keys: PHARAOH's `meter` (the cascade meter before and after the spin) and each step's `removed` cells and `grid_after`; GRIMOIRE's `expanding` (a free spin's spell); PHARAOH's and SHOGUN's `random_wilds`; SHOGUN's `hold` (hold-and-spin). `awarded` is the free spins this spin won. `cents`, `win_cents` and `scatter_cents` are in cents of the bet.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `mode` | `string` | yes | enum: `base`, `free` |
| `floats` | [`SlotFloats`](#slotfloats) | yes | — |
| `rejected` | [`SlotPositions`](#slotpositions) | yes | — |
| `stops` | `array<integer>` | yes | minItems: `1` |
| `grid` | `string` | yes | pattern: `^[A-Za-z0-9]+(\\|[A-Za-z0-9]+)*$` |
| `steps` | array<[`SlotStep`](#slotstep)> | yes | — |
| `meter` | `array<integer>` | no | minItems: `2`; maxItems: `2`; PHARAOH's cascade meter before and after the spin. |
| `expanding` | `object` | no | GRIMOIRE's expanding spell on a free spin. |
| `random_wilds` | `object` | no | PHARAOH's and SHOGUN's random wilds draw; `pattern` is the drawn pattern, or `null` when not triggered. |
| `scatters` | `integer` | yes | min: `0` |
| `multiplier` | `integer` | yes | min: `0` |
| `win_cents` | `integer` | yes | min: `0` |
| `scatter_cents` | `integer` | yes | min: `0` |
| `cents` | `integer` | yes | min: `0` |
| `awarded` | `integer` | no | min: `1`; The free spins this spin won. |
| `hold` | `object` | no | SHOGUN's hold-and-spin: the coins it started with (`[cell, cents]`), what each respin landed, whether the grid filled, and its cents. |

### `SlotStep`

One evaluation step of a slot spin (`SlotSpin.steps`); PHARAOH's cascade steps add `removed` and `grid_after`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `wins` | `array<array<integer | string>>` | yes | — |
| `meter` | `integer` | yes | min: `0` |
| `cents` | `integer` | yes | min: `0` |
| `removed` | `array<integer>` | no | — |
| `grid_after` | `string` | no | pattern: `^[A-Za-z0-9]+(\\|[A-Za-z0-9]+)*$` |

### `SlotFreeSpins`

The free spins a slot round won (`SlotView.round.free_spins`): how many were awarded, played and retriggered, their multiplier, and GRIMOIRE's spell symbol with the floats that drew it (`spell` is `null` for PHARAOH and SHOGUN).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `awarded` | `integer` | yes | min: `0` |
| `played` | `integer` | yes | min: `0` |
| `retriggers` | `integer` | yes | min: `0` |
| `multiplier` | `integer` | yes | min: `0` |
| `spell` | `string | null` | yes | minLength: `1` |
| `spell_floats` | [`SlotFloats`](#slotfloats) | no | — |
| `spell_rejected` | [`SlotPositions`](#slotpositions) | no | — |

### `SlotFloats`

A slot draw's first stream position and how many floats it read.

- **Type:** `array<integer>`
- **Constraints:** minItems: `2`; maxItems: `2`

### `SlotPositions`

The stream positions a slot draw refused and drew again.

- **Type:** `array<integer>`

### `SlotCoin`

A hold-and-spin coin, `[cell, cents]`.

- **Type:** `array<integer>`
- **Constraints:** minItems: `2`; maxItems: `2`

### `FlipParams`

FLIP's opening params. `call` is exactly `HEADS` or `TAILS`, the first call. `flips` is optional: absent or `0`, the round is **manual** and the player flips coin by coin (`FlipAction`); `N` (1 to 20, a plain JSON integer) is **auto mode**, which flips N coins in the opening request with the calls `pattern` plans (`FIXED` repeats `call`, `ALTERNATE` switches every flip) and cashes out after the Nth, unless a coin is lost first. `pattern` is required in auto mode and refused in manual mode. Anything else, a missing `call` or an unknown key, is refused with `422 invalid_input` before anything is drawn. A win's profit is cut to the round's `max_profit` (`cap_rule: truncate`). The settled round's `view` is a `FlipView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `call` | `string` | yes | enum: `HEADS`, `TAILS` |
| `flips` | `integer` | no | min: `0`; max: `20` |
| `pattern` | `string` | no | enum: `FIXED`, `ALTERNATE` |

### `FlipAction`

One move on an open manual FLIP round: `flip` the next coin on `call` (`HEADS` or `TAILS`), or `cashout` at the current multiplier. Any other move or argument is refused with `422 invalid_action`.

- **Type:** `object | object`

- **`oneOf[0]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"flip"` |
| `call` | `string` | yes | enum: `HEADS`, `TAILS` |

- **`oneOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"` |

### `FlipView`

The `view` of a settled FLIP round (`Round.view`; the game specification). `status` is `CASHED_OUT` (manual cash-out, auto target, top flip 20, max-profit stop or Rule 1 force-close) or `BUSTED`. `calls` and `results` hold each flip's side (`H` or `T`) in order, and `flips` counts the winning flips. `payout` is `⌊stake × multiplier⌋` at the currency's scale, cut to `stake + max_profit` when `max_profit_hit`, and equals the round's `payout`; `profit` is `payout − stake`. Auto rounds carry `pattern` and `target`; a platform Rule 1 force-close carries `ended_by`, `rule`, `v_star` and `v_star_minus_f`. `game_result` is the source's `bets.game_result` (`v: 1`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED` |
| `mode` | `string` | yes | enum: `manual`, `auto` |
| `flips` | `integer` | yes | min: `0`; max: `20`; Number of correct flips won before settlement. |
| `max_flips` | `integer` | yes | const: `20` |
| `calls` | `array<string>` | yes | minItems: `1`; maxItems: `20` |
| `results` | `array<string>` | yes | minItems: `1`; maxItems: `20` |
| `floats_used` | `integer` | yes | min: `1`; max: `20` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*\.[0-9]{2})$`; Ladder multiplier on `CASHED_OUT` (`1.90` to `996147.20`), or `"0"` on `BUSTED`. |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `cashed_at` | `integer | null` | yes | min: `1`; max: `20`; Winning flip count on `CASHED_OUT`, or `null` on `BUSTED`. |
| `auto_cashout` | `string | null` | yes | enum: `TOP`, `MAX_PROFIT`, `null` |
| `max_profit_hit` | `boolean` | yes | — |
| `pattern` | `string` | no | enum: `FIXED`, `ALTERNATE`; Auto-mode call pattern (present only when `mode` is `auto`). |
| `target` | `integer` | no | min: `1`; max: `20`; Auto-mode target flip count (present only when `mode` is `auto`). |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"`; Present on a platform Rule 1 force-close. |
| `rule` | `integer` | no | const: `1`; Force-close rule applied (`1` on Rule 1 cash-out). |
| `v_star` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$`; Exact Bellman continuation value as a reduced rational `num/den` on force-close. |
| `v_star_minus_f` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$`; Exact gap `V* − F` as a reduced rational `num/den` on force-close. |
| `game_result` | `object` \| `object` | yes | The source's `bets.game_result` (`v: 1`), manual or auto shape. |

### `SnakesParams`

SNAKES's opening params. `difficulty` is `EASY`, `MEDIUM`, `HARD`, `EXPERT` or `MASTER`, read as the source reads it: spaces around it are trimmed and ASCII letters folded to upper case (`" easy "` is `EASY`). Anything else, a missing key or an unknown one, is refused with `422 invalid_input` before anything is drawn. The round opens at round 0 and the player rolls (`SnakesAction`). A win's profit is cut to the round's `max_profit` (`cap_rule: truncate`). The settled round's `view` is a `SnakesView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | pattern: `^ *([Ee][Aa][Ss][Yy]\|[Mm][Ee][Dd][Ii][Uu][Mm]\|[Hh][Aa][Rr][Dd]\|[Ee][Xx][Pp][Ee][Rr][Tt]\|[Mm][Aa][Ss][Tt][Ee][Rr]) *$` |

### `SnakesAction`

One move on an open SNAKES round: `roll` the two dice, or `cashout` at the current multiplier (refused before the first roll). Any other move is refused with `422 invalid_action`.

- **Type:** `object | object`

- **`oneOf[0]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"roll"` |

- **`oneOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"` |

### `SnakesRoll`

One dice roll in a SNAKES round (`SnakesView.rolls`; the game specification).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `round` | `integer` | yes | min: `1`; max: `5` |
| `dice1` | `integer` | yes | min: `1`; max: `6` |
| `dice2` | `integer` | yes | min: `1`; max: `6` |
| `sum` | `integer` | yes | min: `2`; max: `12` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$`; Square multiplier for `sum` on this roll (`0.00` on a snake). |

### `SnakesGameResult`

The source's `bets.game_result` for a played SNAKES round.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED` |
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT`, `MASTER` |
| `rolls` | `array<object>` | yes | minItems: `1`; maxItems: `5` |
| `multiplier` | `string` | yes | pattern: `^(0\|(0\|[1-9][0-9]*)\.[0-9]{2,10})$` |

### `SnakesView`

The `view` of a settled SNAKES round (`Round.view`; the game specification). `status` is `CASHED_OUT` (manual cash-out, 5th safe roll auto-cashout or Rule 1 force-close), `BUSTED` (snake square) or `REFUNDED` (Rule 2 force-close before roll 1). A settlement triggered by a roll (`BUSTED` or roll 5) includes the latest roll's `round`, `dice1`, `dice2`, `sum` and `multiplier`. `payout` is the credit and equals the round's `payout`; `profit` is `payout − stake`. `game_result` is a `SnakesGameResult` on `CASHED_OUT`/`BUSTED`, or `null` on `REFUNDED`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED`, `REFUNDED` |
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT`, `MASTER` |
| `nonce` | `integer` | yes | min: `0` |
| `round` | `integer` | no | min: `1`; max: `5`; Latest roll index when settled directly by a roll (`BUSTED` or roll 5 auto-cashout). |
| `dice1` | `integer` | no | min: `1`; max: `6` |
| `dice2` | `integer` | no | min: `1`; max: `6` |
| `sum` | `integer` | no | min: `2`; max: `12` |
| `multiplier` | `string` | no | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$`; Latest roll's square multiplier when settled directly by a roll. |
| `current_round` | `integer` | yes | min: `0`; max: `5` |
| `current_multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2,10}$`; Running multiplier (`0.00` on `BUSTED`, `1.00` on `REFUNDED`, else exact product trimmed to 2..10 decimals). |
| `rolls` | array<[`SnakesRoll`](#snakesroll)> | yes | minItems: `0`; maxItems: `5` |
| `final_multiplier` | `string` | no | pattern: `^(0\|(0\|[1-9][0-9]*)\.[0-9]{2,10})$`; `0` on `BUSTED`, or the exact running multiplier on `CASHED_OUT` (omitted on `REFUNDED`). |
| `win` | `boolean` | no | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `refund` | [`Amount`](#amount) | no | Full stake refunded on a Rule 2 force-close (`REFUNDED`). |
| `auto_cashout` | `boolean` | no | True on 5th-roll automatic cash-out, false on manual cash-out or bust, omitted on force-close. |
| `max_profit_hit` | `boolean` | no | — |
| `floats_used` | `integer` | yes | enum: `0`, `2`, `10`, `18`, `26`, `34` |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"` |
| `rule` | `integer` | no | enum: `1`, `2` |
| `v_star` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `v_star_minus_f` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `game_result` | [`SnakesGameResult`](#snakesgameresult) \| `null` | yes | The source's `bets.game_result`, or `null` on `REFUNDED`. |

### `DeadshotParams`

DEADSHOT's opening params. `herd` is `LOW`, `MEDIUM` or `HIGH`, read as the source reads it: ASCII blanks around it are trimmed and ASCII letters folded to upper case. `bullets` is the magazine, `1` to `100`, as a plain JSON integer or its digit string with no leading zero; each bullet costs `stake / bullets`, so a stake that does not split into equal bullets at the currency's scale is refused too. Anything else, a missing key or an unknown one, is refused with `422 invalid_input` before anything is drawn. The round opens with a loaded magazine (`DeadshotAction`). A shot that could pay more than the round's `max_profit` is refused (`cap_rule: refuse`). The settled round's `view` is a `DeadshotView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `herd` | `string` | yes | pattern: `^[\t\n\r\x00\x0b ]*([Ll][Oo][Ww]\|[Mm][Ee][Dd][Ii][Uu][Mm]\|[Hh][Ii][Gg][Hh])[\t\n\r\x00\x0b ]*$` |
| `bullets` | `integer` \| `string` | yes | The magazine's size, a plain JSON integer or its digit string. |

### `DeadshotAction`

One move on an open DEADSHOT round: `fire` `count` bullets (1 to 10, a plain JSON integer or its digit string; absent or `null`, 1), each at a drawn zombie or, with `aim`, at the zombie its letter names (`w`, `r`, `b`, `t` or `m`, one letter per bullet, so `aim` has exactly `count` letters); or `stop`, which settles the round and refunds the bullets not fired. `stop` takes no `count` or `aim`. Anything else is refused with `422 invalid_action`.

- **Type:** `object | object`

- **`oneOf[0]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"fire"` |
| `count` | `integer` \| `string` \| `null` | no | — |
| `aim` | `string | null` | no | pattern: `^[wrbtm]{1,10}$` |

- **`oneOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"stop"` |

### `DeadshotShot`

One resolved bullet in a DEADSHOT magazine (`DeadshotView.shots` and `new_shots`; the game specification).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `i` | `integer` | yes | min: `0`; max: `99` |
| `type` | `string` | yes | enum: `walker`, `runner`, `brute`, `tank`, `mega` |
| `tag` | `string` | yes | pattern: `^[1-9][0-9]*\.[0-9]{2}$`; Target zombie's tag multiplier with 2 decimals. |
| `aimed` | `boolean` | yes | — |
| `kill` | `boolean` | yes | — |
| `return` | [`Amount`](#amount) | yes | Bullet return (`0` on a miss, `⌊bullet × tag⌋` on a kill). |

### `DeadshotView`

The `view` of a settled DEADSHOT round (`Round.view`; the game specification). `status` is `FINISHED` (all bullets fired), `STOPPED` (stopped early or Rule 1 force-close after firing at least one bullet) or `REFUNDED` (Rule 2 force-close at 0 fired bullets). `credit` (`total_return + refund`) equals the round's `payout`, while `payout` is the fired-stake return ratio (`total_return / fired_stake` rounded up to 2..20 decimals, `"1"` on Rule 2 force-close, or `null` when stopped at 0 fired bullets); `profit` is `total_return − fired_stake` (= `credit − bet_amt`). `game_result` is the compact JSON text stored in `bets.game_result` (`v: 2` drawn, `v: 3` aimed), or `null` when `fired` is 0.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `FINISHED`, `STOPPED`, `REFUNDED` |
| `herd` | `string` | yes | enum: `LOW`, `MEDIUM`, `HIGH` |
| `bet_amt` | [`Amount`](#amount) | yes | — |
| `bullet` | [`Amount`](#amount) | yes | — |
| `bullets` | `integer` | yes | min: `1`; max: `100` |
| `fired` | `integer` | yes | min: `0`; max: `100` |
| `remaining` | `integer` | yes | min: `0`; max: `100` |
| `kills` | `integer` | yes | min: `0`; max: `100` |
| `total_return` | [`Amount`](#amount) | yes | — |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$`; `⌊100 × total_return / bet_amt⌋ / 100`, with 2 decimals. |
| `shots` | array<[`DeadshotShot`](#deadshotshot)> | yes | minItems: `0`; maxItems: `100` |
| `new_shots` | array<[`DeadshotShot`](#deadshotshot)> | yes | minItems: `0`; maxItems: `10` |
| `fired_stake` | [`Amount`](#amount) | yes | — |
| `refund` | [`Amount`](#amount) | yes | — |
| `credit` | [`Amount`](#amount) | yes | `total_return + refund`, matching the round's `payout`. |
| `payout` | `string | null` | yes | pattern: `^(1\|(0\|[1-9][0-9]*)\.[0-9]{2,20})$`; Fired-stake payout ratio (`ceil(total_return / fired_stake)` at 2..20 decimals), `"1"` on Rule 2 force-close, or `null` on a zero-shot stop. |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `result` | `string` | yes | enum: `win`, `push`, `loss` |
| `win` | `boolean | null` | yes | — |
| `floats_used` | `integer` | yes | min: `0`; max: `200` |
| `acceptable_payout` | `boolean | null` | yes | — |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"` |
| `rule` | `integer` | no | enum: `1`, `2` |
| `f_value` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `v_star` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `delta` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `game_result` | `string | null` | yes | pattern: `^\{"v":[23],"herd":"(LOW\|MEDIUM\|HIGH)",.*\}$`; The source's compact `bets.game_result` JSON text (`v: 2` drawn, `v: 3` aimed), or `null` when `fired` is 0. |

### `VideopokerParams`

VIDEOPOKER's opening params: **none**. The open shuffles the deck and deals five cards, and nothing the player sends changes the deal, so `params` is the empty object `{}`. Any key, and a value that is not an object (`null`, `[]`), is refused with `422 invalid_input` before anything is drawn. The round opens on the dealt hand, and the player draws once (`VideopokerAction`). A win's profit is cut to the round's `max_profit` (`cap_rule: truncate`).

- **Type:** `object`

### `VideopokerAction`

The one move on an open VIDEOPOKER round: `draw`, with `holds` exactly five JSON booleans, one per dealt card in order, `true` to keep the card. The cards not held are replaced from the deck and the round settles on the final hand. Anything else is refused with `422 invalid_action` and the round stays open: no `holds`, 4 or 6 items, `1` and `0`, `"true"`, `null`, an object (the source's `{"0": true, …}` included), another move or another key.

`{"do": "force_close"}` is VIDEOPOKER's force-close action: it draws with the hold of the best expected return for the dealt cards. It is the platform's, sent by `POST /v1/players/{player_ref}/force-close` and the inactivity force-close, and **not a player move**: the actions routes refuse it with `422 invalid_action`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"draw"` |
| `holds` | `array<boolean>` | yes | minItems: `5`; maxItems: `5`; Which dealt cards to keep, in the order they were dealt. |

### `StackpacksParams`

STACKPACKS's opening params. `risk` is the devil's odds on each pack, 1 in `9`, `5` or `3`, as a plain JSON integer: `"5"`, `5.0`, `5e0`, `true`, `[5]` and `null` are refused. Anything else, a missing key or an unknown one, is refused with `422 invalid_input` before anything is drawn. A stake whose first pack could pay more than the round's `max_profit` is refused with `422 max_stake` (`cap_rule: refuse`). The round opens with no pack opened (`StackpacksAction`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `risk` | `integer` | yes | enum: `9`, `5`, `3` |

### `StackpacksAction`

One move on an open STACKPACKS round. Each move may carry `drawn`, the number of packs the client last saw: absent or `null`, it is not checked; a JSON integer `>= 0` other than the round's count of opened packs is refused with `409 closed` and nothing moves, so a retried move never opens a pack the player did not see. A `drawn` that is not a JSON integer `>= 0` (`"0"`, `0.0`, `true`, `[0]`, `-1`) is refused with `422 invalid_input`, and any other move or key with `422 invalid_action`.

- `draw` opens the next pack: the devil busts the round, which pays 0; otherwise the pack multiplies the stack. A draw the hand no longer offers (its 40th pack opened, the next card could pass the 10000.00x ceiling, or the round's `max_profit`; the view's `draw_block`) is refused with `409 not_offered`, and the player cashes out.
- `cashout` settles at the stack. Before the first safe pack it is `422 invalid_action` from the engine, and the round stays open.
- `{"do": "force_close"}` is STACKPACKS's force-close action: a full refund before the first pack, a cash-out at the stack after it. It is the platform's, sent by `POST /v1/players/{player_ref}/force-close` and the inactivity force-close, and **not a player move**: the actions routes refuse it with `422 invalid_action`.

---

- **Type:** `object | object`

- **`oneOf[0]`** — Open the next pack.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"draw"` |
| `drawn` | `integer | null` | no | min: `0`; The number of packs the client last saw, or absent or `null` to leave it unchecked. |

- **`oneOf[1]`** — Cash out at the stack.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"` |
| `drawn` | `integer | null` | no | min: `0`; The number of packs the client last saw, checked as on `draw`. |

### `KombatParams`

KOMBAT's opening params, each read as written. Anything else, a missing key or an unknown one, is refused with `422 invalid_input` before anything is drawn.

- `rung` is the opponent, `1` to `6`, and `duration` the round's length in seconds, `15`, `20`, `25`, `30`, `35`, `40` or `45`, each a plain JSON integer (`"1"`, `1.0`, `true` are refused).
- `fighter` is `doge`, `wojak` or `cat`. It is cosmetic: the fight never reads it.
- `bets` is the slip, an object keyed by `win`, `flawless`, `quick_ko` and `comeback`, each an `Amount` at the currency's scale. A zero bet is left out, and at least one bet is above zero. **The bets sum to the round's `stake` exactly** (`422 invalid_input` otherwise, which the schema cannot see), and each bet placed is within the stake limits (`422 stake_out_of_range`). The side bets `flawless`, `quick_ko` and `comeback` are offered against the first three opponents only, and not at every duration: one above zero where it is not offered is refused with `409 not_offered`.
- `mode` is `live`, which opens the fight at exchange 0 for the player to reveal (`KombatAction`), or `instant`, which fights it out and settles in the opening request.

A slip whose best case could pay more than the round's `max_profit` is refused with `422 max_stake` (`cap_rule: refuse`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `rung` | `integer` | yes | min: `1`; max: `6` |
| `fighter` | `string` | yes | enum: `doge`, `wojak`, `cat` |
| `duration` | `integer` | yes | enum: `15`, `20`, `25`, `30`, `35`, `40`, `45` |
| `bets` | `object` | yes | The slip, by bet. At least one bet is above zero, and the bets sum to the round's `stake`. |
| `mode` | `string` | yes | enum: `live`, `instant` |

### `KombatAction`

One move on an open live KOMBAT fight. An `instant` round settles when it opens, so it takes no move. Any other move or key is refused with `422 invalid_action`.

- `next` reveals the next exchange, and settles the round when the fight ends. `n`, optional, is the number of exchanges the client last saw: absent or `null`, it is not checked; a plain JSON integer other than the fight's count is refused with `409 closed`, and nothing is revealed. An `n` that is not a plain JSON integer `>= 0` (`"1"`, `1.0`, `-1`, `-0`) is `422 invalid_input`.
- `live_bet` bets `stake`, an `Amount` above zero, on `side` (`you` or `opp`) winning the fight from here, at `pay`, the multiplier the round's view quotes for that side now (`live`), with at most 2 decimals. The bet's stake is added to the round's, and in seamless mode it is debited before the bet is placed. A `side`, `stake` or `pay` of another form is `422 invalid_input`. A `pay` other than the quote is `409 odds_changed`, a side with no quote `409 not_offered`, and a 9th live bet `409 limit`. A stake under the minimum is `422 stake_out_of_range`, and one whose winnings could pass the round's `max_profit` is `422 max_stake` (`cap_rule: refuse`). `live_bet` takes no `n`.
- `{"do": "force_close"}` is KOMBAT's force-close action: before the first exchange, a full refund of the slip and of any live bets; after it, the rest of the fight revealed with no new bet. It is the platform's, sent by `POST /v1/players/{player_ref}/force-close` and the inactivity force-close, and **not a player move**: the actions routes refuse it with `422 invalid_action`.

---

- **Type:** `object | object`

- **`oneOf[0]`** — Reveal the next exchange.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"next"` |
| `n` | `integer | null` | no | min: `0`; max: `999999999`; The number of exchanges the client last saw, or absent or `null` to leave it unchecked. |

- **`oneOf[1]`** — Bet on a side winning the fight from here, at the quoted pay.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"live_bet"` |
| `side` | `string` | yes | enum: `you`, `opp` |
| `stake` | [`Amount`](#amount) | yes | — |
| `pay` | `string` | yes | pattern: `^(0\|[1-9][0-9]{0,6})(\.[0-9]{1,2})?$`; The multiplier the view quotes for `side` now, with at most 2 decimals. |

### `SignedAmount`

An `Amount` that may be negative, with a leading `-` (a round's `profit` on a loss or a partial return). Zero has no sign: `-0` and `-0.00` are not amounts.

- **Type:** `string`
- **Constraints:** pattern: `^-?(0|[1-9][0-9]{0,29})(\.[0-9]{1,18})?$`; maxLength: `49`

### `LimboTarget`

LIMBO's target multiplier: a decimal string from `1.01` to `1000000.00` with **at most 2 decimals** and no surrounding whitespace. A finer target is refused (`422 invalid_input`), never rounded: the source compares at 2 decimals but pays the full target, so `1.01999999` would win like `1.01` and pay 97.96 %. The pattern alone accepts values outside `1.01 … 1000000.00` (`1`, `1.00`, `1000000.01`), which strict raw-token validation and the engine refuse (`422 invalid_input`).

- **Type:** `string`
- **Constraints:** pattern: `^[1-9][0-9]*(\.[0-9]{1,2})?$`

### `LimboParams`

LIMBO's params (the game specification). The player picks a `target` multiplier from `1.01` to `1000000.00`, with at most 2 decimals (`LimboTarget`). Anything else — a JSON number (`{"target": 2.00}`), a third decimal (`"2.000"`, `"1.01999999"`), surrounding whitespace (`" 2.00"`, which the source's API trims and plays as `2.00`, non-canonical whitespace), a value outside `1.01 … 1000000.00` (`"1"`, `"1.00"`, `"1000000.01"`), or an unknown or repeated key — is refused with `422 invalid_input` before the engine runs, and the engine checks again (the engine).

Targets above `970000.00` up to `1000000.00` are accepted and can never win. The settled round's `view` is a `LimboView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `target` | [`LimboTarget`](#limbotarget) | yes | — |

### `PlinkoParams`

PLINKO's params (the game specification). `pins` is a **JSON integer** from 8 to 16, and `risk` is exactly `LOW`, `MEDIUM` or `HIGH`, with no trimming and no other case. Anything else is refused with `422 invalid_input` before the engine runs, and the engine checks again.

The source's controller trims, compares loosely and casts, so `"08"`, `"8.0"`, `" 16 "` and `"1e1"` (10 pins) play there. BetPlug refuses every string for `pins`. JSON Schema also counts the numbers `8.0` and `1e1` as integers, so the server reads each value as written and refuses them too. A key given twice is refused. The source names the risk `risk_multiplier`. PLINKO's round operations reference this schema.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `pins` | `integer` | yes | min: `8`; max: `16`; The number of pins, as a plain JSON integer (16, never the string "16", 16.0 or 1.6e1). |
| `risk` | `string` | yes | enum: `LOW`, `MEDIUM`, `HIGH`; The risk, which picks the paytable. Upper case, exactly as listed. |

### `RouletteParams`

ROULETTE's params (the game specification): a table of 1 to 64 chips. A table has 49 single bets, and the same one twice adds up. **The round's `stake` must equal the sum of the chips' stakes**, or the answer is `422 invalid_input`.

**No chip is ever skipped.** The source silently drops a slot it cannot read, so the client and the round disagree on what was bet. It also plays any `type` but `series` as a number, compares loosely (so `"1e0"` and `true` play 1, and `series: true` plays all-red), and truncates a stake. Here one bad chip refuses the whole table with `422 invalid_input`, before the engine runs, and the `detail` names its position. The engine checks again.

JSON Schema also counts the numbers `1.0` and `1e0` as integers, so the server reads each value as written and refuses them too. A key given twice is refused. The round record stores these chips, so a round can be verified from its record, which the source's cannot. ROULETTE's round operations reference this schema.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `chips` | array<[`RouletteChip`](#roulettechip)> | yes | minItems: `1`; maxItems: `64`; The table's chips, in any order. |

### `RouletteChip`

One chip, on a number or on a series. The `stake` is a positive `Amount`, never truncated.

- **Type:** `object | object`

- **`oneOf[0]`** — A chip on one pocket, which returns 36 times its stake.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `string` | yes | const: `"number"`; A number chip. |
| `number` | `integer` | yes | min: `0`; max: `36`; The pocket, as a plain JSON integer (17, never the string "17", 17.0 or 1.7e1). |
| `stake` | [`Amount`](#amount) | yes | — |

- **`oneOf[1]`** — A chip on a series, which returns 2 or 3 times its stake. Zero is in no series.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `string` | yes | const: `"series"`; A series chip. |
| `series` | `string` | yes | enum: `all-red`, `all-black`, `even`, `odd`, `first-12`, `second-12`, `third-12`, `first-row`, `second-row`, `third-row`, `1-18`, `19-36`; The series, exactly as listed. |
| `stake` | [`Amount`](#amount) | yes | — |

### `KenoParams`

KENO's params (the game specification). `risk` is exactly `CLASSIC`, `LOW`, `MEDIUM` or `HIGH`, with no trimming and no other case. `picks` is an array of 1 to 10 distinct numbers of the board, in any order. Anything else is refused with `422 invalid_input` before the engine runs, and the engine checks again.

The source reads these two exactly, but for one form: PHP decodes `{"0":3,"1":4}` to the list `[3, 4]`, which plays there. BetPlug refuses it.

JSON Schema also counts the numbers `1.0` and `1e0` as integers, so the server reads each value as written and refuses them too. A key given twice is refused. KENO's round operations reference this schema.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `risk` | `string` | yes | enum: `CLASSIC`, `LOW`, `MEDIUM`, `HIGH`; The risk, which picks the paytable. Upper case, exactly as listed. |
| `picks` | `array<integer>` | yes | minItems: `1`; maxItems: `10`; The numbers to play. Their order never matters. |

### `MinesParams`

MINES's opening params (the game specification). `mines` is a **JSON integer** from 1 to 24. With `tiles` the round is **instant play**, and settles in the opening request: 1 to 25 − `mines` distinct tiles, in the order to sweep them. Without it, the player sweeps tile by tile (`MinesAction`).

The source never checks the mine count, so `mines: 0` opens a round, debits the stake and can credit nothing. It also casts and compares loosely, so `"3e0"` plays 3, `[7]` plays 1, and `true` as a tile passes as tile 1 and then explodes on any mine above tile 0. BetPlug refuses all of it with `422 invalid_input` before the engine runs, and the engine checks again.

JSON Schema also counts the numbers `3.0` and `3e0` as integers, so the server reads each value as written and refuses them too. A key given twice is refused.

**Instant play at 12 mines and 11 tiles is `409 not_offered`.** The paytable has no multiplier at that point. The settled round's `view` is a `MinesView`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `mines` | `integer` | yes | min: `1`; max: `24`; The number of mines, which picks the paytable, as a plain JSON integer. |
| `tiles` | `array<integer>` | no | minItems: `1`; maxItems: `24`; Instant play's tiles. At most 25 − `mines` of them, which the server checks. |

### `MinesAction`

A move on an open MINES round. Anything else is `422 invalid_action`, read as written, as `MinesParams` is.

- A tile swept already, or a cash-out before any tile, is `422 invalid_action`.
- A cash-out at 12 mines and 11 tiles is `409 not_offered` (that point has no paytable multiplier). The player may sweep on.

---

- **Type:** `object | object`

- **`oneOf[0]`** — Sweep one tile.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"sweep"`; Sweep. |
| `tile` | `integer` | yes | min: `0`; max: `24`; The tile, as a plain JSON integer. |

- **`oneOf[1]`** — Cash out at the current multiplier.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"`; Cash out. |

### `TowersParams`

TOWERS's opening params (the game specification). `difficulty` is exactly `EASY`, `MEDIUM`, `HARD`, `WICKED` or `BRUTAL`, with no trimming and no other case. Anything else is refused with `422 invalid_input`, naming the field, before the engine runs, and the engine checks again.

The source cleans and upper-cases the field, so `"easy"`, `" easy "`, `"<b>easy</b>"` and `"ea\tsy"` all play `EASY`, and turns a JSON number or `true` into text. BetPlug refuses all of it. A key given twice is refused. TOWERS's round operations reference this schema.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `WICKED`, `BRUTAL`; The difficulty, which sets the columns per row, how many are good and the paytable. Upper case, exactly as listed. |

### `TowersAction`

A move on an open TOWERS round (the game specification). Anything else is `422 invalid_action`, read as written, as `MinesAction` is, so `" 0 "`, `"0.9"`, `"0e0"`, `0.0` and `0e0`, which the source or JSON Schema would accept, are refused.

- A `column` at or above the difficulty's column count (`HARD` has 2 columns, `MEDIUM` and `WICKED` have 3, `EASY` and `BRUTAL` have 4), or a cash-out before any row is cleared, is `422 invalid_action` from the engine with a non-empty `detail` naming the column bound or row 0 (where the source answered an empty message).

---

- **Type:** `object | object`

- **`oneOf[0]`** — Sweep one column on the current row.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"sweep"`; Sweep a column. |
| `column` | `integer` | yes | min: `0`; max: `3`; The column on the current row, as a plain JSON integer (below the difficulty's column count). |

- **`oneOf[1]`** — Cash out at the current row's multiplier.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"`; Cash out the climb. |

### `LimboView`

The `view` of a settled LIMBO round (`Round.view`). The round wins when `crash_point >= target` at 2 decimal places; `payout` is the gross credit (`floor(stake * target)` cut to `stake + max_profit` under `cap_rule: truncate`), and `profit` is `payout - stake`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `target` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$`; The validated target multiplier, formatted to 2 decimal places. |
| `crash_point` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$`; The rolled crash multiplier, formatted to 2 decimal places. |
| `roll` | `integer` | yes | min: `0`; max: `999999`; The integer roll drawn from the provably fair digest (`0.. 999999`). |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |
| `game_result` | `object` | yes | — |

### `PlinkoView`

The `view` of a settled PLINKO round (`Round.view`). `bucket` is the landing slot (`0.. pins`) and `multiplier` is the paytable entry for `(pins, risk, bucket)`. A `1.00x` bucket sets `push: true` and `win: false`; buckets above `1.00x` set `win: true`; buckets below `1.00x` return a partial payout with `win: false` and `push: false`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `pins` | `integer` | yes | min: `8`; max: `16` |
| `risk` | `string` | yes | enum: `LOW`, `MEDIUM`, `HIGH` |
| `bucket` | `integer` | yes | min: `0`; max: `16` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `win` | `boolean` | yes | — |
| `push` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |
| `game_result` | `object` | yes | — |

### `RouletteView`

The `view` of a settled ROULETTE round (`Round.view`). `spin` is the winning European wheel pocket (`0.. 36`), `chips` echoes the validated chip table with stakes formatted at the currency's scale, and `multiplier` is the combined return ratio truncated to 8 decimal places. `game_result` is always an empty array `[]`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `chips` | array<[`RouletteChip`](#roulettechip)> | yes | minItems: `1`; maxItems: `64` |
| `spin` | `integer` | yes | min: `0`; max: `36` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{8}$` |
| `win` | `boolean` | yes | — |
| `push` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |
| `game_result` | `array<object>` | yes | maxItems: `0` |

### `KenoView`

The `view` of a settled KENO round (`Round.view`). `picks` are sorted ascending, `drawn` lists the 10 distinct drawn numbers (`1.. 40`) in draw order, `words` holds the 10 raw 32-bit random words used for the draw, and `multiplier` is the paytable payout for `(risk, len(picks), hits)`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `risk` | `string` | yes | enum: `CLASSIC`, `LOW`, `MEDIUM`, `HIGH` |
| `picks` | `array<integer>` | yes | minItems: `1`; maxItems: `10` |
| `drawn` | `array<integer>` | yes | minItems: `10`; maxItems: `10` |
| `hits` | `integer` | yes | min: `0`; max: `10` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `table_version` | `integer` | yes | const: `1` |
| `words` | `array<integer>` | yes | minItems: `10`; maxItems: `10` |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |

### `MinesForceClose`

Force-close metadata attached when a MINES round is settled by the platform.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `rule` | `integer` | yes | enum: `1`, `2`, `4` |
| `k` | `integer` | yes | min: `1`; max: `24` |
| `j` | `integer` | yes | min: `0`; max: `24` |
| `close_credit` | `string | null` | yes | pattern: `^(0\|[1-9][0-9]{0,29})(\.[0-9]{1,18})?$` |
| `ev_floor` | `string | null` | yes | pattern: `^(0\|[1-9][0-9]{0,29})(\.[0-9]{1,18})?$` |
| `v` | `string | null` | yes | pattern: `^(0\|[1-9][0-9]*)(/[1-9][0-9]*)?$` |

### `MinesView`

The `view` of a settled MINES round (`Round.view`). `mine_locations` reveals the full dealt layout once the round settles. `status` is `CASHED_OUT` (player cash-out, instant-play win, last safe tile, or Rule 1 force-close), `BUSTED` (mine hit), `REFUNDED` (Rule 2 force-close before any tile is swept), or `FORCE_CLOSED` (Rule 4 expected-value force-close). On platform force-close, `ended_by` is `FORCE_CLOSED`, `force_close` is populated, and `max_profit_hit` and `game_result` are `null`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED`, `REFUNDED`, `FORCE_CLOSED` |
| `mines` | `integer` | yes | min: `1`; max: `24` |
| `sweeped_tiles` | `array<integer>` | yes | minItems: `0`; maxItems: `24` |
| `mine_locations` | `array<integer>` | yes | minItems: `1`; maxItems: `24` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)(\.[0-9]{1,8})?$` |
| `win` | `boolean | null` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `refund` | [`Amount`](#amount) | no | — |
| `max_profit_hit` | `boolean | null` | yes | — |
| `floats_used` | `integer` | yes | const: `24` |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"` |
| `force_close` | [`MinesForceClose`](#minesforceclose) | no | — |
| `game_result` | `object | null` | yes | — |

### `TowersResultRow`

One row in a settled TOWERS round's `results` array.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `attempted` | `boolean` | yes | — |
| `reward_locations` | `array<integer>` | yes | minItems: `0`; maxItems: `3` |
| `swept_location` | `integer | null` | yes | min: `0`; max: `3` |

### `TowersMatrixRow`

One display row in a settled TOWERS round's `game_table_matrix`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `current_multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)(\.[0-9]{1,8})?$` |
| `return_amount` | [`Amount`](#amount) | yes | — |
| `good_locations` | `array<integer>` | yes | minItems: `1`; maxItems: `3` |
| `bad_locations` | `array<integer>` | yes | minItems: `1`; maxItems: `3` |

### `TowersForceClose`

Force-close metadata attached when a TOWERS round is settled by the platform.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `rule` | `integer` | yes | enum: `1`, `2` |
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `WICKED`, `BRUTAL` |
| `rows` | `integer` | yes | min: `0`; max: `8` |

### `TowersView`

The `view` of a settled TOWERS round (`Round.view`). All 9 tower rows are revealed in `bad_locs` and `sw_locs`. `status` is `CASHED_OUT` (player cash-out, top row cleared, or Rule 1 force-close), `BUSTED` (bad column swept), or `REFUNDED` (Rule 2 force-close before any row is cleared). On player settlement, `results`, `game_table_matrix` and `game_result` are present; on platform force-close, `ended_by` and `force_close` are present and `game_result` is `null`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED`, `REFUNDED` |
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `WICKED`, `BRUTAL` |
| `current_row` | `integer | null` | yes | min: `0`; max: `8` |
| `sw_locs` | `array<integer | null>` | yes | minItems: `9`; maxItems: `9` |
| `bad_locs` | `array<array<integer>>` | yes | minItems: `9`; maxItems: `9` |
| `results` | array<[`TowersResultRow`](#towersresultrow)> | no | minItems: `9`; maxItems: `9` |
| `game_table_matrix` | array<[`TowersMatrixRow`](#towersmatrixrow)> | no | minItems: `9`; maxItems: `9` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)(\.[0-9]{1,8})?$` |
| `win` | `boolean | null` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `refund` | [`Amount`](#amount) | no | — |
| `max_profit_hit` | `boolean | null` | yes | — |
| `floats_used` | `integer` | yes | const: `9` |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"` |
| `force_close` | [`TowersForceClose`](#towersforceclose) | no | — |
| `game_result` | `object | null` | yes | — |

### `DiamondsParams`

DIAMONDS's opening params: **none**. The player names only the round's `stake`, so `params` is the empty object `{}`. Any key or non-object value is refused with `422 invalid_input` before anything is drawn.

- **Type:** `object`

### `DiamondsView`

The `view` of a settled DIAMONDS round (`Round.view`). Five gems (`0.. 6`) are drawn and classified into one of seven poker-style hands (`ALL_DIAMONDS` 50.00x, `FOUR_DIAMONDS` 5.00x, `THREE_DIAMONDS_TWO_DIAMONDS` 4.00x, `THREE_DIAMONDS` 3.00x, `TWO_DIAMONDS_TWO_DIAMONDS` 2.00x, `TWO_DIAMONDS` 0.10x partial return, `NOTHING` 0.00x).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `gems` | `array<integer>` | yes | minItems: `5`; maxItems: `5` |
| `hand` | `string` | yes | enum: `ALL_DIAMONDS`, `FOUR_DIAMONDS`, `THREE_DIAMONDS_TWO_DIAMONDS`, `THREE_DIAMONDS`, `TWO_DIAMONDS_TWO_DIAMONDS`, `TWO_DIAMONDS`, `NOTHING` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |
| `game_result` | `object` | yes | — |

### `RangediceBound`

A RANGEDICE target or range endpoint from `0` to `100` with at most 2 decimals and no leading zeros.

- **Type:** `string`
- **Constraints:** pattern: `^(100(\.0{1,2})?|[1-9]?[0-9](\.[0-9]{1,2})?)$`

### `RangediceParams`

RANGEDICE's opening params (`range-dice`):

- `over` and `under` require `target` and `multiplier` (and forbid `ranges`, including `null`).
- `between` and `outside` require `ranges` with exactly one `[low, high]` pair (`low < high`) and `multiplier` (and forbid `target`, including `null`).
- `either` requires `ranges` with two non-overlapping, non-touching pairs (`high1 + 0.02 <= low2`) and `multiplier` (and forbids `target`, including `null`).
- The winning set must cover between 1 and 9,406 of the 10,001 outcomes (`0.00.. 100.00`); out-of-range selections fail with `422 invalid_input`.
- `multiplier` echoes the two-decimal multiplier shown for the selection (`^[0-9]{1,5}\.[0-9]{2}$`). A malformed string is `422 invalid_input`; a well-formed string that differs from the computed multiplier is `409 odds_changed`.

---

- **Type:** `object | object | object`

- **`oneOf[0]`** — Single-threshold over or under selection.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `mode` | `string` | yes | enum: `over`, `under` |
| `target` | [`RangediceBound`](#rangedicebound) | yes | — |
| `multiplier` | `string` | yes | pattern: `^[0-9]{1,5}\.[0-9]{2}$` |

- **`oneOf[1]`** — Single-range between or outside selection.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `mode` | `string` | yes | enum: `between`, `outside` |
| `ranges` | `array<array<RangediceBound>>` | yes | minItems: `1`; maxItems: `1` |
| `multiplier` | `string` | yes | pattern: `^[0-9]{1,5}\.[0-9]{2}$` |

- **`oneOf[2]`** — Dual-range either selection.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `mode` | `string` | yes | const: `"either"` |
| `ranges` | `array<array<RangediceBound>>` | yes | minItems: `2`; maxItems: `2` |
| `multiplier` | `string` | yes | pattern: `^[0-9]{1,5}\.[0-9]{2}$` |

### `RangediceView`

The `view` of a settled RANGEDICE round (`Round.view`). `roll` is the 2-decimal outcome in `0.00.. 100.00` (`roll_number` in `0.. 10000`), `count` is the number of winning rolls (`1.. 9406`), and `payout_multiplier` is `multiplier` on a win or `"0.00"` on a loss.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `mode` | `string` | yes | enum: `over`, `under`, `between`, `outside`, `either` |
| `target` | `string | null` | yes | pattern: `^(100(\.0{1,2})?\|[1-9]?[0-9](\.[0-9]{1,2})?)$` |
| `ranges` | `array | null` | yes | minItems: `1`; maxItems: `2` |
| `count` | `integer` | yes | min: `1`; max: `9406` |
| `chance` | `string` | yes | pattern: `^(0\|[1-9][0-9]?)\.[0-9]{4}$` |
| `multiplier` | `string` | yes | pattern: `^[1-9][0-9]{0,4}\.[0-9]{2}$` |
| `payout_multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]{0,4})\.[0-9]{2}$` |
| `roll` | `string` | yes | pattern: `^(100\.00\|[1-9]?[0-9]\.[0-9]{2})$` |
| `roll_number` | `integer` | yes | min: `0`; max: `10000` |
| `word` | `integer` | yes | min: `0`; max: `4294967295` |
| `float` | `string` | yes | pattern: `^(0\|0\.[0-9]{1,32})$` |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |
| `game_result` | `object` | yes | — |

### `BaccaratParams`

BACCARAT's opening params: `bets` maps any combination of `player`, `banker` and `tie` to canonical decimal strings (at most 12 integer digits and at most the currency's decimal scale). At least one bet must be above zero, zero legs are omitted from settlement, **the positive bets must sum to the round's `stake`**, and each positive leg must satisfy the brand's stake limits (`422 stake_out_of_range`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bets` | `object` | yes | — |

### `BaccaratCard`

One dealt card in a settled BACCARAT coup.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `index` | `integer` | yes | min: `0`; max: `51` |
| `rank` | `integer` | yes | min: `1`; max: `13` |
| `label` | `string` | yes | enum: `A`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `J`, `Q`, `K` |
| `suit` | `integer` | yes | min: `0`; max: `3` |
| `value` | `integer` | yes | min: `0`; max: `9` |

### `BaccaratView`

The `view` of a settled BACCARAT round (`Round.view`). Cards are dealt under standard Punto Banco third-card rules (`player` pays `1.97x`, `banker` pays `1.91x`, `tie` pays `10.21x`; `player` and `banker` push at `1.00x` on a tie). `game_result` is the compact JSON text verified from the revealed seed.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `result` | `string` | yes | enum: `win`, `loss`, `push` |
| `win` | `boolean` | yes | — |
| `push` | `boolean` | yes | — |
| `roll_number` | `integer` | yes | min: `0`; max: `99`; `10 * totals.player + totals.banker`. |
| `payout_ratio` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2,20}$` |
| `outcome` | `string` | yes | enum: `player`, `banker`, `tie` |
| `natural` | `boolean` | yes | — |
| `player_cards` | array<[`BaccaratCard`](#baccaratcard)> | yes | minItems: `2`; maxItems: `3` |
| `banker_cards` | array<[`BaccaratCard`](#baccaratcard)> | yes | minItems: `2`; maxItems: `3` |
| `totals` | `object` | yes | — |
| `bets` | `object` | yes | — |
| `payouts` | `object` | yes | — |
| `returns` | `object` | yes | — |
| `results` | `object` | yes | — |
| `total_bet` | [`Amount`](#amount) | yes | — |
| `total_return` | [`Amount`](#amount) | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `capped` | `boolean` | yes | — |
| `table_version` | `integer` | yes | const: `1` |
| `rejected` | `array<integer>` | yes | — |
| `game_result` | `string` | yes | pattern: `^\{.*\}$` |

### `BlackjackParams`

BLACKJACK's opening params: **none**. The player names only the opening `stake`, so `params` is the empty object `{}`. Any key or non-object value is refused with `422 invalid_input` before anything is drawn.

- **Type:** `object`

### `BlackjackAction`

One move on an open BLACKJACK round: `hit`, `stand`, `double`, `split`, `insurance`, or `no_insurance`. `double` and `split` add a full `stake` to the round (`stake_added`); `insurance` adds `floor(stake / 2)`. Any move not currently offered on the hand (any extra key) is refused with `422 invalid_action`. `{"do": "force_close"}` is reserved for platform force-close and is always refused with `422 invalid_action`.

- **Type:** `object | object | object | object | object | object`

- **`oneOf[0]`** — Draw another card on the active hand.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"hit"` |

- **`oneOf[1]`** — Stand on the active hand (moves to hand 2 after a split, or settles).:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"stand"` |

- **`oneOf[2]`** — Double the stake on an initial two-card hand and draw one card.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"double"` |

- **`oneOf[3]`** — Split an initial pair of equal value into two hands by adding one stake.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"split"` |

- **`oneOf[4]`** — Take insurance against a dealer Ace by adding half the opening stake.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"insurance"` |

- **`oneOf[5]`** — Decline insurance against a dealer Ace.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"no_insurance"` |

### `BlackjackView`

The `view` of a settled BLACKJACK round (`Round.view`). `credit` equals the round's gross `payout`, `staked` is total stake paid across opening plus any double/split/insurance, `profit` is `credit - staked`, and `payout` is the multiplier string. On a normal settlement, `status` is `win` or `loss` and `game_result` is the compact JSON string; on platform force-close (Rule 4 expected-value settlement), `status` and `ended_by` are `FORCE_CLOSED` with `win`, `max_profit_hit` and `game_result` set to `null`.

- **Type:** `object | object`

- **`oneOf[0]`** — Normal settled BLACKJACK round (`win` or `loss`).:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `win`, `loss` |
| `player_hand` | `array<integer>` | yes | minItems: `2` |
| `player2_hand` | `array<integer>` | no | minItems: `2` |
| `dealer_hand` | `array<integer>` | yes | minItems: `1` |
| `player_score` | `integer` | yes | min: `2`; max: `31` |
| `player2_score` | `integer` | no | min: `2`; max: `31` |
| `dealer_score` | `integer` | yes | min: `2`; max: `31` |
| `win` | `integer` | yes | enum: `0`, `1` |
| `payout` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)(\.[0-9]{1,8})?$` |
| `bet_amt` | [`Amount`](#amount) | yes | — |
| `actions` | `array<string>` | yes | maxItems: `0` |
| `hand1_status` | `string` | yes | enum: `win`, `draw`, `loss` |
| `hand2_status` | `string` | yes | enum: `not_started`, `win`, `draw`, `loss` |
| `staked` | [`Amount`](#amount) | yes | — |
| `credit` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `max_profit_hit` | `boolean` | yes | — |
| `floats_used` | `integer` | yes | const: `52` |
| `game_result` | `string` | yes | pattern: `^\{.*\}$` |

- **`oneOf[1]`** — Force-closed BLACKJACK round (`FORCE_CLOSED`, Rule 4).:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | const: `"FORCE_CLOSED"` |
| `ended_by` | `string` | yes | const: `"FORCE_CLOSED"` |
| `rule` | `integer` | yes | const: `4` |
| `hand` | `array<integer>` | yes | minItems: `1` |
| `hand2` | `array<integer>` | yes | — |
| `up` | `integer` | yes | min: `1`; max: `11` |
| `known` | `boolean` | yes | — |
| `insured` | `boolean` | yes | — |
| `current_hand` | `integer` | yes | min: `0`; max: `2` |
| `double_open` | `boolean` | yes | — |
| `pair` | `boolean` | yes | — |
| `v` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)(/[1-9][0-9]*)?$` |
| `ev_floor` | [`Amount`](#amount) | yes | — |
| `player_hand` | `array<integer>` | yes | minItems: `1` |
| `player2_hand` | `array<integer>` | yes | — |
| `dealer_hand` | `array<integer>` | yes | minItems: `1`; maxItems: `1` |
| `win` | `null` | yes | — |
| `payout` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)(\.[0-9]{1,8})?$` |
| `staked` | [`Amount`](#amount) | yes | — |
| `credit` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `max_profit_hit` | `null` | yes | — |
| `floats_used` | `integer` | yes | const: `52` |
| `game_result` | `null` | yes | — |

### `HiloParams`

HILO's opening params: **none**. Opening a round deals the initial card (`0.. 51`), so `params` is the empty object `{}`. Any key or non-object value is refused with `422 invalid_input` before anything is drawn.

- **Type:** `object`

### `HiloAction`

One move on an open HILO round: `guess` (`HI`, `LO`, or `SAME` when offered on the current card), `skip` (up to 52 skips per round; exceeding the limit answers `409 limit`), or `cashout` (after at least one winning guess). `{"do": "force_close"}` is reserved for platform force-close and is always refused with `422 invalid_action`.

- **Type:** `object | object | object`

- **`oneOf[0]`** — Predict the next card relative to the current card.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"guess"` |
| `guess` | `string` | yes | enum: `HI`, `LO`, `SAME` |

- **`oneOf[1]`** — Skip the current card without changing the accumulated multiplier.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"skip"` |

- **`oneOf[2]`** — Cash out the accumulated multiplier after at least one winning guess.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"` |

### `HiloView`

The `view` of a settled HILO round (`Round.view`). `credit` equals the round's gross `payout` and `profit` is `credit - stake`. `status` is `CASHED_OUT` (manual cash-out, automatic ceiling/profit cash-out, or Rule 1 force-close), `BUSTED` (wrong guess), or `REFUNDED` (Rule 2 force-close before any guess).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED`, `REFUNDED` |
| `nonce` | `integer` | yes | min: `0` |
| `card` | `integer` | yes | min: `0`; max: `51` |
| `cards` | `array<integer>` | yes | minItems: `1` |
| `actions` | `string` | yes | pattern: `^[HLSK]*$` |
| `guesses` | `integer` | yes | min: `0`; max: `100` |
| `skips` | `integer` | yes | min: `0`; max: `52` |
| `skips_left` | `integer` | yes | min: `0`; max: `52` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$` |
| `can_cashout` | `boolean` | yes | const: `false` |
| `options` | `array<object>` | yes | maxItems: `0` |
| `auto_cashout` | `string | null` | yes | enum: `MAX_MULTIPLIER`, `MAX_GUESSES`, `MAX_PROFIT`, `null` |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `credit` | [`Amount`](#amount) | yes | — |
| `refund` | [`Amount`](#amount) | no | — |
| `win` | `boolean` | no | — |
| `max_profit_hit` | `boolean` | no | — |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"` |
| `rule` | `integer` | no | enum: `1`, `2` |
| `x_n` | `string` | no | pattern: `^(0\|[1-9][0-9]*)(/[1-9][0-9]*)?$` |
| `x_n_minus_f` | `string` | no | pattern: `^(0\|[1-9][0-9]*)(/[1-9][0-9]*)?$` |
| `game_result` | `object | null` | yes | — |

### `BarsParams`

BARS's params (the game specification). `difficulty` is exactly `EASY`, `MEDIUM`, `HARD` or `EXPERT`, with no trimming and no other case. `picks` is an array of 1 to 5 distinct bars, in any order. Anything else is refused with `422 invalid_input` before the engine runs, and the engine checks again.

The source reads these two exactly, but for one form: PHP decodes `{"0":3,"1":4}` to the list `[3, 4]`, which plays there. BetPlug refuses it.

JSON Schema also counts the numbers `3.0` and `3e0` as integers, so the server reads each value as written and refuses them too. A key given twice is refused. BARS's round operations reference this schema.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT`; The difficulty, which picks the table. Upper case, exactly as listed. |
| `picks` | `array<integer>` | yes | minItems: `1`; maxItems: `5`; The bars to bet on. The bet pays their average, so their order never matters. |

### `ChickenParams`

CHICKEN's opening params (the game specification). `difficulty` is exactly `EASY`, `MEDIUM`, `HARD` or `EXPERT`, with no trimming and no other case. It sets how many of the 20 lanes are deadly (1, 3, 5 or 10), and so the road's rows: `EASY` 19, `MEDIUM` 17, `HARD` 15, `EXPERT` 10. The settled round's `view` is a `ChickenView`.

`round` is optional. Absent or `0`, the round is **manual**: it opens at row 0 and the player crosses lane by lane (`ChickenAction`). `N` is **auto mode**: the round crosses N lanes and cashes out at row N in the opening request, unless a deadly lane comes first. N must be a cash-out row of the difficulty, a row whose multiplier is at least 1.01x: at H = 500, `EASY` 2 to 19, `MEDIUM` 1 to 17, `HARD` 1 to 15, `EXPERT` 1 to 10. The `allOf` states each range.

Anything else is refused by the engine with `422 invalid_input`: a round past the difficulty's rows, and a row that is no cash-out point (`EASY` row 1, at 1.00x), as MINES' cash-out points are.

**Port differences.** These are in the request's form only. Every round the source plays, BetPlug plays in one spelling, with the same deal and the same payout. Each form below plays in the source and is refused here by the engine with `422 invalid_input`:

- **A cleaned difficulty.** The source trims and upper-cases `difficulty` (`ChickenController.php:121`), so `"easy"`, `" EASY "` and `"EASY\t"` play `EASY` there (legacy boundary inputs). BetPlug takes `"EASY"`.
- **A loose round.** The source reads `round` raw (`parseRound`). It plays `null` and `-0` (PHP decodes `-0` to the integer 0) as a manual round, and a digit string `"0"` to `"99"` as that number. BetPlug takes the key absent, or `0`, for a manual round, and the JSON integer `5` for auto mode at row 5.

As in the source, `-1`, `5.0`, `1e1`, `" 5"`, `"05"`, `true` and `100` are refused. JSON Schema counts `5.0` and `1e1` as integers, so the engine reads the value as written. A key given twice is refused. CHICKEN's round operations reference this schema.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT`; The difficulty, which sets the deadly lanes, the rows and the paytable. Upper case, exactly as listed. |
| `round` | `integer` | no | min: `0`; max: `19`; 0 (absent) for a manual round; N for auto mode, a cash-out row of the difficulty (`EASY` 2 to 19, `MEDIUM` 1 to 17, `HARD` 1 to 15, `EXPERT` 1 to 10), as a plain JSON integer. |

### `ChickenAction`

A move on an open manual CHICKEN round (the game specification). Anything else is `422 invalid_action`, read as written, as `MinesAction` is. No move draws: the road was dealt when the round opened, and stays hidden until it settles.

- `step` crosses the next lane. A deadly lane busts the round, which pays 0. Reaching the last row cashes out by itself, after the bust test.
- `cashout` settles at the current row's multiplier. Before any lane, or on a row that is no cash-out point (`EASY` row 1), it is `422 invalid_action` from the engine, and the round stays open.
- `{"do": "force_close"}` is CHICKEN's force-close action: a refund at row 0, 1.00x at `EASY` row 1, a cash-out anywhere else. It is the platform's, sent by `POST /v1/players/{player_ref}/force-close` and the inactivity force-close, and **not a player move**: the actions routes refuse it with `422 invalid_action`.

---

- **Type:** `object | object`

- **`oneOf[0]`** — Cross the next lane.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"step"`; Cross a lane. |

- **`oneOf[1]`** — Cash out at the multiplier of the row reached.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"`; Stop crossing and cash out. |

### `ChickenGameResult`

The source's `bets.game_result` for a played CHICKEN round.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED` |
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |
| `crossed` | `integer` | yes | min: `0`; max: `19` |
| `death_lanes` | `array<integer>` | yes | minItems: `1`; maxItems: `10` |

### `ChickenView`

The `view` of a settled CHICKEN round (`Round.view`; the game specification). `status` is `CASHED_OUT` (manual cash-out, last row, auto target or Rule 1 force-close), `BUSTED` (stepped onto `death_lane`), `REFUNDED` (Rule 2 force-close at row 0) or `FORCED` (Rule 3 force-close at a non-cashout row such as `EASY` row 1). `death_lanes` reveals the whole dealt road. `payout` is the credit and equals the round's `payout`; `profit` is `payout − stake`. `game_result` is a `ChickenGameResult` on `CASHED_OUT`/`BUSTED`, or `null` on `REFUNDED`/`FORCED`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED`, `REFUNDED`, `FORCED` |
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |
| `current_row` | `integer` | yes | min: `0`; max: `19` |
| `rows` | `integer` | yes | enum: `10`, `15`, `17`, `19` |
| `target_row` | `integer` | no | min: `1`; max: `19`; Auto-mode target row (present only in auto mode). |
| `multiplier` | `string` | no | pattern: `^(0\|(0\|[1-9][0-9]*)\.[0-9]{2})$`; `0` on `BUSTED`, paytable multiplier on `CASHED_OUT`, floored value (`1.00`) on `FORCED`, omitted on `REFUNDED`. |
| `win` | `boolean` | yes | — |
| `push` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `refund` | [`Amount`](#amount) | no | Full stake refunded on Rule 2 force-close (`REFUNDED`). |
| `max_profit_hit` | `boolean` | yes | — |
| `death_lane` | `integer | null` | yes | min: `1`; max: `20`; The deadly lane stepped onto on `BUSTED`, or `null` otherwise. |
| `death_lanes` | `array<integer>` | yes | minItems: `1`; maxItems: `10` |
| `floats_used` | `integer` | yes | const: `20` |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"` |
| `rule` | `integer` | no | enum: `1`, `2`, `3` |
| `v_star` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `v_star_minus_f` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `game_result` | [`ChickenGameResult`](#chickengameresult) \| `null` | yes | The source's `bets.game_result`, or `null` on `REFUNDED` and `FORCED`. |

### `PumpParams`

PUMP's opening params (the game specification). `difficulty` is exactly `EASY`, `MEDIUM`, `HARD` or `EXPERT`, with no trimming and no other case. It sets how many of the balloon's 25 positions pop it (1, 3, 5 or 10), and so its top, the most pumps a round can make: `EASY` 24, `MEDIUM` 22, `HARD` 20, `EXPERT` 15. The settled round's `view` is a `PumpView`.

`round` is optional. Absent or `0`, the round is **manual**: it opens at 0 pumps and the player pumps one at a time (`PumpAction`). `N` is **auto mode**: the round makes N pumps and cashes out at N in the opening request, unless the balloon pops first or the max-profit stop comes first. N must be a cash-out point of the difficulty, a step whose multiplier is at least 1.01x: at H = 500, `EASY` 2 to 24, `MEDIUM` 1 to 22, `HARD` 1 to 20, `EXPERT` 1 to 15. The `allOf` states each range.

Anything else is refused by the engine with `422 invalid_input`: a round past the difficulty's top, and a step that is no cash-out point (`EASY` step 1, at 0.98x), as CHICKEN's are.

**Port differences.** These are in the request's form only. Every round the source plays, BetPlug plays in one spelling, with the same deal and the same payout. Each form below plays in the source and is refused here by the engine with `422 invalid_input`:

- **A cleaned difficulty.** The source reads `difficulty` through `cleanInput`, which trims it and strips tabs and tags before the case-sensitive check, so `" EASY "`, `"EASY\t"`, `"EA\tSY"` and `"<b>EASY</b>"` play `EASY` there. BetPlug takes `"EASY"`. (`"easy"` is refused by both.)
- **A loose round.** The source reads `round` raw (`PumpController::parseRound`). It plays `null` and `-0` (PHP decodes `-0` to the integer 0) as a manual round, and a string of one or two digits up to 25 as that number, leading zero included (`"5"` and `"05"` are 5, `"00"` is 0). BetPlug takes the key absent, or `0`, for a manual round, and the JSON integer `5` for auto mode at 5 pumps.

As in the source, `-1`, `26`, `2.5`, `"1e1"`, `""`, `"3 "` and `true` are refused. JSON Schema counts `5.0` and `1e1` as integers, so the engine reads the value as written and refuses them too. A key given twice is refused. PUMP's round operations reference this schema.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT`; The difficulty, which sets the popping positions, the top and the paytable. Upper case, exactly as listed. |
| `round` | `integer` | no | min: `0`; max: `24`; 0 (absent) for a manual round; N for auto mode, a cash-out point of the difficulty (`EASY` 2 to 24, `MEDIUM` 1 to 22, `HARD` 1 to 20, `EXPERT` 1 to 15), as a plain JSON integer. |

### `PumpAction`

A move on an open manual PUMP round (the game specification). Anything else is `422 invalid_action`, read as written, as `ChickenAction` is. No move draws: the pops were dealt when the round opened, and stay hidden until it settles.

- `pump` makes the next pump. It pops the balloon at or past the lowest popping position, which pays 0. Otherwise the round cashes out by itself at the top, or where the pump's profit reaches the round's maximum profit (the max-profit stop), tested in that order after the pop.
- `cashout` settles at the multiplier of the pumps made. Before a cash-out point (0 pumps, or 1 on `EASY`), it is `422 invalid_action` from the engine, and the round stays open.
- `{"do": "force_close"}` is PUMP's force-close action: a refund at 0 pumps, 0.98x at `EASY` step 1, a cash-out anywhere else. It is the platform's, sent by `POST /v1/players/{player_ref}/force-close` and the inactivity force-close, and **not a player move**: the actions routes refuse it with `422 invalid_action`.

---

- **Type:** `object | object`

- **`oneOf[0]`** — Make the next pump.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"pump"`; Pump once. |

- **`oneOf[1]`** — Cash out at the multiplier of the pumps made.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"`; Stop pumping and cash out. |

### `PumpGameResult`

The source's `bets.game_result` for a played PUMP round (`v: 1`; the game specification).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `v` | `integer` | yes | const: `1` |
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED` |
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |
| `pops` | `integer` | yes | enum: `1`, `3`, `5`, `10` |
| `pumps` | `integer` | yes | min: `0`; max: `24` |
| `pop_at` | `integer` | yes | min: `1`; max: `25` |
| `pop_positions` | `array<integer>` | yes | minItems: `1`; maxItems: `10` |
| `multiplier` | `string | null` | yes | pattern: `^[1-9][0-9]*\.[0-9]{2}$` |
| `target` | `integer | null` | yes | min: `1`; max: `24` |
| `auto` | `string | null` | yes | enum: `TOP`, `MAX_PROFIT`, `null` |

### `PumpView`

The `view` of a settled PUMP round (`Round.view`; the game specification). `status` is `CASHED_OUT` (manual cash-out, auto target, top, max-profit stop or Rule 1 force-close), `BUSTED` (popped at `pop_at`), `REFUNDED` (Rule 2 force-close at 0 pumps) or `FORCED` (Rule 3 force-close at `EASY` pump 1, paying `0.98x`). `pop_positions` reveals all dealt pops. `payout` is the credit and equals the round's `payout`; `profit` is `payout − stake`. `game_result` is a `PumpGameResult` on `CASHED_OUT`/`BUSTED`, or `null` on `REFUNDED`/`FORCED`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED`, `REFUNDED`, `FORCED` |
| `difficulty` | `string` | yes | enum: `EASY`, `MEDIUM`, `HARD`, `EXPERT` |
| `current_row` | `integer` | yes | min: `0`; max: `24` |
| `max_pumps` | `integer` | yes | enum: `15`, `20`, `22`, `24` |
| `target` | `integer | null` | yes | min: `1`; max: `24`; Auto-mode target pumps, or `null` in manual mode. |
| `multiplier` | `string | null` | yes | pattern: `^[1-9][0-9]*\.[0-9]{2}$`; Paytable multiplier on `CASHED_OUT`, or `null` otherwise. |
| `auto_cashout` | `string | null` | yes | enum: `TOP`, `MAX_PROFIT`, `null` |
| `win` | `boolean` | yes | — |
| `payout_multiplier` | `string` | no | pattern: `^(0\|(0\|[1-9][0-9]*)\.[0-9]{2})$`; Settlement multiplier paid (`"0"` on `BUSTED`, `multiplier` on `CASHED_OUT`, `"0.98"` on `FORCED`, omitted on `REFUNDED`). |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `refund` | [`Amount`](#amount) | no | Full stake refunded on Rule 2 force-close (`REFUNDED`). |
| `max_profit_hit` | `boolean` | yes | — |
| `pop_at` | `integer` | yes | min: `1`; max: `25` |
| `pop_positions` | `array<integer>` | yes | minItems: `1`; maxItems: `10` |
| `floats_used` | `integer` | yes | const: `24` |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"` |
| `rule` | `integer` | no | enum: `1`, `2`, `3` |
| `v_star` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `v_star_minus_f` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `game_result` | [`PumpGameResult`](#pumpgameresult) \| `null` | yes | The source's `bets.game_result`, or `null` on `REFUNDED` and `FORCED`. |

### `MolesParams`

MOLES's opening params (the game specification –). `moles` is a **JSON integer** from 1 to 6, how many of the 7 holes hold a mole on each round (`k1` to `k6`), which sets the ladder and its top: `1` mole has up to 8 rounds, and `2` to `6` moles have up to 9. `hole` is a **JSON integer** from 0 to 6 on the 2-3-2 board. The settled round's `view` is a `MolesView`.

`hits` is optional. Absent or `0`, the round is **manual**: `hole` is judged on round 1 in the opening request (a miss settles there; a hit opens the round at 1 hit, continued with `MolesAction`). `N` is **auto mode**: the round picks `hole` on up to N rounds and cashes out at N in the opening request unless a miss or the max-profit stop comes first (`1` to `8` with 1 mole, `1` to `9` with 2 to 6 moles; every step is at least `1.10x`, a cash-out point).

Anything else is refused with `422 invalid_input`.

**Port differences.** Every round the source plays, BetPlug plays in one spelling, with the same deal and payout. Each form below plays in the source (`MolesController::parseInt`, `parseHits`) and is refused here with `422 invalid_input`:

- **Digit strings and `-0`.** The source accepts canonical digit strings (`"3"`, `"0"`) and `-0` (which PHP decodes to `0`) for `moles`, `hole` and `hits`. BetPlug takes plain JSON integers (`3`, `0`).
- **`hits: null`.** The source plays `hits: null` as manual (`0`). BetPlug takes the key absent, or `0`.

JSON Schema counts `3.0` and `1e0` as integers, so the server reads each value as written and refuses them too, along with `"03"`, `" 3"`, `-1`, `7`, `hits: 9` at 1 mole, `true` and repeated keys.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `moles` | `integer` | yes | min: `1`; max: `6`; How many of the 7 holes hold a mole each round (1 to 6), which picks the ladder, as a plain JSON integer. |
| `hole` | `integer` | yes | min: `0`; max: `6`; The opening hole on the 2-3-2 board (0 to 6), picked on round 1 in manual mode and on every round in auto mode, as a plain JSON integer. |
| `hits` | `integer` | no | min: `0`; max: `9`; 0 (absent) for a manual round; 1 to 8 (1 mole) or 1 to 9 (2 to 6 moles) for auto mode, as a plain JSON integer. |

### `MolesAction`

A move on an open manual MOLES round (the game specification –). Anything else is `422 invalid_action`, read as written, so `"3"`, `-0`, `3.0` and `1e0` for `hole`, and the pre- `{"action": …}` key, are refused. No move draws: the board was dealt when the round opened, and unplayed rounds stay hidden until settlement.

- `hit` picks `hole` (0 to 6) on the next round: a miss pays 0; a hit settles by itself at the top or the max-profit stop, or advances the open round by one hit.
- `cashout` settles at `m(moles, hits)` (every open round already has at least 1 hit).
- `{"do": "force_close"}` is MOLES's force-close action: Rule 1 cash-out at `m(moles, hits)`. It is the platform's, sent by `POST /v1/players/{player_ref}/force-close` and the inactivity force-close, and **not a player move**: the actions routes refuse it with `422 invalid_action`.

---

- **Type:** `object | object`

- **`oneOf[0]`** — Pick a hole on the next round of the board.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"hit"`; Whack a hole. |
| `hole` | `integer` | yes | min: `0`; max: `6`; The hole to pick on the 7-hole board (0 to 6), as a plain JSON integer. |

- **`oneOf[1]`** — Cash out at m(moles, hits).:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"`; Stop whacking and cash out. |

### `MolesRevealedRound`

One played round of a MOLES board (`MolesView.rounds`; the game specification).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `moles` | `array<integer>` | yes | minItems: `1`; maxItems: `6` |
| `pick` | `integer` | yes | min: `0`; max: `6` |
| `hit` | `boolean` | yes | — |
| `floats` | `integer` | yes | min: `1`; max: `192` |

### `MolesView`

The `view` of a settled MOLES round (`Round.view`; the game specification). `status` is `CASHED_OUT` (manual cash-out, auto target, top round, max-profit stop or Rule 1 force-close) or `BUSTED`. `rounds` reveals each played round's mole holes, pick, outcome and word count, and `rejected` lists any rejected uniform-draw word positions within those played rounds. `payout` is the credit and equals the round's `payout`; `profit` is `payout − stake`. Auto rounds carry `target` and `hole`. `game_result` is the source's `bets.game_result` (`v: 1`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED` |
| `mode` | `string` | yes | enum: `manual`, `auto` |
| `moles` | `integer` | yes | min: `1`; max: `6` |
| `hits` | `integer` | yes | min: `0`; max: `9` |
| `max_rounds` | `integer` | yes | enum: `8`, `9` |
| `rounds` | array<[`MolesRevealedRound`](#molesrevealedround)> | yes | minItems: `1`; maxItems: `9` |
| `floats_used` | `integer` | yes | min: `1`; max: `1728` |
| `rejected` | `array<integer>` | yes | — |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*\.[0-9]{2})$` |
| `can_cashout` | `boolean` | yes | const: `false` |
| `win` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `cashed_at` | `integer | null` | yes | min: `1`; max: `9` |
| `auto_cashout` | `string | null` | yes | enum: `TOP`, `MAX_PROFIT`, `null` |
| `max_profit_hit` | `boolean` | yes | — |
| `target` | `integer` | no | min: `1`; max: `9`; Auto-mode target hit count (present only in auto mode). |
| `hole` | `integer` | no | min: `0`; max: `6`; Auto-mode repeated hole pick (present only in auto mode). |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"` |
| `rule` | `integer` | no | const: `1` |
| `v_star` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `v_star_minus_f` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `game_result` | `object` \| `object` | yes | The source's `bets.game_result` (`v: 1`), manual or auto shape. |

### `RpsParams`

RPS's opening params (the game specification). Every hand is thrown until a win or a loss decides it (a tie or `u = 0` reroll decides nothing), up to 20 won hands (`m(n) = 0.95 * 2^n`, `1.90x` to `996147.20x`).

- **Manual mode** (`hands` absent or `0`): throws `pick` (`ROCK`, `PAPER` or `SCISSORS`) at once; a loss settles, a win opens at 1 won hand, and a tie or reroll opens at 0 won hands with the hand pending (`RpsAction`). `pattern` and `tie_picks` are forbidden.
- **Auto mode** (`hands` 1 to 20): requires `pattern` (`FIXED`, `CYCLE` or `REVERSE`) and takes optional `tie_picks` (`1` to `640` uppercase letters `R`, `P` or `S`, consumed in order across ties and rerolls), settling the whole run in the opening request. The settled round's `view` is an `RpsView`.

Anything else is refused with `422 invalid_input`.

**Port differences.** Each form below plays in the source (`RpsController::parsePick`, `parseHands`, `parsePattern`, `parseTiePicks`) and is refused here with `422 invalid_input`:

- **Trimmed or case-folded names.** The source trims PHP whitespace and ASCII-upper-cases `pick` and `pattern`, so `"rock"`, `" Paper "`, `"SCISSORS\t"`, `"fixed"` and `" Cycle "` play there. BetPlug takes exact uppercase `"ROCK"`, `"PAPER"`, `"SCISSORS"` and `"FIXED"`, `"CYCLE"`, `"REVERSE"` (as the source already requires on `tie_picks`).
- **String `hands`, `-0` and `null` optionals.** The source accepts `"0"` to `"20"`, `-0`, and `null` for `hands`, `pattern` and `tie_picks`. BetPlug takes plain JSON integers and omits unused keys (`hands: 0` is allowed in manual mode; `5.0`, `1e1` and repeated keys are refused).

---

- **Type:** `object | object`

- **`oneOf[0]`** — Open a manual RPS round at its first throw (`RpsAction` continues it).:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `pick` | `string` | yes | enum: `ROCK`, `PAPER`, `SCISSORS`; The opening throw's hand, upper case, exactly as listed. |
| `hands` | `integer` | no | const: `0`; 0 (omit the key) for a manual RPS round, as a plain JSON integer. |

- **`oneOf[1]`** — Play an auto RPS run of 1 to 20 won hands in the opening request.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `pick` | `string` | yes | enum: `ROCK`, `PAPER`, `SCISSORS`; Hand 1's opening pick, from which `pattern` steps. Upper case, exactly as listed. |
| `hands` | `integer` | yes | min: `1`; max: `20`; Target won hands (1 to 20), as a plain JSON integer. |
| `pattern` | `string` | yes | enum: `FIXED`, `CYCLE`, `REVERSE`; How each hand's first throw steps from `pick` (`FIXED` keeps it, `CYCLE` steps R->P->S->R, `REVERSE` steps R->S->P->R). Upper case, exactly as listed. |
| `tie_picks` | `string` | no | pattern: `^[RPS]{1,640}$`; minLength: `1`; maxLength: `640`; Browser-chosen re-picks consumed in order across ties and rerolls (1 to 640 letters `R`, `P` or `S`, upper case). |

### `RpsAction`

A move on an open manual RPS round (the game specification). Anything else is `422 invalid_action`, read as written, so `"rock"`, `" PAPER "` and the pre- `{"action": …}` key are refused.

- `throw` draws one FairRandom word against `pick` (`ROCK`, `PAPER` or `SCISSORS`): a loss pays 0; a win settles at 20 won hands or the max-profit stop, or opens the next hand; a tie or `u = 0` reroll leaves the hand pending.
- `cashout` settles at `m(wins)` when at least 1 hand is won and no hand is pending; while a tie or reroll is pending (including 0 won hands), the engine refuses with `422 invalid_action` and the round stays open.
- `{"do": "force_close"}` is RPS's force-close action: Rule 1 cash-out at `m(wins)` when no hand is pending, or Rule 4 `floor(credit(wins+1) / 2)` when a tie or reroll is pending. It is the platform's, sent by `POST /v1/players/{player_ref}/force-close` and the inactivity force-close, and **not a player move**: the actions routes refuse it with `422 invalid_action`.

---

- **Type:** `object | object`

- **`oneOf[0]`** — Throw ROCK, PAPER or SCISSORS against the house.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"throw"`; Make the next throw. |
| `pick` | `string` | yes | enum: `ROCK`, `PAPER`, `SCISSORS`; The hand to throw, upper case, exactly as listed. |

- **`oneOf[1]`** — Cash out at the multiplier of the won hands.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"`; Stand on the won hands and cash out. |

### `RpsThrow`

One throw in an RPS round (`RpsView.throws` and `last_hand`; the game specification).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `pick` | `string` | yes | enum: `R`, `P`, `S` |
| `house` | `string | null` | yes | enum: `R`, `P`, `S`, `null`; House hand (`R`, `P` or `S`), or `null` on a `u = 0` reroll. |
| `result` | `string` | yes | enum: `win`, `loss`, `tie`, `reroll` |
| `float_index` | `integer` | yes | min: `0`; max: `659` |
| `capped` | `boolean` | no | const: `true`; Present and `true` only on the 33rd coin-decided throw of a hand after 32 undecided throws. |

### `RpsView`

The `view` of a settled RPS round (`Round.view`; the game specification). `status` is `CASHED_OUT` (manual cash-out, auto target, top hand 20, max-profit stop or Rule 1 force-close), `BUSTED` or `FORCED` (Rule 4 force-close while a tied/rerolled hand is pending, paying `⌊credit(wins+1)/2⌋` with `v_star_credit` and `game_result: null`). `payout` is the credit and equals the round's `payout`; `profit` is `payout − stake`. Auto rounds carry `pattern`, `target` and optional `tie_picks`. `game_result` is the source's `bets.game_result` (`v: 2`) on `CASHED_OUT`/`BUSTED`, or `null` on `FORCED`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED`, `FORCED` |
| `mode` | `string` | yes | enum: `manual`, `auto` |
| `wins` | `integer` | yes | min: `0`; max: `20` |
| `max_wins` | `integer` | yes | const: `20` |
| `picks` | `array<string>` | yes | minItems: `0`; maxItems: `20` |
| `throws` | array<[`RpsThrow`](#rpsthrow)> | yes | minItems: `1`; maxItems: `660` |
| `last_hand` | array<[`RpsThrow`](#rpsthrow)> | yes | minItems: `0`; maxItems: `33` |
| `floats_used` | `integer` | yes | min: `1`; max: `660` |
| `multiplier` | `string | null` | yes | pattern: `^(0\|[1-9][0-9]*\.[0-9]{2})$`; Ladder multiplier on `CASHED_OUT`, `"0"` on `BUSTED`, or `null` on Rule 4 `FORCED`. |
| `tie_pending` | `boolean` | yes | — |
| `can_cashout` | `boolean` | yes | const: `false` |
| `win` | `boolean` | yes | — |
| `push` | `boolean` | yes | — |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `cashed_at` | `integer | null` | yes | min: `1`; max: `20` |
| `auto_cashout` | `string | null` | yes | enum: `TOP`, `MAX_PROFIT`, `null` |
| `max_profit_hit` | `boolean` | yes | — |
| `pattern` | `string` | no | enum: `FIXED`, `CYCLE`, `REVERSE` |
| `target` | `integer` | no | min: `1`; max: `20` |
| `tie_picks` | `string` | no | pattern: `^[RPS]{1,640}$` |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"` |
| `rule` | `integer` | no | enum: `1`, `4` |
| `v_star_credit` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$`; Exact Rule 4 continuation credit as a reduced rational `num/den` in currency units. |
| `game_result` | `object` \| `object` \| `null` | yes | The source's `bets.game_result` (`v: 2`), manual or auto shape, or `null` on Rule 4 `FORCED`. |

### `SkyrushParams`

SKYRUSH's opening params (the game specification –). A flight crosses up to 25 canyon gates, picking `GREEN` (survival 3/4, gate 0 `1.26x`), `GOLD` (1/2, `1.90x`) or `RED` (1/4, `3.80x`). If gate 0's payout would exceed the coin's profit limit, the engine refuses before any draw (`409 max_stake`).

- **Manual mode** (`ring`): flies gate 0 through `ring`; a crash or an unoffered next gate settles in the opening request, and survival with an offered next gate opens the flight (`SkyrushAction`). `plan` and `land_at` are forbidden.
- **Auto mode** (`plan`, optional `land_at`): flies `plan` (1 to 25 rings) in order in the opening request, landing early if `land_at` (`1.01` to `1000000.00`, at most 2 decimals) is reached or the next planned ring is closed. `ring` is forbidden. The settled round's `view` is a `SkyrushView`.

Anything else is refused with `422 invalid_input`.

**Port differences.** Each form below plays in the source (`SkyRushController::parseRing`, `parsePlan`, `parseLandAt`) and is refused here with `422 invalid_input`:

- **Trimmed or case-folded rings.** The source trims PHP whitespace and ASCII-upper-cases `ring` and `plan` items, so `"green"`, `" Gold "` and `"RED\t"` play there. BetPlug takes exact `"GREEN"`, `"GOLD"` or `"RED"` (strict raw-token validation; single-letter `"G"`, `"Y"`, `"R"` are refused by both).
- **A list-shaped object for `plan`, and `null` optionals.** PHP's `json_decode(..., true)` turns `{"0":"GREEN","1":"RED"}` into a 0-indexed list that `parsePlan` plays, and `null` on `ring`, `plan` or `land_at` is treated as absent. BetPlug refuses every object for `plan` (strict raw-token validation and `skyrush.ParsePlan`) and omits unused keys; repeated keys are refused.

---

- **Type:** `object | object`

- **`oneOf[0]`** — Open a manual SKYRUSH flight at gate 0 (`SkyrushAction` flies later gates).:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `ring` | `string` | yes | enum: `GREEN`, `GOLD`, `RED`; Gate 0's ring (`GREEN` 1.26x, `GOLD` 1.90x or `RED` 3.80x), upper case, exactly as listed. |

- **`oneOf[1]`** — Fly a preset SKYRUSH plan of 1 to 25 canyon gates in the opening request.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `plan` | `array<string>` | yes | minItems: `1`; maxItems: `25`; The rings to fly in gate order (1 to 25 gates). |
| `land_at` | `string` | no | pattern: `^(1\.(0[1-9]\|[1-9][0-9]?)\|([2-9]\|[1-9][0-9]{1,5})(\.[0-9]{1,2})?\|1000000(\.0{1,2})?)$`; Auto-landing target multiplier from `1.01` to `1000000.00` with at most 2 decimals and no leading zero (`"2.50"`, `"5"`; `"1.00"` and `"1000000.01"` are refused), checked by strict raw-token validation and the engine. |

### `SkyrushAction`

A move on an open manual SKYRUSH flight (the game specification). Anything else is `422 invalid_action`, read as written, so `"green"`, `" GOLD "` and the pre- `{"action": …}` key are refused.

- `fly` flies the next gate through `ring` (`GREEN`, `GOLD` or `RED`), drawing one FairRandom word: if `ring` is closed by the 1,000,000.00x ceiling or the coin's profit limit, the engine refuses with `409 not_offered` before any draw and the flight stays open; a crash pays 0; survival lands automatically when no ring is offered for the following gate.
- `cashout` draws nothing and lands at the current path multiplier (every open flight has survived gate 0, at least `1.26x`).
- `{"do": "force_close"}` is SKYRUSH's force-close action: Rule 1 cash-out at the current path multiplier, with 0 draws. It is the platform's, sent by `POST /v1/players/{player_ref}/force-close` and the inactivity force-close, and **not a player move**: the actions routes refuse it with `422 invalid_action`.

---

- **Type:** `object | object`

- **`oneOf[0]`** — Fly the next canyon gate through an offered ring.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"fly"`; Fly one gate. |
| `ring` | `string` | yes | enum: `GREEN`, `GOLD`, `RED`; The ring to fly at the next gate, upper case, exactly as listed. |

- **`oneOf[1]`** — Land at the current path multiplier.:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `do` | `string` | yes | const: `"cashout"`; Land the flight and cash out. |

### `SkyrushGate`

One canyon gate flown in a SKYRUSH round (`SkyrushView.gates`; the game specification).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `ring` | `string` | yes | enum: `G`, `Y`, `R` |
| `u` | `integer` | yes | min: `0`; max: `4294967295` |
| `survived` | `boolean` | yes | — |
| `multiplier` | `string | null` | yes | pattern: `^[1-9][0-9]*\.[0-9]{2}$`; Path multiplier after surviving this gate, or `null` on a crash. |

### `SkyrushView`

The `view` of a settled SKYRUSH flight (`Round.view`; the game specification). `status` is `CASHED_OUT` (manual landing, auto landing on `TARGET`/`PLAN_END`/`MAX_GATES`/`MAX_MULTIPLIER`/`MAX_PROFIT`, or Rule 1 force-close) or `BUSTED` (crashed on a gate). Because closed rings are refused before flying (`cap_rule: refuse`), `profit_capped` is always `false`. `payout` equals the round's `payout` and `profit` is `payout − stake`. Auto flights carry `plan` and `land_at` (`null` when omitted). `game_result` is the source's `bets.game_result` (`v: 1`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `CASHED_OUT`, `BUSTED` |
| `win` | `boolean` | yes | — |
| `mode` | `string` | yes | enum: `manual`, `auto` |
| `payout` | [`Amount`](#amount) | yes | — |
| `profit` | [`SignedAmount`](#signedamount) | yes | — |
| `profit_capped` | `boolean` | yes | const: `false` |
| `multiplier` | `string` | yes | pattern: `^(0\|[1-9][0-9]*\.[0-9]{2})$` |
| `cleared` | `integer` | yes | min: `0`; max: `25` |
| `max_gates` | `integer` | yes | const: `25` |
| `rings` | `string` | yes | pattern: `^[GYR]{0,25}$`; Survived ring letters in order (`""` when crashed at gate 0). |
| `gates` | array<[`SkyrushGate`](#skyrushgate)> | yes | minItems: `1`; maxItems: `25` |
| `last_gate` | [`SkyrushGate`](#skyrushgate) \| `null` | yes | Most recently flown gate, or `null` on manual cash-out and force-close. |
| `greens` | `integer` | yes | min: `0`; max: `25` |
| `golds` | `integer` | yes | min: `0`; max: `25` |
| `reds` | `integer` | yes | min: `0`; max: `25` |
| `floats_used` | `integer` | yes | min: `1`; max: `25` |
| `cashed_at` | `integer | null` | yes | min: `1`; max: `25` |
| `auto_cashout` | `string | null` | yes | enum: `MAX_GATES`, `MAX_MULTIPLIER`, `MAX_PROFIT`, `TARGET`, `PLAN_END`, `null` |
| `max_profit` | [`Amount`](#amount) | yes | — |
| `plan` | `string` | no | pattern: `^[GYR]{1,25}$`; Auto-mode flight plan in ring letters (present only in auto mode). |
| `land_at` | `string | null` | no | pattern: `^[1-9][0-9]*\.[0-9]{2}$`; Auto-mode landing target formatted to 2 decimals, or `null` when absent (present only in auto mode). |
| `ended_by` | `string` | no | const: `"FORCE_CLOSED"` |
| `rule` | `integer` | no | const: `1` |
| `v_star` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `v_star_minus_f` | `string` | no | pattern: `^(0\|[1-9][0-9]*)/[1-9][0-9]*$` |
| `game_result` | `object` \| `object` | yes | The source's `bets.game_result` (`v: 1`), manual or auto shape. |

### `RoundCreate`

A round to open.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `game` | [`GameSlug`](#gameslug) | yes | — |
| `brand` | [`BrandId`](#brandid) | yes | — |
| `player_ref` | [`PlayerRef`](#playerref) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `stake` | [`Amount`](#amount) | yes | — |
| `jurisdiction` | [`JurisdictionCode`](#jurisdictioncode) | no | — |
| `params` | `object` | yes | The game's opening parameters: DICE takes `DiceParams`, LIMBO `LimboParams`, PLINKO `PlinkoParams`, ROULETTE `RouletteParams`, DIAMONDS `DiamondsParams`, RANGEDICE `RangediceParams`, KENO `KenoParams`, BACCARAT `BaccaratParams`, PACKS `PacksParams`, WHEEL `WheelParams`, DRILL `DrillParams`, CASES `CasesParams`, TAROT `TarotParams`, SLIDE `SlideParams`, BARS `BarsParams`, DARTS `DartsParams`, KABOOM `KaboomParams`, TILT `TiltParams`, GRIMOIRE, PHARAOH and SHOGUN `SlotParams`, MINES `MinesParams`, TOWERS `TowersParams`, BLACKJACK `BlackjackParams`, HILO `HiloParams`, CHICKEN `ChickenParams`, PUMP `PumpParams`, FLIP `FlipParams`, RPS `RpsParams`, SNAKES `SnakesParams`, MOLES `MolesParams`, SKYRUSH `SkyrushParams`, DEADSHOT `DeadshotParams`, VIDEOPOKER `VideopokerParams`, STACKPACKS `StackpacksParams`, and KOMBAT `KombatParams`. Unknown fields are refused (`422 invalid_input`), and so is any value that is not a JSON object (`null`, `[]`). |

### `RoundAction`

One step of a session round. Every session game's action is a JSON object whose **`do`** names the move, with the move's arguments beside it, each read as written (`MinesAction`, `TowersAction`, `BlackjackAction`, `HiloAction`, `ChickenAction`, `PumpAction`, `FlipAction`, `RpsAction`, `SnakesAction`, `MolesAction`, `SkyrushAction`, `DeadshotAction`, `VideopokerAction`, `StackpacksAction`, `KombatAction`).

**The move `force_close` is the platform's in every game, never a player's.** An action whose `do` is `force_close` is refused with `422 invalid_action` before anything is drawn, and the round stays as it was. No `<Game>Action` lists it. A game's dedicated force-close action is sent only by `POST /v1/players/{player_ref}/force-close` and the inactivity force-close sweep. A game whose force-close is one of the player's own moves (such as a cash-out) names that move, which a player may send.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `action` | `object` | yes | The game's action, an object whose `do` names the move (its spec and schema list them). `do` is never `force_close`, the platform's move (`422 invalid_action`). |
| `step` | `integer` | yes | min: `1`; The step this action makes, the round's `step` before it plus one. After it, the round's `step` equals this. |

### `SeedRef`

The seed pair a round drew from.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `server_seed_hash` | `string` | yes | pattern: `^[0-9a-f]{64}$`; SHA-256 of the server seed, shown before any round used it. |
| `client_seed` | [`ClientSeed`](#clientseed) | yes | — |
| `nonce` | `integer` | yes | min: `0`; max: `9007199254740991`; The round's nonce in this seed pair. Never reused, sometimes skipped. It is reserved in its own committed transaction before the draw, so an open that fails after it leaves a gap. |

### `CapRule`

How the engine version applies `max_profit` (platform policy):

- `truncate`: a settled payout's profit (`payout − stake`) is cut at settlement to `max_profit` (`payout = min(gross, stake + max_profit)` via exact integer truncation, after any compiled game-table ceiling such as a slot theme's `max_win_x`), and the step outcome reports `capped: true` iff the uncapped floored gross strictly exceeded `stake + max_profit`.
- `refuse`: a bet or draw that could profit more than `max_profit` is refused before the draw (`max_stake` or `not_offered`, or forced cash-out), so a settled round is never cut at settlement.

---

- **Type:** `string`
- **Constraints:** enum: `truncate`, `refuse`

### `CapSource`

Where the round's snapshotted `max_profit` came from when the round opened:

- `brand`: the brand's configured `max_profit` for `(brand, environment, currency)` (`brand_currencies.max_profit`).
- `demo`: the platform's fun-money `FUN` `max_profit` in a `demo` session (`POST /v1/demo/sessions` or a `mode: demo` brand launch).

---

- **Type:** `string`
- **Constraints:** enum: `brand`, `demo`

### `Round`

A round, as the operator or the session's player sees it. **Every read shows an outcome only once the attempt that pays for it is placed**, so that neither a player nor a wallet holding the debit sees it first and can make the debit fail. This holds for `GET /v1/rounds`, `GET /v1/rounds/{id}`, the session reads and a force-close's `rounds`, as for the answer to the `POST`. An attempt is unresolved while it is `debiting` or `confirmed`.

- A round still `reserved`, or whose opening attempt is unresolved, reads as `status: open` and `step` 1, with `payout` and `refund` 0 and an empty `view`.
- A round with a step's attempt unresolved reads as it was before that step, its `step` unchanged.
- A `void` round's `view` is empty until its seed is revealed, since its record keeps a hidden outcome.
- A settled live show bet is readable by id before its show reveals its link seed with its public settle view and zero unrevealed `server_seed` (provisional mid-round `meme-trade` sidebets read as `open` with zero `payout`/`refund`, empty `view` and `settled_at: null` until finalized); once revealed, show bets also appear in `GET /v1/rounds` and `GET /v1/session/rounds`.
- `max_profit`, `cap_rule` and `cap_source` carry the profit ceiling snapshotted when the round opened so client verifiers recompute `min(gross, stake + max_profit)` instead of trusting a claimed `capped: true`.

---

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `id` | [`RoundId`](#roundid) | yes | — |
| `game` | [`GameSlug`](#gameslug) | yes | — |
| `version` | `integer` | yes | min: `1`; The engine version that plays the round. |
| `brand` | [`BrandId`](#brandid) | yes | — |
| `player_ref` | [`PlayerRef`](#playerref) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `status` | `string` | yes | enum: `open`, `settled`, `void`; `open` includes a round whose opening debit is unresolved. `void`: a round that never took effect (its nonce stays used). |
| `step` | `integer` | yes | min: `1`; How many steps the round has taken (1 after the open). |
| `stake` | [`Amount`](#amount) | yes | — |
| `payout` | [`Amount`](#amount) | yes | The gross amount the player is paid at settlement: 0 while the round is open, and 0 on a loss. It **includes** `refund`, so the operator pays `payout`, never `payout + refund`. |
| `refund` | [`Amount`](#amount) | yes | The part of `payout` that is stake returned unplayed, neither wagered nor won: DEADSHOT's unfired bullets, or a force-close refund before reveal. It is at most `payout` and at most `stake`. It is never paid on top of `payout`, and the house's result is `stake − payout`. |
| `stake_added` | [`Amount`](#amount) | no | What the last step added to `stake` (a double), which the operator takes from the player. |
| `max_profit` | [`Amount`](#amount) | yes | The round's profit ceiling (`maximum_profit`, the most `payout − stake` may reach), snapshotted when the round opened and immutable thereafter. On a `cap_rule: truncate` game, a verifier recomputes the uncapped floored gross `G` from the revealed seed and pinned game version (after any compiled game-table ceiling such as a slot theme's `max_win_x`), checks `payout == min(G, stake + max_profit)` and strict `capped == (G > stake + max_profit)`, and flags any lower `payout` or unexplained `capped: true` as a mismatch; on a `cap_rule: refuse` game, `G <= stake + max_profit`, `payout == G`, and a settled round is never cut at settlement. |
| `cap_rule` | [`CapRule`](#caprule) | yes | How this engine version applies `max_profit`. |
| `cap_source` | [`CapSource`](#capsource) | yes | Where `max_profit` came from when the round opened. |
| `view` | `object` | yes | What the player may see now, empty while the outcome is hidden (above); when settled, the round's full public result (`LimboView`, `PlinkoView`, `RouletteView`, `DiamondsView`, `RangediceView`, `KenoView`, `BaccaratView`, `MinesView`, `TowersView`, `BlackjackView`, `HiloView`, `PacksView`, `WheelView`, `DrillView`, `CasesView`, `TarotView`, `SlideView`, `BarsView`, `DartsView`, `KaboomView`, `TiltView`, `SlotView`, `ChickenView`, `PumpView`, `FlipView`, `RpsView`, `SnakesView`, `MolesView`, `SkyrushView`, `DeadshotView`, and DICE/VIDEOPOKER/STACKPACKS/KOMBAT/live views). |
| `seed` | [`SeedRef`](#seedref) | yes | — |
| `created_at` | `string` | yes | format: `date-time`; When the round opened. |
| `settled_at` | `string | null` | no | format: `date-time`; When it settled; null while open. |

### `RoundPage`

One page of the operator's rounds, with the cursor to the next.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `data` | array<[`Round`](#round)> | yes | The rounds, newest first. |
| `next_cursor` | `string | null` | yes | Pass it as `cursor` for the next page; null on the last page. |

### `VerifiedTablePin`

A table fingerprint pinned by the engine version that played the round (`engine.Table`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `name` | `string` | yes | minLength: `1`; maxLength: `64`; The table's name within the engine version (for example a slot theme id or weighted-table id). |
| `fingerprint` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Pinned lowercase hex SHA-256 fingerprint of the canonical table (including any compiled `max_win_x` ceiling). |

### `VerifiedChainLink`

Pre-committed hash-chain link and public block salt for a live show record (`fair.ChainLink`, 10).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `chain` | `string` | yes | minLength: `1`; maxLength: `64`; Identifier of the published hash chain. |
| `index` | `integer` | yes | min: `0`; max: `9007199254740991`; Link index `i` in the chain. |
| `seed` | `string` | no | pattern: `^[0-9a-f]{64}$`; Revealed 64-hex link seed `s_i`, whose SHA-256 over ASCII bytes equals `commit`. |
| `commit` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Commitment `s_{i-1} = sha256(s_i)` published before the link ran. |
| `salt` | `string` | yes | pattern: `^[0-9a-f]{64}$`; 64-hex public block hash announced after `commit` and before the chain's first round. |
| `salt_source` | `string` | yes | minLength: `1`; maxLength: `64`; Where `salt` came from (for example `bitcoin:840000`). |

### `VerifiedStreamRef`

Stream binding and revealed server seed of a format-1 engine record (`engine.StreamRef`, 7).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `kind` | `string` | yes | enum: `fairrandom`, `dice-sha512`, `hmac-nonce`, `plinko-hmac`; Deterministic RNG stream recipe. |
| `server_seed_hash` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Pre-committed SHA-256 over the 64 ASCII characters of `server_seed`. |
| `server_seed` | `string` | no | pattern: `^[0-9a-f]{64}$`; Revealed 64 lowercase hex server seed (populated on `GET /v1/rounds/{id}/verify`). |
| `client_seed` | `string` | yes | minLength: `1`; Non-empty UTF-8 client seed mixed into every draw. |
| `nonce` | `integer` | yes | min: `0`; max: `9007199254740991`; Round nonce `0 … 2^53 − 1` (`fair.MaxNonce`). |
| `chain` | [`VerifiedChainLink`](#verifiedchainlink) | no | — |

### `VerifiedCurrency`

Currency code and decimal atom scale carried in `record.input.currency` (`money.Currency`, 7).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `code` | [`CurrencyCode`](#currencycode) | yes | — |
| `scale` | `integer` | yes | min: `0`; max: `18`; Number of fractional decimal digits per unit (`0 … 18`). Every amount in the record is rendered and parsed at this scale. |

### `VerifiedLimits`

Per-round stake and profit limits snapshotted into `record.input.limits` when the round opened and immutable thereafter (`engine.Limits`), rendered as decimal strings at `input.currency.scale`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `min_stake` | [`Amount`](#amount) | yes | Minimum per-bet stake snapshotted at open. |
| `max_stake` | [`Amount`](#amount) | yes | Maximum per-bet stake snapshotted at open. |
| `max_profit` | [`Amount`](#amount) | yes | Maximum round profit (`payout − stake`) snapshotted at open (`brand_currencies.max_profit`). The verifier (`@betrail/verifier`) recomputes `min(gross, stake + max_profit)` and strict `capped == (gross > stake + max_profit)` against this exact value on `truncate` games, and reject any settlement cut on `refuse` games. |

### `VerifiedRecordInput`

Opening input bound into a format-1 engine record (`engine.Input`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `profile` | `string` | yes | pattern: `^[a-z][a-z0-9]*(_[a-z0-9]+)*$`; minLength: `2`; maxLength: `32`; RTP profile id (`source` on every v1 engine). |
| `currency` | [`VerifiedCurrency`](#verifiedcurrency) | yes | — |
| `stake` | [`Amount`](#amount) | yes | Opening stake debited in `Open`, formatted at `currency.scale`. |
| `limits` | [`VerifiedLimits`](#verifiedlimits) | yes | — |
| `params` | `object` | yes | Game-specific opening parameters (`RoundCreate.params`). |

### `VerifiedStreamTrace`

Stream positions consumed by one committed step (`fair.Trace`, 7).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `from` | `integer` | yes | min: `0`; max: `9007199254740991`; Stream position before the step (`0` on `steps[0]`). |
| `to` | `integer` | yes | min: `0`; max: `9007199254740991`; Stream position after the step. |
| `rejected` | `array<integer>` | no | `fairrandom` word indices rejected by exact `Uniform` sampling during the step, if any. |

### `VerifiedStepOutcome`

Committed outcome of one step in a format-1 engine record (`engine.Outcome`, 7–8), with amounts rendered at `input.currency.scale`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `open`, `settled`; `open` on non-final steps; `settled` on the final step only. |
| `stake` | [`Amount`](#amount) | yes | Cumulative stake committed through this step. |
| `payout` | [`Amount`](#amount) | yes | Gross settlement payout (`0` while `open`; includes `refund` when `settled`). |
| `refund` | [`Amount`](#amount) | yes | Unplayed stake included in `payout`. |
| `capped` | `boolean` | no | Present and `true` when a `truncate` game cut this settled payout to `stake + input.limits.max_profit` (exact integer truncation). |
| `exposure` | [`Amount`](#amount) | yes | Largest gross payout still reachable without new stake (`payout` once `settled`, at most `stake + input.limits.max_profit`). |
| `trace` | [`VerifiedStreamTrace`](#verifiedstreamtrace) | yes | — |
| `view` | `object` | yes | Public step view (`game_result` on the settled step). |

### `VerifiedRecordStep`

One committed call in a format-1 engine record (`steps[0]` is `Open`, omitting `action`; each later step is an `Act` or platform `ForceClose`). In a show bet's record (`stream.chain` set) `steps[0]` is the placed bet and the later steps are the actions names; a CRASH bet's has exactly one more, the step that settled it, whose `action` is `{kind, step}` (`kind` `step`, `cashout`, `force_close` or `abort`, and the show step it ran at).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `action` | `object` | no | Action JSON passed to `Act` (or `Descriptor.ForceClose` on a platform force-close step); omitted on `steps[0]`. |
| `outcome` | [`VerifiedStepOutcome`](#verifiedstepoutcome) | yes | — |

### `VerifiedRecord`

Format-1 engine record (`engine.Record`) as rendered on the wire by `GET /v1/rounds/{id}/verify` (the server `formatRecord`) and accepted by `@betrail/verifier` and the standalone verifier: every amount is a decimal string at `input.currency.scale`, `input.limits.max_profit` and `tables` bind the cap in effect, and `stream.server_seed` carries the revealed 64-hex server seed.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `v` | `integer` | yes | const: `1`; Record layout version (`engine.RecordFormat = 1`). |
| `game` | `string` | yes | pattern: `^[A-Z][A-Z0-9_]{0,31}$`; Engine `GameID` (for example `DICE`, `PACKS`, `MEME_TRADE`). |
| `version` | `integer` | yes | min: `1`; Engine version that played the round. |
| `tables` | `array | null` | yes | Pinned table fingerprints of the engine version (`null` when the engine has no table). |
| `stream` | [`VerifiedStreamRef`](#verifiedstreamref) | yes | — |
| `input` | [`VerifiedRecordInput`](#verifiedrecordinput) | yes | — |
| `steps` | array<[`VerifiedRecordStep`](#verifiedrecordstep)> | yes | minItems: `1`; Committed steps (`steps[0]` = `Open`; only the final step has `outcome.status: settled`). |

### `Verification`

A replay of a revealed round.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `result` | `string` | yes | enum: `ok`, `verify_mismatch`; `ok` when every step replays (including `input.limits.max_profit` cap verification); `verify_mismatch` otherwise, with `detail`. |
| `detail` | `string` | no | With `verify_mismatch`, the first difference. |
| `record` | `object` | yes | The round's format-1 `VerifiedRecord` with every amount rendered as a decimal string at `input.currency.scale`, `input.limits.max_profit` binding the profit cap snapshotted at open, and `stream.server_seed` revealed (`{}` fallback only when `result` is `verify_mismatch` because a stored row is not a format-1 record). |

### `SeedPairCommitted`

A seed pair in use or committed for next. Its server seed is never shown, only its commitment.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `server_seed_hash` | `string` | yes | pattern: `^[0-9a-f]{64}$`; SHA-256 of the server seed. |
| `client_seed` | [`ClientSeed`](#clientseed) | yes | — |
| `nonces_used` | `integer` | yes | min: `0`; How many nonces the pair has reserved; on the current pair, the next round's nonce. |

### `SeedPairRevealed`

A seed pair rotated out, with its server seed revealed so every round on it can be verified.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `server_seed_hash` | `string` | yes | pattern: `^[0-9a-f]{64}$`; SHA-256 of the server seed, as committed before the pair's first round. |
| `server_seed` | `string` | yes | pattern: `^[0-9a-f]{64}$`; The revealed server seed; its SHA-256 is `server_seed_hash`. |
| `client_seed` | [`ClientSeed`](#clientseed) | yes | — |
| `nonces_used` | `integer` | yes | min: `0`; How many nonces the pair reserved; a nonce is never reused, and one can be skipped. |

### `SeedState`

A player's seeds for one game.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `current` | [`SeedPairCommitted`](#seedpaircommitted) | yes | — |
| `next` | [`SeedPairCommitted`](#seedpaircommitted) | yes | — |
| `previous` | [`SeedPairRevealed`](#seedpairrevealed) \| `null` | yes | The pair rotated out last, with its server seed revealed; null before the first rotation. |

### `ClientSeedSet`

The client seed for the next seed pair.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `client_seed` | [`ClientSeed`](#clientseed) | yes | — |

### `LaunchCreate`

What to launch, for whom.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `game` | [`GameSlug`](#gameslug) | yes | — |
| `brand` | [`BrandId`](#brandid) | yes | — |
| `player_ref` | [`PlayerRef`](#playerref) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `mode` | `string` | yes | enum: `real`, `demo`; `demo` plays with fun money and never touches the wallet. |
| `locale` | `string` | yes | pattern: `^[a-z]{2}(-[A-Z]{2})?$`; The player's language, as a BCP 47 tag. |
| `return_url` | `string` | no | format: `uri`; maxLength: `2048`; Where "back to the casino" goes; it must be on one of the brand's configured origins. |
| `jurisdiction` | [`JurisdictionCode`](#jurisdictioncode) | no | — |

### `RealityCheck`

Operator-configured reality-check schedule snapshotted when a real-money seamless session launched (part 2; enforcement hook over the operator's settings, policy defaults pending platform policy).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `interval_seconds` | `integer` | yes | min: `300`; max: `86400`; The snapshotted reality-check interval in seconds (300 to 86400). |
| `due_at` | `string` | yes | format: `date-time`; When the next reality-check acknowledgement becomes due (`now >= due_at` refuses new play with `409 reality_check_due`). |

### `RealityCheckAck`

A recorded player acknowledgement of a due reality check (`POST /v1/sessions/current/reality-check`, part 2; policy defaults pending platform policy).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `acknowledged_at` | `string` | yes | format: `date-time`; When the player acknowledged the reality check. |
| `elapsed_seconds` | `integer` | yes | min: `0`; Whole seconds elapsed since the player session was created. |
| `net_result` | [`SignedAmount`](#signedamount) | yes | Exact settled net result (`payout - stake`) across this session's rounds in the session currency. |
| `reality_check` | [`RealityCheck`](#realitycheck) | yes | — |

### `Launch`

A launch. The token is a bearer secret for 60 s; never log it.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `token` | `string` | yes | pattern: `^[A-Za-z0-9_-]{43}$`; The launch token, 32 random bytes in base64url. Single-use. |
| `url` | `string` | yes | format: `uri`; The play URL for the iframe host. The page strips the token from the address bar at once. |
| `expires_at` | `string` | yes | format: `date-time`; When the token stops working, 60 s after it was issued. |
| `reality_check` | [`RealityCheck`](#realitycheck) \| `null` | yes | The brand environment's snapshotted reality-check schedule for this real-money session, or `null` when reality checks are off or `mode` is `demo`. |

### `TopupMockEvent`

The mock provider's webhook body. `amount_micro` is what the mock captured, in micro-USD. It is an integer because it stays far below 2^53 and this is the mock's own wire form, never a BetPlug answer.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `id` | `string` | yes | pattern: `^[A-Za-z0-9_.:-]{1,128}$`; The provider's event id, unique per provider. |
| `topup_id` | `string` | yes | format: `uuid`; BetPlug's id for the top-up, sent to the provider as the client reference. |
| `operator_id` | `string` | yes | format: `uuid`; The operator the top-up belongs to. |
| `checkout_id` | `string` | yes | pattern: `^[A-Za-z0-9_.:-]{1,128}$`; The provider's id for the checkout. |
| `status` | `string` | yes | enum: `succeeded`, `failed`, `expired`, `reversed`; What happened to the checkout. |
| `amount_micro` | `integer` | yes | min: `0`; max: `9007199254740991`; The amount captured, in micro-USD. |
| `currency` | `string` | yes | pattern: `^[A-Z]{3}$`; The currency captured. Anything but USD is a mismatch, and is never credited. |

### `SessionCreate`

The launch token to exchange.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `launch_token` | `string` | yes | pattern: `^[A-Za-z0-9_-]{43}$`; The launch token from `POST /v1/launch`. Single-use; never log it. |

### `DemoSessionCreate`

The demo to start.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `game` | [`GameSlug`](#gameslug) | yes | — |
| `locale` | `string` | yes | pattern: `^[a-z]{2}(-[A-Z]{2})?$`; The visitor's language, as a BCP 47 tag. |

### `Session`

A session of an embedded client. The token is a bearer secret: keep it in memory only, never in a cookie or storage, and never log it.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `session_token` | `string` | yes | pattern: `^bts_[A-Za-z0-9_-]{43}$`; The session token (`sessionToken`), 32 random bytes in base64url after `bts_`. |
| `expires_at` | `string` | yes | format: `date-time`; The latest the session can last, 8 hours after the exchange. |
| `idle_timeout_seconds` | `integer` | yes | An idle gap this long ends the session sooner (`401 session_expired`). |
| `game` | [`GameSlug`](#gameslug) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `mode` | `string` | yes | enum: `real`, `demo`; `demo` plays in `FUN`, fun money, and never touches a wallet. |
| `reality_check` | [`RealityCheck`](#realitycheck) \| `null` | yes | The snapshotted reality-check schedule for this real-money session, or `null` when reality checks are off or `mode` is `demo`. |

### `SessionRoundCreate`

A round to open in the session; the session gives the brand, player, game and currency.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `stake` | [`Amount`](#amount) | yes | — |
| `params` | `object` | yes | The game's params, as in `RoundCreate` (DICE takes `DiceParams`, PACKS `PacksParams`, WHEEL `WheelParams`, and so on for every served game), and STACKOPASS `StackOPassParams`. |
| `live_seat` | [`LiveTableSeat`](#livetableseat) | no | STACKOPASS only, and required there: the seat at a live table the hand is bought in for (`createSessionRound`). Any other game refuses it (`400 invalid_request`). |

### `StackOPassParams`

A STACKOPASS hand's params: the table's fixed risk `N`, the devil's `1 in N` on every pack (round 2). It is a JSON integer literal, read as sent (`9.0`, `9e0` and `"9"` are `422 invalid_input`), and it must be the risk of the table `live_seat` names (`409 odds_changed` otherwise), so the player buys in at the odds the table showed. The round's record keeps these params as sent.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `risk` | `integer` | yes | enum: `9`, `5`, `3`; The table's risk. |

### `LiveTableSeat`

A seat at a live table (STACKOPASS): the table's id, as its frames name it (`StackOPassTableId` in `asyncapi.yaml`), and the seat, `0.. 5`. The table is one of the player's operator's (platform policy, per operator by default); another operator's answers as a gone one, `409 closed`. A seat whose hand has ended stays its player's for 90 s, so that player may buy in for it again and no one else can.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `table` | `string` | yes | pattern: `^[A-Za-z0-9_-]{22}$`; The table's id, 22 base64url characters `live` draws at random (never a counter). |
| `seat` | `integer` | yes | min: `0`; max: `5`; The seat, `0.. 5` clockwise. |

### `PlayerStatusSet`

The status to set.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `active`, `self_excluded`, `blocked`; `self_excluded` is the player's own choice and `blocked` the operator's; both stop new rounds. |

### `PlayerStatus`

A player's status.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `player_ref` | [`PlayerRef`](#playerref) | yes | — |
| `status` | `string` | yes | enum: `active`, `self_excluded`, `blocked`; The player's status. |
| `updated_at` | `string` | yes | format: `date-time`; When the status last changed. |

### `ForceCloseRequest`

Which of the player's open rounds to settle.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `game` | [`GameSlug`](#gameslug) | no | — |

### `ForceCloseResult`

The rounds a force-close settled, and how many it left.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `rounds` | array<[`Round`](#round)> | yes | maxItems: `1000`; Each round this call settled, in the order it settled them; at most 1,000 per call. |
| `pending` | `integer` | yes | min: `0`; Open rounds this call left, with money in flight or past the 1,000. Call again with a new `Idempotency-Key` until it is 0. |

### `SessionBalance`

A player's balance, as the wallet just answered it (a demo session's fun balance).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `balance` | [`Amount`](#amount) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |

### `LiveTicket`

A join ticket for one socket of a live game. It is a bearer credential for 30 s: keep it in memory, send it only as the `ticket.<ticket>` subprotocol (`joinTicket` in `asyncapi.yaml`), never in a URL, and never log it.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `ticket` | `string` | yes | pattern: `^v1\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]{43}$`; maxLength: `1024`; `v1.<base64url(payload)>.<base64url(HMAC-SHA256)>`, base64url without padding, so the whole ticket is an RFC 9110 token that fits in `Sec-WebSocket-Protocol`. Treat it as opaque: only `live` checks it. |
| `expires_at` | `string` | yes | format: `date-time`; The payload's `exp`, 30 s after the mint. A handshake after it is refused; get a new ticket. |

### `LiveBetGameSlug`

A live game whose money goes in as a REST bet (`createLiveBet`): TRAPDOOR's, KOMBATMP's and CRASH's. MEME_TRADE never: its money goes in as buy-ins to a round balance. STACKOPASS never: a hand is a session round, bought in with `createSessionRound`.

- **Type:** `string`
- **Constraints:** enum: `trapdoor`, `kombat-multiplayer`, `crash`

### `LiveShowIndex`

A show's public id: the index of its link in the published hash chain, the `show` and `index` of its frames and of its bets' records. It is a JSON integer, at most 2^53 − 1.

- **Type:** `integer`
- **Constraints:** min: `1`; max: `9007199254740991`

### `LiveBetCreate`

A bet on the show open for bets; the session gives the brand, player, game and currency.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `show` | [`LiveShowIndex`](#liveshowindex) | yes | — |
| `stake` | [`Amount`](#amount) | yes | — |
| `params` | [`TrapdoorBetParams`](#trapdoorbetparams) \| [`KombatmpBetParams`](#kombatmpbetparams) \| [`CrashBetParams`](#crashbetparams) | yes | The game's params, by the path's game: TRAPDOOR's `TrapdoorBetParams`, KOMBATMP's `KombatmpBetParams`, CRASH's `CrashBetParams`. A game added to `LiveBetGameSlug` adds its own schema here as a `oneOf` branch; params of another game than the path's are `422 invalid_input`. |

### `KombatmpBetParams`

A KOMBATMP bet's params (the game specification to): the market, the side, the pay the client was shown and the exchange count it was shown at, every one read as sent and never coerced (a JSON integer literal `at`, so `0.0` and `"0"` are `422 invalid_input`; strings for the rest). `kind` is `win`, or one of Red's side bets (`flawless`, `quick_ko`, `comeback`), which take `side` `red` only and are offered only before the bell. `pay` is a multiplier in the source's `PAY_PATTERN`, at most 2 decimals and written as short as the client likes (`"1.4"` is `1.40`); it must equal the round's offer for that market at `at`, and `at` must be the exchanges revealed as of the bet's arrival at `live` (every exchange whose step was due at or before it; `0` before exchange 1), or the bet is `409 odds_changed`. The round's id and the currency are not params: `show` and the session give them.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `kind` | `string` | yes | enum: `win`, `flawless`, `quick_ko`, `comeback`; The market. |
| `side` | `string` | yes | enum: `red`, `blue`; The side; `red` for every side bet. |
| `pay` | `string` | yes | pattern: `^(0\|[1-9][0-9]{0,6})(\.[0-9]{1,2})?$`; The multiplier offered for this market at `at`, as the round's `prices` show it (`"1.40"`, or `"1.4"`). |
| `at` | `integer` | yes | min: `0`; max: `31`; The exchanges revealed when the offer was shown, a JSON integer literal; it must be the count revealed as of the bet's arrival at `live`. |

### `KombatmpBetView`

A placed KOMBATMP bet (the game specification, the source's bet view): the `view` of a placed `LiveBet`, the `bet` of the bettor's `bet` frame (`KombatmpPlacedBet` in `asyncapi.yaml`) and the first view of the bet's record. `arena_bet_id` is the bet's number among its own player's bets in the round, reserved when the round takes the bet for placement and journaled with it, so it is the same after a takeover; a placement whose money failed spends its number, which no frame shows (after a takeover that number may be given to the player's next bet), so it can pass 12; no player is ever shown one number twice, and it never counts another player's or operator's bets. `at` is the exchanges revealed when it was priced, `pay` the multiplier locked with 2 decimals, and `reserved_profit` `⌊stake · pay / 100⌋ − stake`, what the bet holds against its brand's round pool and `max_exposure` until it settles.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `arena_bet_id` | `integer` | yes | min: `1`; The bet's number among its player's bets in the round, `1, 2, …`, with gaps where a placement's money failed. |
| `round_id` | [`LiveShowIndex`](#liveshowindex) | yes | — |
| `index` | [`LiveShowIndex`](#liveshowindex) | yes | — |
| `coin` | [`CurrencyCode`](#currencycode) | yes | — |
| `kind` | `string` | yes | enum: `win`, `flawless`, `quick_ko`, `comeback`; The market. |
| `side` | `string` | yes | enum: `red`, `blue`; The side (`red` for every side bet). |
| `at` | `integer` | yes | min: `0`; max: `30`; The exchanges revealed when the bet was priced (`0` before exchange 1). |
| `pay` | `string` | yes | pattern: `^(1\.(0[1-9]\|[1-9][0-9])\|([2-9]\|[1-9][0-9]{1,3})\.[0-9]{2})$`; The multiplier locked, with exactly 2 decimals, `1.01` to `9999.99`. |
| `stake` | [`Amount`](#amount) | yes | — |
| `reserved_profit` | [`Amount`](#amount) | yes | — |

### `CrashBetParams`

A CRASH bet's params: an optional `auto_cashout`, the multiplier at which the bet cashes out on its own, as a decimal string with at most 2 decimals from `1.01` to `1000000.00` (`"2"`, `"2.5"` and `"2.50"` are the same target; `"01.10"`, `"1.00"`, `"1.001"`, a JSON number and any other key are `422 invalid_input`). `{}` and `{"auto_cashout":null}` name none: the bet then rides until the crash or its cap (`cap_multiplier`). The stake is the body's `stake`, never a param.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `auto_cashout` | `string | null` | no | pattern: `^(1\.(0[1-9]\|[1-9][0-9]?)\|([2-9]\|[1-9][0-9]{1,5})(\.[0-9]{1,2})?\|1000000(\.00?)?)$`; The automatic cash-out target, `1.01` to `1000000.00`, at most 2 decimals, or `null` for none. |

### `CrashBetView`

A placed CRASH bet: the `view` of a placed `LiveBet`, the `bet` of the bettor's `bet` frame (`CrashPlacedBet` in `asyncapi.yaml`) and the first view of the bet's record. It holds the bet's inputs and limits only. `cap_multiplier` is snapshotted at the bet from the maximum profit: the bet exits on its own at its `auto_cashout`, else at `cap_multiplier`, so no payout is ever cut, and `exposure` is its credit at that exit, `⌊stake · exit / 100⌋`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `chain_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The show's chain, the `chain` of its `lobby` frame. |
| `round_index` | `integer` | yes | min: `1`; max: `10000000`; The show's chain index, `LiveBet.show` (the game specification bounds it at 10,000,000). |
| `bet_amt` | [`Amount`](#amount) | yes | — |
| `auto_cashout` | `string | null` | yes | pattern: `^(1\.(0[1-9]\|[1-9][0-9])\|([2-9]\|[1-9][0-9]{1,5})\.[0-9]{2}\|1000000\.00)$`; The bet's `auto_cashout` with exactly 2 decimals, or `null` when it named none. |
| `cap_multiplier` | `string` | yes | pattern: `^(1\.(0[1-9]\|[1-9][0-9])\|([2-9]\|[1-9][0-9]{1,5})\.[0-9]{2}\|1000000\.00)$`; The bet's cap `C_cap`, `min(1000000.00, 1 + ⌊100 · max_profit / stake⌋ / 100)`, with exactly 2 decimals. |
| `exposure` | [`Amount`](#amount) | yes | — |

### `TrapdoorBetParams`

A TRAPDOOR bean's params: the door for gate 1 and an optional pre-plan. Both are read as sent, never coerced: `door1` is a JSON integer literal (`1.0`, `1e0` and `"1"` are `422 invalid_input`), and so is every door and `bank_at` in the plan.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `door1` | `integer` | yes | min: `1`; max: `3`; The bean's door for gate 1 (`n_1 = 3` in both formats). A live `pick` for gate 1 replaces it. |
| `plan` | [`TrapdoorPlanInput`](#trapdoorplaninput) | no | — |

### `TrapdoorPlanInput`

A TRAPDOOR pre-plan as a client sends it: doors for later gates and "bank after surviving gate N". Absent, `null`, `[]`, `{}`, `{"doors":[]}`, `{"doors":null}` and `{"bank_at":null}` are the empty plan. A gate key is a gate in `2.. G` written without a leading zero (`"02"` is refused), a door is in `1.. n_g` for that gate, and `bank_at` is in `1.. G − 1`, where `G` is the show's format's (CLASSIC 8, MEGA 12) and `n_g` its gate's doors: the bounds below are MEGA's widest, and the show refuses a plan outside its own format's with `422 invalid_input` (`bad_plan` on the socket). The show answers with the plan as it keeps it, `TrapdoorPlan`.

- **Type:** `object | array | null`
- **Constraints:** maxItems: `0`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bank_at` | `integer | null` | no | min: `1`; max: `11`; Bank after surviving this gate, or `null` for no planned bank. |
| `doors` | `object | array | null` | no | maxItems: `0`; The door to play at each later gate, keyed by the gate as a decimal string; `[]` or `null` is no door. |

### `TrapdoorPlan`

A TRAPDOOR pre-plan as the show keeps it and answers it (the game specification, `planJson`): both keys always present, `doors` always an object, its gates in ascending order.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bank_at` | `integer | null` | yes | min: `1`; max: `11`; Bank after surviving this gate, or `null`. |
| `doors` | `object` | yes | The planned door per gate `2.. G`, keyed by the gate as a decimal string. |

### `TrapdoorEntryView`

A placed TRAPDOOR bean (the game specification, the source's entry): the `view` of a placed `LiveBet`, the `entry` of the bettor's `entry` frame and the first view of the bean's record. `cap_gate` is snapshotted at the bet: the bean banks `CAP` after surviving it, so no payout is ever cut.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `show` | [`LiveShowIndex`](#liveshowindex) | yes | — |
| `index` | [`LiveShowIndex`](#liveshowindex) | yes | — |
| `format` | `string` | yes | enum: `CLASSIC`, `MEGA`; The show's format, by its index (MEGA when the index is a multiple of 10, the game specification). |
| `bean` | `integer` | yes | min: `1`; max: `1`; The bean's label: its ordinal among its own player's beans in the show, so `1`, since a player holds one bean per show. It counts and orders no other player's bean, so it tells nothing of other players' or operators' bets; it is reserved when the show takes the bet and journaled with it, so a takeover gives the same; a placement whose money failed spends none, before or after a takeover; and it is never a player's identity. No broadcast names a bean. |
| `bet_amt` | [`Amount`](#amount) | yes | — |
| `cap_gate` | `integer` | yes | min: `1`; max: `12`; The bean's cap gate, the last gate whose exact profit fits the maximum profit. |
| `max_multiplier` | [`Multiplier`](#multiplier) | yes | `bank(cap_gate)`, the most this bean can bank, with 2 decimals. |
| `reserved_profit` | [`Amount`](#amount) | yes | The profit at `max_multiplier`, the bean's exposure less its stake. |
| `door1` | `integer` | yes | min: `1`; max: `3`; The door for gate 1 the bet named. |
| `plan` | [`TrapdoorPlan`](#trapdoorplan) | yes | — |

### `LiveBet`

A live bet as `createLiveBet` answers it. `view` is the game's placed view (TRAPDOOR's `TrapdoorEntryView`, KOMBATMP's `KombatmpBetView`, CRASH's `CrashBetView`), or `null` while the placement is `pending`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bet_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,48}$`; The bet's id, which is also its round id (`GET /v1/rounds/{id}`) and its wallet `round_id`. At most 48 characters, so the bet's request id in the show, `Bet:<bet_id>:<n>`, fits 64 bytes. |
| `game` | [`LiveBetGameSlug`](#livebetgameslug) | yes | — |
| `show` | [`LiveShowIndex`](#liveshowindex) | yes | — |
| `show_round_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}-[1-9][0-9]{0,15}$`; minLength: `3`; maxLength: `64`; The show's round id, `<chain>-<index>`: the published chain's id and the show's index, wallet-safe (no `:`), as MEME_TRADE's show round id (amended for). It names the show in BetPlug's records and in support; the bet's own wallet calls are named by `bet_id`. |
| `status` | `string` | yes | enum: `placed`, `pending`; `placed` (`201`): the show's journal holds the bet. `pending` (`202`): its placement is being resolved. |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `stake` | [`Amount`](#amount) | yes | — |
| `view` | [`TrapdoorEntryView`](#trapdoorentryview) \| [`KombatmpBetView`](#kombatmpbetview) \| [`CrashBetView`](#crashbetview) \| `null` | yes | The game's placed view, or `null` while `pending`. |

### `MemeTradeBuyInCreate`

A buy-in to the open MEME_TRADE v2 round balance; the session gives the brand, player and currency.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `round` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}[:-][1-9][0-9]{0,15}$`; minLength: `3`; maxLength: `64`; The open MEME_TRADE round id (`<chain>:<index>` from the socket's `round.id` or `<chain>-<index>`). |
| `amount` | [`Amount`](#amount) | yes | — |

### `MemeTradeBuyIn`

A MEME_TRADE buy-in as `createMemeTradeBuyIn` answers it.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `show` | [`LiveShowIndex`](#liveshowindex) | yes | — |
| `round` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}:[1-9][0-9]{0,15}$`; minLength: `3`; maxLength: `64`; The MEME_TRADE wire round id (`<chain>:<index>`). |
| `show_round_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}-[1-9][0-9]{0,15}$`; minLength: `3`; maxLength: `64`; The wallet-safe show round id (`<chain>-<index>`), sent as `round_id` on wallet debits, rollbacks and settlement credits. |
| `status` | `string` | yes | enum: `placed`, `pending`; `placed` (`201`): booked in `round_balance_entries`. `pending` (`202`): debit confirmed, booking being reconciled. |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `amount` | [`Amount`](#amount) | yes | — |
| `balance` | [`Amount`](#amount) \| `null` | yes | The player's updated round balance when `placed`, or `null` while `pending`. |

### `TransactionId`

BetPlug's id for one wallet call, deterministic and naming one attempt:

- a debit is `<round_id>:<step>:<attempt>:debit`, where `<step>` is the step's index in the record: 0 for the open, and for an action the round's `step` before it;
- a show bet's debit is `<bet_id>:0:<n>:debit`, and a MEME_TRADE buy-in's is `<player_round_id>:b<k>:<n>:debit`;
- a round's one credit is `<round_id>:credit`, and a MEME_TRADE player-round's is `<player_round_id>:credit`, one per player;
- a rollback is `<debit id>:rollback`.

The wallet answers the same id with its first answer, always.

- **Type:** `string`
- **Constraints:** pattern: `^[A-Za-z0-9_.:-]{1,200}$`

### `WalletBalanceRequest`

Whose balance, in which currency.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `player_ref` | [`PlayerRef`](#playerref) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |

### `WalletBalance`

The player's balance at the wallet.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `balance` | [`Amount`](#amount) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `status` | `string` | yes | enum: `active`, `self_excluded`, `blocked`; The player's status at the operator. |

### `WalletDebitRequest`

One debit attempt.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `transaction_id` | [`TransactionId`](#transactionid) | yes | — |
| `round_id` | [`RoundId`](#roundid) | yes | The round. On a MEME_TRADE buy-in's debit it is the show round, and `transaction_id` names the player's round. |
| `player_ref` | [`PlayerRef`](#playerref) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `amount` | [`Amount`](#amount) | yes | — |
| `game` | [`GameSlug`](#gameslug) | yes | — |
| `brand` | [`BrandId`](#brandid) | yes | — |

### `WalletCreditRequest`

A round's one credit.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `transaction_id` | [`TransactionId`](#transactionid) | yes | — |
| `round_id` | [`RoundId`](#roundid) | yes | The round. On a MEME_TRADE player-round's credit it is the show round, and `transaction_id` names the player's round. |
| `player_ref` | [`PlayerRef`](#playerref) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `amount` | [`Amount`](#amount) | yes | The round's `payout`, refund included, never `payout + refund`; for MEME_TRADE, the round balance's final total. It is 0 on a loss: every settled round sends exactly one credit. |
| `kind` | `string` | yes | enum: `payout`, `refund`; `refund` when the whole stake comes back unplayed (`refund` = `payout` = `stake`), as for a force-close refund before reveal or an aborted show, and for an aborted MEME_TRADE round, whose credit is its buy-ins. `payout` otherwise, a partial refund included, and on a loss. The kind labels the credit. It never changes `amount`. |
| `game` | [`GameSlug`](#gameslug) | yes | — |
| `brand` | [`BrandId`](#brandid) | yes | — |

### `WalletRollbackRequest`

The undoing of one debit attempt.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `transaction_id` | [`TransactionId`](#transactionid) | yes | — |
| `rollback_of` | [`TransactionId`](#transactionid) | yes | — |
| `round_id` | [`RoundId`](#roundid) | yes | The `round_id` the debit carried: on a MEME_TRADE buy-in's rollback, the show round. |
| `player_ref` | [`PlayerRef`](#playerref) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `amount` | [`Amount`](#amount) | yes | — |

### `WalletAnswer`

A booked debit, credit or rollback. It echoes the call's id, amount and currency, and adds the wallet's own `operator_transaction_id` and the player's `balance`. Those two fields are what no request body has, so a reflected request is never a valid answer, signed or not. An answer whose `operator_transaction_id` is missing, empty or equal to our `transaction_id` is **unknown**.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `transaction_id` | [`TransactionId`](#transactionid) | yes | — |
| `amount` | [`Amount`](#amount) | yes | — |
| `currency` | [`CurrencyCode`](#currencycode) | yes | — |
| `operator_transaction_id` | `string` | yes | minLength: `1`; maxLength: `200`; The wallet's own id for the booking; never empty and never our `transaction_id`. |
| `balance` | [`Amount`](#amount) | yes | — |

### `WalletRefusal`

Why the wallet refused a debit. It echoes the debit's id, so a refusal is bound to its attempt.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `code` | `string` | yes | enum: `insufficient_funds`, `player_blocked`, `limit_exceeded`, `invalid_request`; `limit_exceeded` is the operator's responsible-gaming limits; `invalid_request` also refuses a tombstoned id. |
| `transaction_id` | [`TransactionId`](#transactionid) | yes | — |

### `WalletProtocolRefusal`

A balance read, credit or rollback the wallet cannot parse. It is never a refusal on balance, limits or status.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `code` | `string` | yes | enum: `invalid_request`; The only code a balance read, credit or rollback may answer. |
| `transaction_id` | [`TransactionId`](#transactionid) | no | — |

### `Liveness`

The public liveness answer. It carries `ok` and nothing else.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `ok` | `boolean` | yes | Always true when the process answers. |

### `ProblemCode`

A stable error code. Clients branch on it, never on `title` or `detail`. The set is **open**: a new code is an additive change, so a client must handle an unknown one as its HTTP status.

The enum lists every code in use, and `x-betrail-status` gives each one's HTTP status. The engine codes come from `engine.Codes`, alongside the platform error codes (including `round_open` for a seed rotation while a round on the pair is unfinished). `verify_mismatch` is not here: a verification that fails is an answer (HTTP 200, `{"result":"verify_mismatch",...}` in the verify response), never a problem.

- **Type:** `object`

### `Problem`

An error, as RFC 9457 problem details, with a stable `code`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `string` | yes | format: `uri`; `https://betrail.example/problems/<code>`, a page that explains the code. |
| `title` | `string` | yes | A short summary of the code, the same for every occurrence. |
| `status` | `integer` | yes | min: `400`; max: `599`; The HTTP status, repeated. |
| `detail` | `string` | no | This occurrence, in words safe to show the caller. |
| `instance` | `string` | no | An identifier of this occurrence, to quote to support. |
| `code` | [`ProblemCode`](#problemcode) | yes | — |
| `max_stake` | `string` | no | pattern: `^[0-9]+(\.[0-9]+)?$`; With `max_stake` only, the largest stake this bet takes, in the currency's units. |
| `elapsed_seconds` | `integer` | no | min: `0`; With `reality_check_due` only, whole seconds elapsed since the player session was created. |
| `net_result` | [`SignedAmount`](#signedamount) | no | With `reality_check_due` only, the exact settled net result (`payout - stake`) for this player session. |

### `PageInfo`

Every list answer carries it next to its `data` array.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `next_cursor` | `string | null` | yes | Pass it as `cursor` to fetch the next page; null on the last page. |

## AsyncAPI component schemas

All object schemas enforce strict JSON decoding (`additionalProperties: false`) unless noted otherwise.

### `WebhookHeaders`

The headers of every webhook delivery; the signature is the webhookSignature scheme's.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `Betrail-Webhook-Id` | `string` | yes | The event id; the same on every retry, so a receiver drops duplicates by it. |
| `Betrail-Timestamp` | `string` | yes | pattern: `^[0-9]{10}$`; Unix time in seconds when this delivery was signed. |
| `Betrail-Nonce` | `string` | yes | pattern: `^[A-Za-z0-9_-]{16,64}$`; New on every delivery attempt (the outbox row's id with its attempt); a receiver refuses one it has seen. |
| `Betrail-Signature` | `string` | yes | pattern: `^v1=[0-9a-f]{64}(,v1=[0-9a-f]{64})?$`; See the webhookSignature scheme. |

### `Amount`

An amount in the currency's units, as a decimal string at the currency's scale (as in the REST API).

- **Type:** `string`
- **Constraints:** pattern: `^(0|[1-9][0-9]{0,29})(\.[0-9]{1,18})?$`

### `UsdAmount`

A USD amount of BetPlug's credits, with exactly 6 decimals; it is negative when credits are below 0.

- **Type:** `string`
- **Constraints:** pattern: `^-?(0|[1-9][0-9]{0,15})\.[0-9]{6}$`

### `RoundSettledEvent`

A round.settled event. `data` is the round, exactly as `GET /v1/rounds/{id}` answers it.

- **Type:** `WebhookEvent & object`

- **`allOf[0]`:** [`WebhookEvent`](#webhookevent)

- **`allOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"round.settled"` | yes | const: `"round.settled"` |
| `data` | `object` | yes | The REST API's `Round` (api/openapi.yaml), with `status` settled. |

### `CreditsLowEvent`

A credits.low event, sent once each time the balance crosses below the threshold. Its `environment` is always `live`: credits pay for live play only.

- **Type:** `WebhookEvent & object`

- **`allOf[0]`:** [`WebhookEvent`](#webhookevent)

- **`allOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"credits.low"` | yes | const: `"credits.low"` |
| `environment` | `"live"` | yes | const: `"live"`; Always `live`. |
| `data` | `object` | yes | The operator's credits in USD, with exactly 6 decimals (micro-USD). |

### `CreditsExhaustedEvent`

A credits.exhausted event, sent once each time a posting takes the operator's credits from above 0 to 0 or below. From then on new live rounds answer `402 credits_exhausted` until the credits are above 0 again (a top-up or a credit); open rounds still finish, and sandbox keeps working. It has no hysteresis: the next crossing after the credits rise again sends it again.

- Its `environment` is always `live`: credits pay for live play only.
- A posting that also crosses the low threshold while `credits.low` is armed sends both events, each with its own id, in no guaranteed order.

---

- **Type:** `WebhookEvent & object`

- **`allOf[0]`:** [`WebhookEvent`](#webhookevent)

- **`allOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"credits.exhausted"` | yes | const: `"credits.exhausted"` |
| `environment` | `"live"` | yes | const: `"live"`; Always `live`. |
| `data` | `object` | yes | The operator's credits in USD, with exactly 6 decimals (micro-USD), in the same shape as `credits.low`'s. |

### `LiveFrame`

The envelope of every frame BetPlug sends on a live socket. Amounts in a frame are decimal strings in the currency's units, and prices and multipliers are decimal strings too, as in the REST API; never JSON numbers with a fraction.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `string` | yes | The frame type (welcome, snapshot, round, step, result, paid, ack, error); each game's spec lists its own. The frame that tells a player their bet settled carries a `LiveSettlement` in `data`, whatever the game names it. `aborted` tells every socket that the outage rule ended the show: its bets settle as `LiveSettlement` says, and its seed is revealed. MEME_TRADE also sends `skipped_link` when a chain index's integer price path passes int64 before its presale opens. |
| `game` | `string` | yes | The game's slug. |
| `seq` | `integer` | yes | min: `0`; Increases by one per frame on this socket, so a client sees a gap and asks for a snapshot. |
| `at` | `integer` | yes | Unix milliseconds: the time of the one thing that caused the frame, never a time `live` reached after waiting on other players' work (the tick barrier, a shared queue, a wallet or the store; the platform's Time rule, the arrival rule). Every frame of every game has exactly one of four causes: **a step** (a show's scheduled step, or a table's turn deadline): the step's published time, its due time on the show's schedule (KOMBATMP's bell carries `bell_at`, which its `round` frame published, though `live` runs it after the 250 ms pre-fight grace), on every frame and settlement the step makes, broadcast or sent: a lobby or a round opening on the schedule, a tick, a bell, an exchange, a reveal and its `bean` frames, a crash, a rug, a fight's end and its payouts, a table's timeout move and the turn it starts; **a command** (a player's socket command, a REST bet, the platform's `force_close`): the command's own arrival at `live`, taken when `live` receives it, before any queue it shares with other players, on its `ack` or `error`, a bet's `entry` or `bet` frame (the bet's arrival, never the time its wallet answered), a `snapshot` it asked for, and every frame and settlement it makes; **a socket's join**: the time the socket joined, on `welcome` and anything else `live` sends that socket because it joined; **the outage rule**: the time the rule ended the show, which no bet moves, on `aborted` and the settlements it makes. |
| `request_id` | `string` | no | On an ack or an error, the request id of the command it answers. |
| `data` | `object` | no | The frame's body, per game and type. A refused socket command's code is here, from the game's spec (MEME_TRADE's `insufficient_balance`). |

### `LiveCommand`

The envelope of every command a player sends on a live socket.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `string` | yes | The command type. `snapshot` in every game; each game's spec lists its own in-round commands, such as MEME_TRADE's `open`, `close`, `sidebet` and `auto_sell`, TRAPDOOR's `pick`, `bank` and `plan` (`TrapdoorCommand`), STACKOPASS's `watch`, `open`, `pass`, `cashout` and `leave` (`StackOPassCommand`), and CRASH's `cashout` (`CrashCommand`); KOMBATMP has none, so `snapshot` is its only socket kind (`KombatmpCommand`). Some kinds are the platform's and never a player's: `force_close` in every game (in any spelling), TRAPDOOR's `no_pick` and `disconnect`, which `live` sends at a window's close, and STACKOPASS's forced cash-out and timeout pass, which its table makes itself. A bet, and STACKOPASS's buy-in, is never a socket command: it goes in over REST (`createLiveBet`, `createSessionRound`). A player's command of any kind outside its game's socket kinds, a platform kind included, is refused `invalid_action` before the show sees it, and no player-facing schema lists a platform kind. |
| `request_id` | `string` | yes | minLength: `1`; maxLength: `64`; Chosen by the client; a repeated id gets the first answer again (each game says for how long). An id that starts with `Platform:`, in any case or spelling, is the platform's namespace and is refused `invalid_input`; on a game that takes REST bets so will be `Bet:`, their request-id prefix (`TrapdoorSocketRequestId`, `CrashSocketRequestId`). |
| `data` | `object` | no | The command's body, per game and type. |

### `LiveSettledFrame`

The frame that tells a player their bet settled: the `LiveFrame` envelope, whose `type` the game's spec names, with a `LiveSettlement` in `data`.

- **Type:** `LiveFrame & object`

- **`allOf[0]`:** [`LiveFrame`](#liveframe)

- **`allOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `data` | [`LiveSettlement`](#livesettlement) | yes | — |

### `LiveSettlement`

How a live bet's settlement reads: the `data` of the frame that tells its player. Its record's last step holds the same `stake`, `payout`, `refund` and `view`. Every live bet settles once, by one of three paths, which `settled_by` names:

- `play`: by the game's own rules (a bank, a cash-out, a crash, the fight's end, the rug);
- `force_close`: by the platform's force-close of that one bet (the operator's call, an account action, `worker`'s inactivity rule), while the show ran on;
- `outage`: by the live outage rule, which ended the show at its last journaled step. A TRAPDOOR or CRASH bet open there settled as force-close would have settled it there, and nothing already settled is undone; a STACKOPASS hand was force-closed where it stood; a KOMBATMP bet was refunded whole (preserves source outage behaviour). A MEME_TRADE round that an outage ends is voided instead (its source's behaviour): its book returns the buy-ins, and its player-rounds and sidebets are void, not settled.

`view` is the game's settled view, its spec's `game_result`. After an outage under the force-close rule it is the game's force-close view for the bet's state, with the reason the view gives for how the bet ended naming the abort (`ABORT` in TRAPDOOR's and CRASH's `reason`). `refund` is the part of `payout` that is stake returned unplayed, so `refund` <= `payout` and `refund` <= `stake`: a full refund reads `refund` = `payout` = `stake`, a bet with nothing returned unplayed reads `refund` = 0, and a MEME_TRADE player-round whose presale positions were unwound returns part of its stake. `payout` includes `refund` and is never paid on top of it.

The first example is a TRAPDOOR bean alive after gate 3 when an outage ended its show: it banks `bank(3)`. The second is a bean the outage found in the lobby: a full refund.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bet_id` | `string` | yes | minLength: `1`; maxLength: `64`; The bet's id (for MEME_TRADE, the player-round's or the sidebet's). |
| `currency` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The bet's currency. |
| `stake` | [`Amount`](#amount-1) | yes | — |
| `payout` | [`Amount`](#amount-1) | yes | — |
| `refund` | [`Amount`](#amount-1) | yes | — |
| `settled_by` | `string` | yes | enum: `play`, `force_close`, `outage`; Which of the three paths settled the bet. |
| `view` | `object` | yes | The game's settled view (its spec's `game_result`). |

### `WebhookEvent`

The envelope of every webhook event.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `id` | `string` | yes | The event id (also in `Betrail-Webhook-Id`). |
| `type` | `string` | yes | The event type (round.settled, credits.low, credits.exhausted). |
| `created_at` | `string` | yes | format: `date-time`; When the event happened. |
| `environment` | `string` | yes | enum: `sandbox`, `live`; The environment it happened in. |
| `data` | `object` | yes | The event's body, per type. |

### `LiveSelfBet`

One of the authenticated viewer's own bets on a shared show.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bet_id` | `string` | yes | minLength: `1`; maxLength: `64`; The bet's id. |
| `currency` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The bet's currency. |
| `stake` | [`Amount`](#amount-1) | yes | — |
| `payout` | [`Amount`](#amount-1) | no | — |
| `settled` | `boolean` | yes | Whether the bet has settled. |

### `LiveCurrencyAggregate`

Coarse anonymous stake total in one currency over the viewer's operator's bets.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `currency` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The currency code. |
| `bets_count` | `integer` | yes | min: `1`; How many bets make up `total_stake`. |
| `total_stake` | [`Amount`](#amount-1) | yes | — |

### `MemeTradePrice`

A price on MEME_TRADE v2's path in units of the 1.00x start price, formatted as an exact decimal string with 12 fractional digits (`P / 10^12` at fixed scale; never a JSON float).

- **Type:** `string`
- **Constraints:** pattern: `^(0|[1-9][0-9]*)\.[0-9]{12}$`

### `MemeTradeRoundId`

MEME_TRADE v2's wire round identifier (`<chain>:<index>`; distinct from the wallet-safe show round id `<chain>-<index>`).

- **Type:** `string`
- **Constraints:** pattern: `^[A-Za-z0-9_-]{1,43}:[0-9]{1,20}$`; minLength: `3`; maxLength: `64`

### `MemeTradePlayer`

Projected player identity on MEME_TRADE's wire. A seated viewer sees only their own entry as `"self"` (`id: "self"`, `name: "self"`); an unseated spectator's `me.player` carries `""`. Another player's `player_ref` or composite key never leaves the live server.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `id` | `string` | yes | The value `"self"` for the authenticated viewer, or `""` for an unseated spectator in `me.player`. |
| `name` | `string` | yes | The value `"self"` for the authenticated viewer, or `""` for an unseated spectator in `me.player`. |
| `level` | `integer` | yes | min: `0`; Display level (`0` in BetPlug's projection). |
| `avatarUrl` | `string` | no | Optional avatar URL when set. |

### `MemeTradeCoinConfig`

One coin's precision and per-bet limits on MEME_TRADE's wire, in coin units.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `code` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The currency code. |
| `name` | `string` | yes | minLength: `1`; Display name of the coin. |
| `decimals` | `integer` | yes | min: `0`; max: `8`; Fractional digits `d` of an atom in coin units. |
| `minBet` | [`Amount`](#amount-1) | yes | — |
| `maxBet` | [`Amount`](#amount-1) | yes | — |
| `maxProfit` | [`Amount`](#amount-1) | yes | — |
| `usdPrice` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)(\.[0-9]+)?$`; Display-only USD reference price as a decimal string. |

### `MemeTradeLink`

A round's pre-committed hash-chain link as published. `commit` is `s_{i-1}`, SHA-256 of round `i`'s server seed `s_i`, which stays withheld until the round's `rug` frame (or `skipped_link`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `chain` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The published hash chain's id (`<chain>:<index>` is the wire round id). |
| `index` | `integer` | yes | min: `1`; max: `9007199254740991`; 1-based link index `i` in the chain. |
| `commit` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Lowercase hex SHA-256 commitment `s_{i-1} = sha256_hex(s_i)`. |
| `salt` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Lowercase hex public salt fixed before link 1 opened. |
| `salt_source` | `string` | yes | minLength: `1`; Pre-announced external salt source (such as `bitcoin:<height>`). |

### `MemeTradeRoundInfo`

Public state of a MEME_TRADE v2 round. `rugTick` and `serverSeed` stay `null` until the round rugs.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `id` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `link` | [`MemeTradeLink`](#memetradelink) | yes | — |
| `presaleEndsAt` | `integer` | yes | Unix time in milliseconds when the 10 s presale ends. |
| `startedAt` | `integer | null` | yes | Unix time in milliseconds when active ticks began, or `null` during presale. |
| `tick` | `integer` | yes | min: `0`; The last tick played: `0` in the presale and after `start` until the first tick, then the `tick` of the latest `tick` frame (of the `rug` frame once rugged). |
| `price` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `peak` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `rugTick` | `integer | null` | yes | min: `1`; Tick at which the round rugged, or `null` before the rug. |
| `serverSeed` | `string | null` | yes | pattern: `^[0-9a-f]{64}$`; Revealed 64-hex server seed `s_i` once rugged, or `null` before the rug. |

### `MemeTradeCandle`

One OHLC summary candle of a finished round's integer price path.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `index` | `integer` | yes | min: `0`; 0-based candle index. |
| `startTick` | `integer` | yes | min: `0`; First tick covered by the candle. |
| `endTick` | `integer` | yes | min: `0`; Last tick covered by the candle. |
| `open` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `high` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `low` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `close` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `closed` | `boolean` | yes | Whether the candle is complete. |
| `god` | `boolean` | yes | Whether the candle contains a god jump (`next >= 5 * prev`). |
| `rug` | `boolean` | yes | Whether the candle ends on the rug tick. |

### `MemeTradeRoundSummary`

Summary of an ended MEME_TRADE v2 round in `rug.summary` and `snapshot.history`: its whole price path, which the `rug` frame reveals. A round an outage aborted stopped before its path's rug (see `MemeTradeRug`). It carries no player count (platform policy).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `id` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `link` | [`MemeTradeLink`](#memetradelink) | yes | — |
| `peak` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `rugTick` | `integer` | yes | min: `1`; Tick at which the round's path rugs; a round an outage aborted ended before it (`MemeTradeRug.tick`). |
| `rugPrice` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `miniCandles` | array<[`MemeTradeCandle`](#memetradecandle)> | yes | Downsampled OHLC candles of the round's path. |
| `serverSeed` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Revealed 64-hex server seed `s_i` (`sha256_hex(s_i) == link.commit`). |
| `endedAt` | `integer` | yes | Unix time in milliseconds when the round ended: its rug in play, or the outage abort. |

### `MemeTradePosition`

A player's position in fixed-point coin units: `initialMargin` has `d + 4` fractional digits, `margin` (signed after funding) and `fundingPaid` have `d + 8`, `units` has `d + 8` (display only), and `invested` and `realized` are formatted at the coin's `d` decimals.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `side` | `string` | yes | enum: `long`, `short`; Position direction. |
| `leverage` | `integer` | yes | min: `1`; max: `5`; Integer leverage `1..5`. |
| `units` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{8,16}$`; Display-only exposure in coin units per `1.00x`, floored to `d + 8` decimals. |
| `entry` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `margin` | `string` | yes | pattern: `^-?(0\|[1-9][0-9]*)\.[0-9]{8,16}$`; Exact signed margin `G` in coin units with `d + 8` decimals (`G` may go negative while in profit). |
| `initialMargin` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{4,12}$`; Exact initial margin `M` of the held units in coin units with `d + 4` decimals. |
| `invested` | [`Amount`](#amount-1) | yes | — |
| `realized` | [`Amount`](#amount-1) | yes | — |
| `fundingPaid` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{8,16}$`; Exact cumulative funding paid `F` in coin units with `d + 8` decimals. |
| `buys` | `integer` | yes | min: `0`; Number of opens/adds in this player-round. |
| `sells` | `integer` | yes | min: `0`; Number of closes in this player-round. |
| `openedTick` | `integer` | yes | min: `0`; Tick at which the current position opened (`0` in presale). |
| `lastTradeTick` | `integer` | yes | min: `0`; Tick of the most recent fill (`0` in presale). |

### `MemeTradePositionWithCoin`

A player's position paired with its coin code (`me.position` and `position.position`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `coin` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The position's currency code. |
| `side` | `string` | yes | enum: `long`, `short`; Position direction. |
| `leverage` | `integer` | yes | min: `1`; max: `5`; Integer leverage `1..5`. |
| `units` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{8,16}$`; Display-only exposure in coin units per `1.00x`, floored to `d + 8` decimals. |
| `entry` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `margin` | `string` | yes | pattern: `^-?(0\|[1-9][0-9]*)\.[0-9]{8,16}$`; Exact signed margin `G` in coin units with `d + 8` decimals (`G` may go negative while in profit). |
| `initialMargin` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{4,12}$`; Exact initial margin `M` of the held units in coin units with `d + 4` decimals. |
| `invested` | [`Amount`](#amount-1) | yes | — |
| `realized` | [`Amount`](#amount-1) | yes | — |
| `fundingPaid` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{8,16}$`; Exact cumulative funding paid `F` in coin units with `d + 8` decimals. |
| `buys` | `integer` | yes | min: `0`; Number of opens/adds in this player-round. |
| `sells` | `integer` | yes | min: `0`; Number of closes in this player-round. |
| `openedTick` | `integer` | yes | min: `0`; Tick at which the current position opened (`0` in presale). |
| `lastTradeTick` | `integer` | yes | min: `0`; Tick of the most recent fill (`0` in presale). |

### `MemeTradePlayerSnapshot`

The viewer's own seated entry in `snapshot.players` or `players.players` (`player.id == "self"`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `player` | [`MemeTradePlayer`](#memetradeplayer) | yes | — |
| `coin` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The seat's currency code. |
| `position` | [`MemeTradePosition`](#memetradeposition) | yes | — |
| `rugged` | `boolean` | yes | Whether the held long was lost on the rug. |
| `liquidated` | `boolean` | yes | Whether the held leveraged position was liquidated. |

### `MemeTradeTrade`

One fill (`open`, `close`, or `liquidation`), sent only to the trader who owns it (`player.id == "self"`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `id` | `string` | yes | minLength: `1`; Deterministic per-player fill id within the round (`t-<roundId>-<n>`, counting this player's own fills only; carries no show-wide player or command counter). |
| `roundId` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `player` | [`MemeTradePlayer`](#memetradeplayer) | yes | — |
| `coin` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The trade's currency code. |
| `side` | `string` | yes | enum: `buy`, `sell`; Market order side (`buy` or `sell`). |
| `kind` | `string` | yes | enum: `open`, `close`, `liquidation`; Fill kind. |
| `direction` | `string` | yes | enum: `long`, `short`; Position direction (`long` or `short`). |
| `leverage` | `integer` | yes | min: `1`; max: `5`; Position leverage `1..5`. |
| `tick` | `integer` | yes | min: `0`; Fill tick (`0` in presale). |
| `price` | [`MemeTradePrice`](#memetradeprice) | yes | — |
| `amount` | [`Amount`](#amount-1) | yes | — |
| `units` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{8,16}$`; Display-only units filled at `d + 8` decimals. |
| `presale` | `boolean` | yes | Whether the fill happened during presale (`1.00x`). |
| `auto` | `boolean` | yes | Whether the fill is a close the server made on a trigger of its own: `true` on a take-profit, stop-loss or max-profit close, on a short closed by the rug, and on a force-close. `false` on the player's own `open` or `close`, and also on a liquidation: the server makes that fill too, but `kind: liquidation` is what marks it. |
| `at` | `integer` | yes | Server fill timestamp in Unix milliseconds. |
| `fraction` | `string` | no | pattern: `^(0\.[0-9]{4}\|1\.0000)$`; Requested close fraction `k / 10,000` with 4 decimals (`"1.0000"` on a full or dust close; omitted on `open`). |
| `pnl` | `string` | no | pattern: `^-?(0\|[1-9][0-9]*)\.[0-9]{4,12}$`; Display-only realized PnL of a close or liquidation in coin units with `d + 4` decimals (omitted on `open`). |
| `autoReason` | `string` | no | enum: `takeProfit`, `stopLoss`, `forceClose`; Automatic close trigger when set (`takeProfit`, `stopLoss`, or `forceClose`). `abort` is deliberately not in this enum: under the live outage policy, an outage voids the round and refunds buy-ins. |

### `MemeTradeSidebet`

One 40-tick `4.67x` rug sidebet.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `id` | `string` | yes | minLength: `1`; Deterministic per-player sidebet id within the round (`sb-<roundId>-<n>`, counting this player's own sidebets only; carries no show-wide player or command counter). |
| `roundId` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `coin` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The sidebet's currency code. |
| `amount` | [`Amount`](#amount-1) | yes | — |
| `placedTick` | `integer` | yes | min: `0`; Tick at which the sidebet was placed (`0` in presale). |
| `endTick` | `integer` | yes | min: `1`; Last tick on which a rug wins the sidebet (`placedTick + 40`). |
| `payout` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$`; Sidebet payout multiplier with 2 decimals (`"4.67"`). |
| `status` | `string` | yes | enum: `open`, `won`, `lost`; Current sidebet status. |
| `settledTick` | `integer | null` | yes | min: `1`; Tick at which the sidebet won or expired, or `null` while `open`. |

### `MemeTradeAutoSell`

Armed take-profit multiple (`1.10..10.00`) and stop-loss share (`0.05..0.90`), each `null` when off.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `multiple` | `string | null` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$`; Take-profit multiple with 2 decimals (`"1.10"` to `"10.00"`), or `null` when off. |
| `stopLoss` | `string | null` | yes | pattern: `^0\.[0-9]{2}$`; Stop-loss share with 2 decimals (`"0.05"` to `"0.90"`), or `null` when off. |

### `MemeTradeMe`

The connecting viewer's own state inside `MemeTradeSnapshot`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `player` | [`MemeTradePlayer`](#memetradeplayer) | yes | — |
| `balances` | `object` | yes | Round balances keyed by currency code, formatted as `Amount` strings. |
| `position` | [`MemeTradePositionWithCoin`](#memetradepositionwithcoin) \| `null` | yes | The viewer's position in the current round, or `null` if never seated in it. |
| `sidebet` | [`MemeTradeSidebet`](#memetradesidebet) \| `null` | yes | The viewer's latest sidebet in the current round, or `null` if none. |
| `autoSell` | [`MemeTradeAutoSell`](#memetradeautosell) \| `null` | yes | The viewer's armed take-profit / stop-loss setting, or `null` when both are off. |

### `MemeTradeSnapshot`

MEME_TRADE v2's show snapshot (`version: 3`), projected per viewer inside `MemeTradeProjectedSnapshot.show`: `prices` holds `P_0..P_tick` only, and `players` holds at most the viewer's own entry as `"self"`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"snapshot"` | yes | const: `"snapshot"`; Always `snapshot`. |
| `version` | `integer` | yes | const: `3`; MEME_TRADE v2's wire version (`3`). |
| `serverTime` | `integer` | yes | Server time in Unix milliseconds. |
| `phase` | `string` | yes | enum: `presale`, `active`, `rugged`; Current round phase. |
| `round` | [`MemeTradeRoundInfo`](#memetraderoundinfo) | yes | — |
| `prices` | array<[`MemeTradePrice`](#memetradeprice)> | yes | Revealed prices `P_0..P_tick` (`["1.000000000000"]` in presale). |
| `players` | array<[`MemeTradePlayerSnapshot`](#memetradeplayersnapshot)> | yes | maxItems: `1`; Projected seated list containing `[self]` when seated or `[]` otherwise. |
| `history` | array<[`MemeTradeRoundSummary`](#memetraderoundsummary)> | yes | Recent finished rounds, newest first. |
| `coins` | array<[`MemeTradeCoinConfig`](#memetradecoinconfig)> | yes | Active coins and their limits in this round. |
| `me` | [`MemeTradeMe`](#memetrademe) | yes | — |

### `MemeTradeProjectedSnapshot`

`data` of a `snapshot` frame on `/v1/live/meme-trade` while a round is open: the viewer-projected `MemeTradeSnapshot` under `show` plus the viewer's own tracked bets and their operator's stake totals (no whole-round totals are ever sent).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `show` | [`MemeTradeSnapshot`](#memetradesnapshot) | yes | — |
| `self_bets` | array<[`LiveSelfBet`](#liveselfbet)> | no | Viewer's own tracked show bets when present. |
| `operator_totals` | array<[`LiveCurrencyAggregate`](#livecurrencyaggregate)> | no | Anonymous stake totals over the viewer's operator's bets when present. |

### `MemeTradeIdleSnapshot`

`data` of a `snapshot` answer on `/v1/live/meme-trade` during the hold between rounds when no round is open.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `phase` | `"idle"` | yes | const: `"idle"`; Always `idle`. |

### `MemeTradePresale`

`data` of a `presale` broadcast opening a new MEME_TRADE v2 round (`round.serverSeed` and `round.rugTick` are `null`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"presale"` | yes | const: `"presale"`; Always `presale`. |
| `serverTime` | `integer` | yes | Server time in Unix milliseconds. |
| `round` | [`MemeTradeRoundInfo`](#memetraderoundinfo) | yes | — |

### `MemeTradeStart`

`data` of a `start` broadcast closing the 10 s presale and beginning active ticks.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"start"` | yes | const: `"start"`; Always `start`. |
| `serverTime` | `integer` | yes | Server time in Unix milliseconds. |
| `roundId` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `startedAt` | `integer` | yes | Unix time in milliseconds when active play began. |

### `MemeTradeTick`

`data` of a `tick` broadcast publishing `P_tick` (`tick >= 1`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"tick"` | yes | const: `"tick"`; Always `tick`. |
| `serverTime` | `integer` | yes | Server time in Unix milliseconds. |
| `roundId` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `tick` | `integer` | yes | min: `1`; 1-based tick index. |
| `price` | [`MemeTradePrice`](#memetradeprice) | yes | — |

### `MemeTradeRug`

`data` of a `rug` broadcast ending the round and revealing its `serverSeed` `s_i`. A round ends in one of two ways. In play its path rugs: `tick` is `summary.rugTick` and `price` is `summary.rugPrice`. Or an outage aborts it: the round stops at its last committed tick, before its path's rug, so `tick` is less than `summary.rugTick`. A client tells an abort from a rug in play by the `aborted` frame (`LiveFrame.type`) that follows this one. An abort voids the round: every trade and sidebet of it is void, whether still open, closed or already settled, and each player's buy-ins go back in full (see `LiveSettlement`). Before the abort a player may already have been sent a `LiveSettlement` for a sidebet that expired in play (`settled_by: play`, lost, `payout` 0): the abort voids that sidebet too, and its stake goes back with the buy-ins. Nothing else settles before a round ends: a player-round settles, and a sidebet wins, only at the rug in play. The abort itself sends no `LiveSettlement`, and no `trade`, `sidebet`, `position` or `balance` frame says what it voided or returned: this `rug` and then `aborted` are the round's last frames.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"rug"` | yes | const: `"rug"`; Always `rug`. |
| `serverTime` | `integer` | yes | Server time in Unix milliseconds. |
| `roundId` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `tick` | `integer` | yes | min: `0`; The tick at which the round ended: the rug tick in play (always >= 1), or, when an outage aborted the round, its last committed tick, which is `0` if the abort came before the first tick (in the presale, or after `start`). |
| `price` | [`MemeTradePrice`](#memetradeprice) | yes | The price at `tick`: the rug price in play, or the last published price when an outage aborted the round (`"1.000000000000"` before the first tick). |
| `peak` | [`MemeTradePrice`](#memetradeprice) | yes | The highest price on the round's whole path. When an outage aborted the round, the path is revealed past `tick`, so the peak may be a price that was never published as a `tick`. |
| `serverSeed` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Revealed 64-hex server seed `s_i` (`sha256_hex(s_i) == summary.link.commit`). An outage abort reveals it too. |
| `summary` | [`MemeTradeRoundSummary`](#memetraderoundsummary) | yes | The round's summary. When an outage aborted the round, its `rugTick`, `rugPrice`, `peak` and `miniCandles` describe the whole revealed path, whose rug comes after `tick`, and its `endedAt` is the time of the abort. |

### `MemeTradeTradeMsg`

`data` of a player-directed `trade` frame reporting one fill (`trade.player.id == "self"`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"trade"` | yes | const: `"trade"`; Always `trade`. |
| `trade` | [`MemeTradeTrade`](#memetradetrade) | yes | — |

### `MemeTradePlayers`

`data` of a player-projected `players` frame (`[self]` when holding a seat, `[]` otherwise; never another player).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"players"` | yes | const: `"players"`; Always `players`. |
| `roundId` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `players` | array<[`MemeTradePlayerSnapshot`](#memetradeplayersnapshot)> | yes | maxItems: `1`; Projected seated entry for this viewer (`[self]` or `[]`). |

### `MemeTradeSidebetMsg`

`data` of a player-directed `sidebet` frame (`playerId == "self"`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"sidebet"` | yes | const: `"sidebet"`; Always `sidebet`. |
| `roundId` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `playerId` | `string` | yes | const: `"self"`; Always `"self"` after per-player projection. |
| `sidebet` | [`MemeTradeSidebet`](#memetradesidebet) | yes | — |

### `MemeTradeBalance`

`data` of a player-directed `balance` frame updating the player's round balance in `coin`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"balance"` | yes | const: `"balance"`; Always `balance`. |
| `coin` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The round balance's currency code. |
| `balance` | [`Amount`](#amount-1) | yes | — |

### `MemeTradeAckError`

Refusal carried by `MemeTradeAck.error` (`insufficient_balance`, `below_min`, `above_max`, `max_profit`, `wrong_phase`, `no_position`, `sidebet_open`, `leverage_not_allowed`, `position_conflict`, `rate_limited`, `invalid_input`, `invalid_action`, `pending`, or `unknown`). `pending` answers a command `live` took but did not apply as sent, and `reason` says why and whether the client may send it again:

- `tick_barrier_fenced`: the command's plan was still in flight when the tick barrier ran out ("What is left"). `live` fenced it, and it was neither applied nor decided: the client sends a new id.
- `not_applied`: the store refused to move the command's money, and nothing changed: the client may send a new id.
- `tombstoned`: the command's id was tombstoned while the command was in flight. Nothing changed, and the id stays void: the client sends a new id.
- `request_voided`: the store already holds the id void, and nothing changed: the client sends a new id.
- `duplicate_request`: the store already holds a command applied under the id. Its effect stands and shows in the player's state frames: the client does not send it again. A new id sent while the fence of an earlier command is still settling is refused `pending` by `live` itself (`LiveHubError`, before the show sees it), which also changed nothing: the client may send it again. A refusal under any other code carries no `reason`.

---

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `code` | `string` | yes | minLength: `1`; maxLength: `64`; Machine-readable refusal code. |
| `message` | `string` | yes | minLength: `1`; Human-readable explanation of the refusal. |
| `reason` | `string` | no | enum: `tick_barrier_fenced`, `not_applied`, `tombstoned`, `request_voided`, `duplicate_request`; Why a `pending` refusal was not applied, and so whether to send it again under a new id: every reason but `duplicate_request` is safe to send again. Absent under every other code. |

### `MemeTradeAck`

`data` of an `ack` frame answering an in-round MEME_TRADE socket command (`LiveFrame.request_id == requestId`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"ack"` | yes | const: `"ack"`; Always `ack`. |
| `requestId` | `string` | yes | minLength: `1`; maxLength: `64`; Echoed `request_id` of the command it answers. |
| `ok` | `boolean` | yes | `true` when committed, `false` when refused (`error` gives the code). |
| `error` | [`MemeTradeAckError`](#memetradeackerror) | no | — |

### `MemeTradePositionMsg`

`data` of a player-directed `position` frame (`null` when not seated).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"position"` | yes | const: `"position"`; Always `position`. |
| `roundId` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `position` | [`MemeTradePositionWithCoin`](#memetradepositionwithcoin) \| `null` | yes | Updated position with its coin, or `null` when not seated. |

### `MemeTradeAutoSellMsg`

`data` of a player-directed `autoSell` frame confirming the armed take-profit / stop-loss (`null` when cleared).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"autoSell"` | yes | const: `"autoSell"`; Always `autoSell`. |
| `autoSell` | [`MemeTradeAutoSell`](#memetradeautosell) \| `null` | yes | Armed take-profit / stop-loss setting, or `null` when both are cleared. |

### `MemeTradeSkippedLink`

`data` of a `skipped_link` broadcast published when chain index `link.index`'s integer price path would exceed int64 (`9,223,372x`) before its presale opens: no round is opened or staked on `link.index`, `serverSeed` (`s_i`) and the overflow `tick` are revealed so any verifier can confirm the skip, and `link.index + 1` opens immediately with no rug hold.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"skipped_link"` | yes | const: `"skipped_link"`; Always `skipped_link`. |
| `link` | [`MemeTradeLink`](#memetradelink) | yes | — |
| `serverSeed` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Revealed 64-hex server seed `s_i` whose path overflowed int64 (`sha256_hex(s_i) == link.commit`). |
| `tick` | `integer` | yes | min: `1`; 1-based tick at which `P_tick` exceeded `2^63 - 1`. |

### `LiveHubAck`

`data` of the hub's command-envelope `ack` frame (`{"committed": true}` once a two-phase plan commits, or `{"committed": false}` when a command did not commit and emitted no game-specific `ack` body).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `committed` | `boolean` | yes | Whether the two-phase command plan committed. |

### `MemeTradeAborted`

`data` of an `aborted` broadcast emitted after `rug` when the automatic outage rule ends an open MEME_TRADE v2 round (platform outage policy): every trade and sidebet in the round is voided and each player's buy-ins are refunded in full.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"aborted"` | yes | const: `"aborted"`; Always `aborted`. |
| `round_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}-[0-9]{1,20}$`; Public wallet-safe show round id (`<chain>-<index>`). |
| `step` | `integer` | yes | min: `0`; Last committed show step before the outage rule ended the round. |
| `reason` | `string` | yes | enum: `heartbeat_expired`, `step_timeout`; Automatic outage condition that triggered the abort. |
| `commit` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Committed 64-hex hash `s_{i-1} = sha256_hex(seed)`. |
| `seed` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Revealed 64-hex server seed `s_i`. |

### `MemeTradeSidebetDetail`

Sidebet detail carried inside `MemeTradeRecordView.sidebet` on a settled sidebet record.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `amount` | [`Amount`](#amount-1) | yes | — |
| `placed_tick` | `integer` | yes | min: `0`; Tick at which the sidebet was placed (`0` in presale). |
| `end_tick` | `integer` | yes | min: `1`; Last tick on which a rug wins the sidebet (`placed_tick + 40`). |
| `payout` | `string` | yes | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{2}$`; Sidebet payout multiplier with 2 decimals (`"4.67"`). |
| `status` | `string` | yes | enum: `open`, `won`, `lost`; Settled sidebet status. |
| `settled_tick` | `integer` | no | min: `1`; Tick at which the sidebet won or expired (omitted when unset). |

### `MemeTradeRecordView`

`view` of a MEME_TRADE v2 player-round or sidebet `Record`. Fields derived from the round's future (`peak` at rug, `rug_tick`, `rug_price`, `server_seed`) are present only once the round has rugged, never on mid-round sidebet expiries.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `v` | `integer` | yes | const: `3`; MEME_TRADE v2's record view version (`3`). |
| `kind` | `string` | yes | enum: `position`, `sidebet`; Whether the record settles a player-round position book or one sidebet. |
| `round_id` | [`MemeTradeRoundId`](#memetraderoundid) | yes | — |
| `coin` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; Currency code of the record. |
| `invested` | [`Amount`](#amount-1) | yes | — |
| `returned` | [`Amount`](#amount-1) | yes | — |
| `profit` | `string` | no | pattern: `^-?(0\|[1-9][0-9]*)(\.[0-9]{1,8})?$`; Signed net profit (`returned − invested`) at the coin's decimals when present. |
| `tick` | `integer` | yes | min: `0`; Tick at which this record step settled. |
| `price` | [`MemeTradePrice`](#memetradeprice) | no | — |
| `side` | `string` | no | enum: `long`, `short`; Last position direction when a position was opened. |
| `leverage` | `integer` | no | min: `1`; max: `5`; Last position leverage `1..5` when a position was opened. |
| `entry` | [`MemeTradePrice`](#memetradeprice) | no | — |
| `margin` | `string` | no | pattern: `^-?(0\|[1-9][0-9]*)\.[0-9]{8,16}$`; Signed margin `G` at `d + 8` decimals when present. |
| `initial_margin` | `string` | no | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{4,12}$`; Initial margin `M` at `d + 4` decimals when present. |
| `funding_paid` | `string` | no | pattern: `^(0\|[1-9][0-9]*)\.[0-9]{8,16}$`; Cumulative funding paid `F` at `d + 8` decimals when present. |
| `buys` | `integer` | no | min: `0`; Number of opens in the player-round when present. |
| `sells` | `integer` | no | min: `0`; Number of closes in the player-round when present. |
| `opened_tick` | `integer` | no | min: `0`; Tick at which the position opened when present. |
| `last_trade_tick` | `integer` | no | min: `0`; Tick of the most recent fill when present. |
| `held` | `boolean` | no | Whether a position remained open when present. |
| `rugged` | `boolean` | no | Whether a held long was lost on the rug when present. |
| `liquidated` | `boolean` | no | Whether a held leveraged position was liquidated when present. |
| `capped` | `boolean` | no | Whether payout was truncated at `max_profit` when present. |
| `ended_by` | `string` | no | Terminal trigger of the record when present. |
| `sidebet` | [`MemeTradeSidebetDetail`](#memetradesidebetdetail) | no | — |
| `peak` | [`MemeTradePrice`](#memetradeprice) | no | — |
| `rug_tick` | `integer` | no | min: `1`; Revealed rug tick once rugged. |
| `rug_price` | [`MemeTradePrice`](#memetradeprice) | no | — |
| `scheme` | `string` | yes | minLength: `1`; Fairness scheme identifier. |
| `chain` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; Published hash chain id. |
| `index` | `integer` | yes | min: `1`; max: `9007199254740991`; 1-based link index in the chain. |
| `server_seed_hash` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Committed 64-hex hash `s_{i-1}`. |
| `server_seed` | `string` | no | pattern: `^[0-9a-f]{64}$`; Revealed 64-hex server seed `s_i` once rugged. |
| `external_hash` | `string` | yes | pattern: `^[0-9a-f]{64}$`; Public salt hex fixed before link 1 opened. |
| `salt_source` | `string` | yes | minLength: `1`; Pre-announced external salt source. |

### `MemeTradeSettlement`

`data` of a player-directed `settled` frame on `/v1/live/meme-trade`: a `LiveSettlement` whose `view` is `MemeTradeRecordView` (sent on a mid-round sidebet expiry with `settled_by: play` and no revealed seed, and at the rug for settled sidebets and player-rounds).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bet_id` | `string` | yes | minLength: `1`; maxLength: `64`; Settled bet or player-round id. A player-round's `bet_id` is its show round's id (`<chain>-<index>`), by which the player's session reads its own trade record once the show round has revealed its seed (`GET /v1/session/rounds/{id}`); a sidebet's `bet_id` is the sidebet's frame id (`sb-<chain>:<index>-<n>`), by which the player's session reads that sidebet's own record once the show round has revealed its seed (`GET /v1/session/rounds/{id}`, URL-encoded in the path). A player who only bought in gets no `settled` frame and has no record (their round balance returns in full as its settlement credit). |
| `currency` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; Settlement currency code. |
| `stake` | [`Amount`](#amount-1) | yes | — |
| `payout` | [`Amount`](#amount-1) | yes | — |
| `refund` | [`Amount`](#amount-1) | yes | — |
| `settled_by` | `string` | yes | enum: `play`, `force_close`, `outage`; Settlement path (`play` in MEME_TRADE v2). |
| `view` | [`MemeTradeRecordView`](#memetraderecordview) | yes | — |

### `MemeTradeFrameData`

Union of MEME_TRADE v2's per-game `LiveFrame.data` payloads.

- **Type:** `MemeTradeProjectedSnapshot | MemeTradeIdleSnapshot | MemeTradePresale | MemeTradeStart | MemeTradeTick | MemeTradeRug | MemeTradeTradeMsg | MemeTradePlayers | MemeTradeSidebetMsg | MemeTradeBalance | MemeTradeAck | LiveHubAck | LiveHubError | MemeTradePositionMsg | MemeTradeAutoSellMsg | MemeTradeSkippedLink | MemeTradeAborted | MemeTradeSettlement`

- **`oneOf[0]`:** [`MemeTradeProjectedSnapshot`](#memetradeprojectedsnapshot)

- **`oneOf[1]`:** [`MemeTradeIdleSnapshot`](#memetradeidlesnapshot)

- **`oneOf[2]`:** [`MemeTradePresale`](#memetradepresale)

- **`oneOf[3]`:** [`MemeTradeStart`](#memetradestart)

- **`oneOf[4]`:** [`MemeTradeTick`](#memetradetick)

- **`oneOf[5]`:** [`MemeTradeRug`](#memetraderug)

- **`oneOf[6]`:** [`MemeTradeTradeMsg`](#memetradetrademsg)

- **`oneOf[7]`:** [`MemeTradePlayers`](#memetradeplayers)

- **`oneOf[8]`:** [`MemeTradeSidebetMsg`](#memetradesidebetmsg)

- **`oneOf[9]`:** [`MemeTradeBalance`](#memetradebalance)

- **`oneOf[10]`:** [`MemeTradeAck`](#memetradeack)

- **`oneOf[11]`:** [`LiveHubAck`](#livehuback)

- **`oneOf[12]`:** [`LiveHubError`](#livehuberror)

- **`oneOf[13]`:** [`MemeTradePositionMsg`](#memetradepositionmsg)

- **`oneOf[14]`:** [`MemeTradeAutoSellMsg`](#memetradeautosellmsg)

- **`oneOf[15]`:** [`MemeTradeSkippedLink`](#memetradeskippedlink)

- **`oneOf[16]`:** [`MemeTradeAborted`](#memetradeaborted)

- **`oneOf[17]`:** [`MemeTradeSettlement`](#memetradesettlement)

### `MemeTradeFrame`

A server-to-client frame on `/v1/live/meme-trade` (`game: "meme-trade"`), carrying one of MEME_TRADE v2's frame bodies in `data`. Every money, price, margin, PnL and multiplier value is a decimal string at fixed scale, never a JSON float; another player's identity never leaves the server, no frame carries a whole-round count or another operator's volume (platform policy), and the round's seed and rug tick stay `null` until the rug. Bet settlements use `LiveSettledFrame`, the initial handshake sends `welcome`, and an outage sends `aborted`.

- **Clocks** are the live server's: a 10,000 ms presale (pulses 1..39 every 250 ms, `start` at 10,000 ms), then one active tick every 250 ms until the rug, then `RugHold` (4,000 ms) from the rug step's due time to `origin`, the next presale's scheduled open (`skipped_link` opens `index + 1` at once with no hold): a schedule the link and the clock decide, never the trades or sidebets. Within `ShowOpenSlack` (1,000 ms) of `origin`, once the previous close has finished by `origin`, the next presale opens at `origin`; when a close overruns `RugHold` (an alerted fault) or the writer reaches `origin` past `ShowOpenSlack` (a takeover or idle gap), it opens at the next fixed slot `origin + k * RugHold`, the same for every operator, with no frame saying why.

---

- **Type:** `LiveFrame & object`

- **`allOf[0]`:** [`LiveFrame`](#liveframe)

- **`allOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `game` | `"meme-trade"` | yes | const: `"meme-trade"`; Always `meme-trade`. |
| `data` | [`MemeTradeFrameData`](#memetradeframedata) | yes | — |

### `LiveIdleSnapshot`

`data` of a `snapshot` answer on any live game's socket while no show is open (TRAPDOOR's between shows).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `phase` | `"idle"` | yes | const: `"idle"`; Always `idle`. |

### `LiveHubError`

`data` of an `error` frame that `live` itself sends, before any show sees the command: a malformed envelope, a `request_id` in the platform's namespace (`invalid_input`), a kind outside the game's socket kinds or a platform kind (`invalid_action`), a player whose previous command is still settling (`pending`), a watch of a table that has as many watchers as it takes (`limit`, STACKOPASS), or no show open (`closed`). `LiveFrame.request_id` names the command when it had one.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `code` | `string` | yes | pattern: `^[a-z][a-z0-9_]*$`; An engine code (`invalid_input`, `invalid_action`, `pending`, `limit`, `closed`,...). |
| `detail` | `string` | yes | minLength: `1`; The refusal in words safe to show the player. |

### `KombatmpSocketRequestId`

A KOMBATMP socket command's `request_id`, chosen by the client: 1 to 64 bytes of UTF-8 (`live` counts bytes) that do not start with `Platform:` (the platform's commands) or `Bet:` (the REST bets placed in the round, `KombatmpBetRequestId`), in any case, the same namespaces as `TrapdoorSocketRequestId`. `live` refuses `Platform:` with `invalid_input` (`LiveHubError`) before anything sees the command, and from refuses `Bet:` the same way. KOMBATMP's only socket command is `snapshot`, which `live` answers itself from the round as it is then, so a repeated id simply gets a fresh snapshot; nothing remembers it.

- **Type:** `string`
- **Constraints:** minLength: `1`; maxLength: `64`

### `KombatmpBetRequestId`

A REST bet's request id in the round, `Bet:<bet_id>:<n>` (the same form as `TrapdoorBetRequestId`): `<bet_id>` is `createLiveBet`'s `bet_id` and `<n>` the number of its debit attempt, whose wallet transaction id is `<bet_id>:0:<n>:debit` (6). `api` makes it, so no client chooses it, and no socket `request_id` can take its form (`KombatmpSocketRequestId`). It names one placement attempt only: a repeat of the REST call's `Idempotency-Key` replays `api`'s stored answer and never reaches the round, and a new attempt has a new `<n>`.

- **Type:** `string`
- **Constraints:** pattern: `^Bet:[A-Za-z0-9_-]{1,48}:[1-9][0-9]{0,4}$`; maxLength: `64`

### `KombatmpRoundIndex`

A KOMBATMP round's public id: the index of its link in the published hash chain, which the source's database id was. `round_id`, `index` and the settled view's `round` are all this number, in every frame and record; the round's wallet-safe round id is `<chain>-<index>` (`LiveBet.show_round_id` in `openapi.yaml`).

- **Type:** `integer`
- **Constraints:** min: `1`; max: `9007199254740991`

### `KombatmpHex`

64 lowercase hex characters (a seed, a commitment or a salt).

- **Type:** `string`
- **Constraints:** pattern: `^[0-9a-f]{64}$`

### `KombatmpPay`

A multiplier a KOMBATMP bet is offered or locked at, with exactly 2 decimals, from `1.01` to `9999.99` (the game specification: a winner quote is offered only within `1.01.. 1000.00`, and a side bet only below `10000.00`; the largest the tables price is `4659.97`). A bet's request may write it shorter (`PAY_PATTERN`, `KombatmpBetParams.pay` in `openapi.yaml`); every frame and record writes it this way.

- **Type:** `string`
- **Constraints:** pattern: `^(1\.(0[1-9]|[1-9][0-9])|([2-9]|[1-9][0-9]{1,3})\.[0-9]{2})$`

### `KombatmpHP`

`[red, blue]`, each fighter's hit points, from its card's `red_hp` or `blue_hp` (at most 30) down to `0` for a fighter knocked out.

- **Type:** `array<integer>`
- **Constraints:** minItems: `2`; maxItems: `2`

### `KombatmpCard`

A round's card (the game specification, `cardView`), drawn from words 0 to 2 of the round's stream when it opens and public at once: the cosmetic Red fighter, Blue's rung and its opponent, the duration `D` and what it scales (`max_exchanges` is `N(D) = ⌊2D / 3⌋`, `beat_ms` the pace between exchanges, the starting hit points, `quick_ko` the last exchange a quick KO may end at, `low_hp` the hit points a comeback ends at or under).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `fighter` | `string` | yes | enum: `doge`, `wojak`, `cat`; Red's fighter skin (cosmetic). |
| `fighter_name` | `string` | yes | enum: `Karate Doge`, `Boxer Wojak`, `Ninja Cat`; Red's fighter's name. |
| `rung` | `integer` | yes | min: `1`; max: `3`; Blue's rung on the ladder; with the duration it picks the round's paytable (one of 21). |
| `opponent` | `string` | yes | enum: `paper-hands-pete`, `rug-puller`, `gas-fee-golem`; Blue's fighter, by its rung (1, 2, 3 in this order). |
| `opponent_name` | `string` | yes | enum: `Paper Hands Pete`, `Rug Puller`, `Gas Fee Golem`; Blue's fighter's name. |
| `duration` | `integer` | yes | enum: `15`, `20`, `25`, `30`, `35`, `40`, `45`; The regulation duration `D` in seconds. |
| `max_exchanges` | `integer` | yes | min: `10`; max: `30`; `N(D)`, the regulation exchanges; a tie at the bell adds one sudden-death exchange. |
| `beat_ms` | `integer` | yes | min: `1500`; max: `1563`; The milliseconds between two steps of the fight. |
| `red_hp` | `integer` | yes | min: `10`; max: `30`; Red's starting hit points. |
| `blue_hp` | `integer` | yes | min: `6`; max: `30`; Blue's starting hit points. |
| `quick_ko` | `integer` | yes | min: `8`; max: `24`; A Red KO at this exchange or before wins `quick_ko`. |
| `low_hp` | `integer` | yes | min: `2`; max: `6`; A Red win with this many hit points or fewer left wins `comeback`. |

### `KombatmpPrices`

The offers at the fight's public state after `n` exchanges (the game specification, `priceView`): the winner quote for each side, `null` where it falls outside `1.01.. 1000.00` (that side is not offered), and the offered Red side bets in slip order. `sides` lists them while `n` is `0` (the source's `priceView`), and is `{}` from exchange 1 on (always an object); but the side bets close at the bell, so between the bell and exchange 1 (a snapshot's `FIGHTING` at `revealed` 0) `sides` still lists pays the round refuses (`not_offered`). A winner bet placed now names this `n` as its `at` and this quote as its `pay`; a quote is the exact value of the bet at that state, so no other bet moves it.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `n` | `integer` | yes | min: `0`; max: `30`; The exchanges revealed, the `at` a bet at these offers names. |
| `red` | [`KombatmpPay`](#kombatmppay) \| `null` | yes | Red's winner quote, or `null` when not offered. |
| `blue` | [`KombatmpPay`](#kombatmppay) \| `null` | yes | Blue's winner quote, or `null` when not offered. |
| `sides` | `object` | yes | The offered Red side bets and their pays, before the bell only; a dropped side bet is absent. |

### `KombatmpExchangeView`

One revealed exchange (the game specification, `exchangeView`): its number `n`, who landed it, the move and its damage (`jab` 1, `kick` 2, `special` 3), both fighters' hit points after it, and `sudden_death`, true when the blow was struck in sudden death, which ends the fight with `by` the winner (`ended_by` `SUDDEN_DEATH`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `n` | `integer` | yes | min: `1`; max: `31`; The exchange's number, `1.. N(D) + 1`. |
| `by` | `string` | yes | enum: `red`, `blue`; Who landed the blow. |
| `move` | `string` | yes | enum: `jab`, `kick`, `special`; The blow. |
| `dmg` | `integer` | yes | min: `1`; max: `3`; Its damage, by the move. |
| `hp` | [`KombatmpHP`](#kombatmphp) | yes | — |
| `sudden_death` | `boolean` | yes | Whether the blow was struck in sudden death (it then ends the fight). |

### `KombatmpEndView`

How a fight ended (the game specification, `endView`): the winner, `ended_by` (`KO` the moment a fighter's hit points reach 0, `DECISION` on the hit-point fractions after `N(D)` exchanges, `SUDDEN_DEATH` by whoever lands the blow after a tie), the exchanges it took and the final hit points, and the side-bet flags, which only a Red win can set.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `winner` | `string` | yes | enum: `red`, `blue`; The winner. |
| `ended_by` | `string` | yes | enum: `KO`, `DECISION`, `SUDDEN_DEATH`; How the fight ended. |
| `n` | `integer` | yes | min: `2`; max: `31`; The exchanges the fight took (a KO needs at least 2; sudden death ends at `N(D) + 1`). |
| `hp` | [`KombatmpHP`](#kombatmphp) | yes | — |
| `flags` | `object` | yes | Which Red side bets the fight won. |

### `KombatmpRound`

`data` of the `round` broadcast that opens a round for bets: its id, the link's public part (the seed `s_i` stays in the writer until `closed` or `aborted`), the card, the pre-fight offers (`prices.n` is `0`) and `bell_at`, 10,000 ms after the open, the time the bell carries. Pre-fight bets (`at: 0`, winner or offered side bets) are those that reach `live` at or before `bell_at` plus 250 ms (`BELL_GRACE_MS`, inclusive): `live` runs the bell's step at `bell_at` plus 251 ms and stamps it `bell_at` (the arrival rule), so whether a bet is pre-fight depends on its own arrival alone. From the bell on, winner bets only, each at the exchange count revealed as of its arrival. The grace reveals nothing: the card is public from the open, and exchange 1 is drawn a beat after the bell.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"round"` | yes | const: `"round"`; Always `round`. |
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `chain` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The published hash chain's id. `<chain>-<index>` is the round's wallet-safe round id, which fits 64 characters for any index; `live` opens no round on a chain whose id it cannot carry. |
| `index` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `commit` | [`KombatmpHex`](#kombatmphex) | yes | The link's commitment `s_{i-1} = sha256_hex(s_i)`, published before the chain's first round. |
| `salt` | [`KombatmpHex`](#kombatmphex) | yes | The chain's public salt, a block hash fixed after the commitment. |
| `salt_source` | `string` | yes | minLength: `1`; Where the salt comes from (`bitcoin:<height>`). |
| `card` | [`KombatmpCard`](#kombatmpcard) | yes | — |
| `prices` | [`KombatmpPrices`](#kombatmpprices) | yes | — |
| `bell_at` | `integer` | yes | Unix time in milliseconds when the bell is due, 10,000 ms after the round opened. |
| `now` | `integer` | yes | The round's clock when it opened, Unix milliseconds. |

### `KombatmpBell`

`data` of the `bell` broadcast: the fight starts, nothing is revealed yet (`n` stays `0`), the side bets are closed (`not_offered`, though a snapshot's `prices.sides` still lists them until exchange 1), and winner bets at `at: 0` are taken until exchange 1 lands, due at `next_at`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"bell"` | yes | const: `"bell"`; Always `bell`. |
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `now` | `integer` | yes | The bell's time, `bell_at`, Unix milliseconds; `live` sends the frame after the pre-fight grace, at `bell_at` plus 251 ms. |
| `next_at` | `integer` | yes | When exchange 1 is due, `now` plus the card's `beat_ms`. |

### `KombatmpExchange`

`data` of the `x` broadcast that reveals one exchange, drawn at that step and never before (every bet priced at the exchange before it was already fixed): the exchange, the phase after it (`SUDDEN_DEATH` from a tie at the bell on), and the new offers with the next exchange's due time. On the blow that ends the fight `prices` and `next_at` are both `null`, and `end` follows.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"x"` | yes | const: `"x"`; Always `x`. |
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `now` | `integer` | yes | When the exchange was revealed, Unix milliseconds. |
| `exchange` | [`KombatmpExchangeView`](#kombatmpexchangeview) | yes | — |
| `phase` | `string` | yes | enum: `FIGHT`, `SUDDEN_DEATH`; The fight's phase after this exchange. |
| `prices` | [`KombatmpPrices`](#kombatmpprices) \| `null` | yes | The offers after this exchange (`prices.n` is its `n`), or `null` when it ended the fight. |
| `next_at` | `integer | null` | yes | When the next exchange is due, or `null` when this one ended the fight. |

### `KombatmpEnd`

`data` of the `end` broadcast after the blow that ends the fight: how it ended, and when the next round may open. Every bet then settles (its player's `paid` and `settled` frames), and `closed` reveals the seed.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"end"` | yes | const: `"end"`; Always `end`. |
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `now` | `integer` | yes | When the fight ended, Unix milliseconds. |
| `end` | [`KombatmpEndView`](#kombatmpendview) | yes | — |
| `next_round_at` | `integer` | yes | `now` plus 5,000 ms, the result screen. |

### `KombatmpClosed`

`data` of the `closed` broadcast that ends a round after its fight: the seed `s_i`, so every exchange and every bet's record verifies (`sha256_hex(seed) == commit`; exchange `n` is word `2 + n` of `FairRandom(seed, salt, index)`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"closed"` | yes | const: `"closed"`; Always `closed`. |
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `index` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `seed` | [`KombatmpHex`](#kombatmphex) | yes | — |
| `commit` | [`KombatmpHex`](#kombatmphex) | yes | — |
| `salt` | [`KombatmpHex`](#kombatmphex) | yes | — |

### `KombatmpAborted`

`data` of the `aborted` broadcast when the outage rule ends a round: the round ends at its last journaled step with `last_revealed` exchanges public, in the lobby, after the bell or mid-fight, and every bet in it is refunded whole, whatever the exchanges showed (its settlement follows on its player's socket, `settled_by: outage`). The seed is revealed. This is KOMBATMP's own `aborted` frame: `live` sends no other for its round (types the generic one).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"aborted"` | yes | const: `"aborted"`; Always `aborted`. |
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `index` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `reason` | `"ABORT"` | yes | const: `"ABORT"`; Always `ABORT`. |
| `last_revealed` | `integer` | yes | min: `0`; max: `30`; The exchanges revealed when the round ended (`0` in the lobby and between the bell and exchange 1); never a finished fight's. |
| `seed` | [`KombatmpHex`](#kombatmphex) | yes | — |
| `commit` | [`KombatmpHex`](#kombatmphex) | yes | — |
| `salt` | [`KombatmpHex`](#kombatmphex) | yes | — |

### `KombatmpArenaBetId`

A bet's number among its own player's bets in the round: `1, 2, …`, reserved when the round takes the bet for placement (before its money commits) and journaled with it, so numbers rise in that order and a takeover's replay gives every committed bet the same number. A placement whose money failed spends its number, which no frame shows; after a takeover the rebuilt round counts committed bets only, so that number may be given to the player's next bet. So it can pass 12, the most bets a player places in a round, but no player is ever shown one number twice. It counts that player's bets only: no frame lets a player count or order another player's or operator's bets. It matches a `bet` frame with its `paid` frame and its `my_bets` entry; the bet's id everywhere else is `createLiveBet`'s `bet_id`.

- **Type:** `integer`
- **Constraints:** min: `1`

### `KombatmpPlacedBet`

A placed KOMBATMP bet (the game specification, the source's `betView`): the same object as `createLiveBet`'s `view` in `openapi.yaml`, the `bet` of its `bet` frame, an entry of the snapshot's `my_bets`, and the first view of its record. `at` is the exchange count its odds came from (`0` before exchange 1), `pay` the multiplier locked, and `reserved_profit` the floored profit it would win, `⌊stake · pay / 100⌋ − stake` (`0` for a stake too small to profit): what the bet holds against its brand's round pool (`ROUND_FULL`, `createLiveBet`) and its brand's `max_exposure` until it settles or is refunded.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `arena_bet_id` | [`KombatmpArenaBetId`](#kombatmparenabetid) | yes | — |
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `index` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `coin` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The bet's currency. |
| `kind` | `string` | yes | enum: `win`, `flawless`, `quick_ko`, `comeback`; The market. |
| `side` | `string` | yes | enum: `red`, `blue`; The side (`red` for every side bet). |
| `at` | `integer` | yes | min: `0`; max: `30`; The exchanges revealed when the bet was priced. |
| `pay` | [`KombatmpPay`](#kombatmppay) | yes | — |
| `stake` | [`Amount`](#amount-1) | yes | — |
| `reserved_profit` | [`Amount`](#amount-1) | yes | — |

### `KombatmpBetAccepted`

`data` of the `bet` frame sent to the bettor's own sockets once the round's journal holds the bet. A takeover's replay may commit different players' bets in another order than live did, and `live` never re-sends what a replay sends, so the order of different players' `bet` frames carries nothing: nothing may number or order them by when they were sent.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"bet"` | yes | const: `"bet"`; Always `bet`. |
| `request_id` | [`KombatmpBetRequestId`](#kombatmpbetrequestid) | yes | — |
| `bet` | [`KombatmpPlacedBet`](#kombatmpplacedbet) | yes | — |

### `KombatmpRefusalData`

The source's `data` of a refused KOMBATMP bet, without its balance: `status` names the refusal (`INVALID`, `MAX_STAKE` with the largest stake `max_stake`, `CLOSED`, `NOT_OFFERED`, `ODDS_CHANGED` with the round's current exchange count `n` and that bet's current pay, `null` when not offered, and `LIMIT`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `INVALID`, `MAX_STAKE`, `CLOSED`, `NOT_OFFERED`, `ODDS_CHANGED`, `LIMIT`; The source's word for the refusal. |
| `max_stake` | [`Amount`](#amount-1) | no | — |
| `n` | `integer` | no | min: `0`; max: `30`; The exchanges revealed as of the refused bet's arrival at `live`, the `at` a bet must name. |
| `pay` | [`KombatmpPay`](#kombatmppay) \| `null` | no | The bet's pay at `n`, or `null` when it is not offered there. |

### `KombatmpBetError`

`data` of the round's `error` frame to the bettor's sockets when a bet was not placed. The REST answer to `createLiveBet` is the authority (its problem carries the same `code` and `message` as `detail`); this frame tells the bettor's open sockets too, and its `data` carries the source's status, with the new offer on `odds_changed`. `code` is an engine code: the round's own refusals (`invalid_input`, `stake_out_of_range`, `max_stake` with `max_stake`, `closed`, `not_offered`, `odds_changed`, `limit`); the reason `live` aborted a placement whose money failed, whose `message` is then the fixed `We could not place your bet. Please try again.` (`live` never passes an error's own text); or `pending` for a second placement under a request id whose first is still in flight. The round also answers `invalid_action` to any kind but a bet and to a `Platform:` request id, but that answer is no `KombatmpBetError` and never reaches a socket: `live` refuses both before the round, and `api` sends only `Bet:` bets. The round's pool (`ROUND_FULL`) is `api`'s refusal before the debit, with no frame. Nothing refused is remembered: a placement `live` aborted never happened and `live` keeps its request id void, and `api` never sends a request id twice; a committed bet's request id answers its `bet` frame again.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"error"` | yes | const: `"error"`; Always `error`. |
| `request_id` | [`KombatmpBetRequestId`](#kombatmpbetrequestid) | yes | — |
| `kind` | `"bet"` | yes | const: `"bet"`; Always `bet`. |
| `code` | `string` | yes | enum: `invalid_input`, `invalid_action`, `stake_out_of_range`, `max_stake`, `unknown_profile`, `not_offered`, `odds_changed`, `closed`, `limit`, `pending`, `seed_not_revealed`, `unknown_game`, `unknown_version`, `no_acceptable_draw`, `internal`; Why the bet was not placed. |
| `message` | `string` | yes | minLength: `1`; The refusal in words safe to show the player (the source's, the game specification, or the fixed text of an aborted placement). |
| `data` | [`KombatmpRefusalData`](#kombatmprefusaldata) \| `null` | yes | The source's status object, or `null` where the source had none (the stake's range, a missing pay, `pending`, an aborted placement). |
| `max_stake` | [`Amount`](#amount-1) | no | With `max_stake` only, the largest stake that bet takes at its pay. |

### `KombatmpPaid`

`data` of the `paid` frame to a bettor's own sockets when one of their bets settles, beside its `settled` frame (in no promised order between the two). It is for display only: the `settled` frame (`KombatmpSettlement`) is the money's authority, and a client must never add `paid.payout` to a balance as well. `won` and `multiplier` say how the bet ended (`multiplier` the bet's `pay` on a win, `0.00` on a loss), `payout` what it pays (`⌊stake · pay / 100⌋` on a win, so a win can pay exactly the stake back, `0` on a loss), and an outage refund reads `refunded: true`, `won: false`, `multiplier: null` and `payout` the stake.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"paid"` | yes | const: `"paid"`; Always `paid`. |
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `request_id` | [`KombatmpBetRequestId`](#kombatmpbetrequestid) | yes | — |
| `arena_bet_id` | [`KombatmpArenaBetId`](#kombatmparenabetid) | yes | — |
| `won` | `boolean` | yes | Whether the bet won. |
| `multiplier` | `string | null` | yes | pattern: `^(0\.00\|1\.(0[1-9]\|[1-9][0-9])\|([2-9]\|[1-9][0-9]{1,3})\.[0-9]{2})$`; The bet's `pay` on a win, `0.00` on a loss, `null` for a refund. |
| `payout` | [`Amount`](#amount-1) | yes | — |
| `refunded` | `boolean` | yes | Whether the outage rule refunded the bet. |

### `KombatmpPublicRound`

The round as the snapshot shows it (`KombatmpSnapshot.round`): its link's public part, the card, the exchanges revealed so far, and `status` (`BETTING` until the bell, `FIGHTING` until the fight ends, then `CLOSED`, or `ABORTED` after an outage). While the round is open `prices` is the current offers and `seed` and `end` are `null`; once it is over `prices` is `null`, `seed` the revealed `s_i`, and `end` how the fight ended (`null` after an outage, which never ends a fight).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `index` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `status` | `string` | yes | enum: `BETTING`, `FIGHTING`, `CLOSED`, `ABORTED`; Where the round is. |
| `card` | [`KombatmpCard`](#kombatmpcard) | yes | — |
| `chain` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The published hash chain's id. |
| `commit` | [`KombatmpHex`](#kombatmphex) | yes | — |
| `salt` | [`KombatmpHex`](#kombatmphex) | yes | — |
| `salt_source` | `string` | yes | minLength: `1`; Where the salt comes from (`bitcoin:<height>`). |
| `seed` | [`KombatmpHex`](#kombatmphex) \| `null` | yes | The revealed seed `s_i` once the round is over, else `null`. |
| `bell_at` | `integer` | yes | When the bell is (was) due, Unix milliseconds. |
| `revealed` | `integer` | yes | min: `0`; max: `31`; The exchanges revealed so far. |
| `exchanges` | array<[`KombatmpExchangeView`](#kombatmpexchangeview)> | yes | maxItems: `31`; Every revealed exchange, in order. |
| `prices` | [`KombatmpPrices`](#kombatmpprices) \| `null` | yes | The current offers while the round is open, else `null`. |
| `end` | [`KombatmpEndView`](#kombatmpendview) \| `null` | yes | How the fight ended, once it has. |

### `KombatmpSnapshot`

A KOMBATMP round as one viewer sees it now, `KombatmpProjectedSnapshot.show`: `phase` is `betting` before the bell, `fighting` until the fight ends, then `result` (after `closed` or `aborted`), and `my_bets` is there only for a viewer with a bet in the round, their own bets alone, in the order the round took them.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"snapshot"` | yes | const: `"snapshot"`; Always `snapshot`. |
| `now` | `integer` | yes | The time of the snapshot, Unix milliseconds. |
| `phase` | `string` | yes | enum: `betting`, `fighting`, `result`; Where the round is. |
| `round` | [`KombatmpPublicRound`](#kombatmppublicround) | yes | — |
| `my_bets` | array<[`KombatmpPlacedBet`](#kombatmpplacedbet)> | no | minItems: `1`; maxItems: `12`; The viewer's own placed bets in the round, when there are any. |

### `KombatmpProjectedSnapshot`

`data` of a `snapshot` frame on `/v1/live/kombat-multiplayer` while a round is open or just over: the viewer's `KombatmpSnapshot` under `show`, and their own bets as `live` tracks them. Like CRASH's and TRAPDOOR's, it carries no `operator_totals` or `round_totals`: a round's bets are fixed odds against the house, no player's offer depends on another's, and a round-wide count less the viewer's operator's would tell how many bets every other operator's players placed (`live` leaves them out for KOMBATMP).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `show` | [`KombatmpSnapshot`](#kombatmpsnapshot) | yes | — |
| `self_bets` | array<[`LiveSelfBet`](#liveselfbet)> | no | maxItems: `12`; The viewer's own bets in the round, when there are any. |

### `KombatmpResult`

A played bet's settled view, the record's `game_result`, with exactly these keys in this order: the round (`round` and `round_id` both its chain index), the matchup `m` (`[fighter, rung, duration]`), the bet (`bet` the market, `side`, `at`, `pay`), the fight's end (`winner`, `by` its `ended_by`, `x` the exchanges, `hp`), and `paid`, the bet's `pay` on a win and `0.00` on a loss.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `v` | `1` | yes | const: `1`; The record's version, `1`. |
| `arena` | `1` | yes | const: `1`; The arena's version, `1`. |
| `round` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `m` | [`KombatmpMatchup`](#kombatmpmatchup) | yes | — |
| `bet` | `string` | yes | enum: `win`, `flawless`, `quick_ko`, `comeback`; The market. |
| `side` | `string` | yes | enum: `red`, `blue`; The side. |
| `at` | `integer` | yes | min: `0`; max: `30`; The exchanges revealed when the bet was priced, always fewer than `x`. |
| `pay` | [`KombatmpPay`](#kombatmppay) | yes | — |
| `winner` | `string` | yes | enum: `red`, `blue`; The fight's winner. |
| `by` | `string` | yes | enum: `KO`, `DECISION`, `SUDDEN_DEATH`; How the fight ended. |
| `x` | `integer` | yes | min: `2`; max: `31`; The exchanges the fight took. |
| `hp` | [`KombatmpHP`](#kombatmphp) | yes | — |
| `paid` | `string` | yes | pattern: `^(0\.00\|1\.(0[1-9]\|[1-9][0-9])\|([2-9]\|[1-9][0-9]{1,3})\.[0-9]{2})$`; `pay` on a win, `"0.00"` on a loss. |

### `KombatmpRefund`

The settled view of a bet the outage rule refunded (BetPlug's, since the source wrote no record): the round and bet fields of `KombatmpResult`, then `settled_by` `outage`, `reason` `ABORT`, `x` the exchanges revealed when the round ended, and `paid` `1.00`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `v` | `1` | yes | const: `1`; The record's version, `1`. |
| `arena` | `1` | yes | const: `1`; The arena's version, `1`. |
| `round` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `round_id` | [`KombatmpRoundIndex`](#kombatmproundindex) | yes | — |
| `m` | [`KombatmpMatchup`](#kombatmpmatchup) | yes | — |
| `bet` | `string` | yes | enum: `win`, `flawless`, `quick_ko`, `comeback`; The market. |
| `side` | `string` | yes | enum: `red`, `blue`; The side. |
| `at` | `integer` | yes | min: `0`; max: `30`; The exchanges revealed when the bet was priced, at most `x`. |
| `pay` | [`KombatmpPay`](#kombatmppay) | yes | — |
| `settled_by` | `"outage"` | yes | const: `"outage"`; Always `outage`. |
| `reason` | `"ABORT"` | yes | const: `"ABORT"`; Always `ABORT`. |
| `x` | `integer` | yes | min: `0`; max: `30`; The exchanges revealed when the round ended. |
| `paid` | `"1.00"` | yes | const: `"1.00"`; Always `"1.00"`, the stake back. |

### `KombatmpMatchup`

`[fighter, rung, duration]`, the round's matchup (its card's `fighter`, `rung` and `duration`).

- **Type:** `array<none>`
- **Constraints:** minItems: `3`; maxItems: `3`

### `KombatmpSettlement`

`data` of the `settled` frame for a KOMBATMP bet: a `LiveSettlement` whose `view` is the bet's settled view. `settled_by` comes from the record's last action's `do`: `settle` (the fight's end) is `play`, with `KombatmpResult`, `payout` `⌊stake · pay / 100⌋` on a win (exactly the stake for a win too small to profit, a push) and `0` on a loss, and `refund` `0`; `abort` (the outage rule) is `outage`, with `KombatmpRefund` and `refund` = `payout` = `stake`. This frame is the money's authority; the `paid` frame beside it is for display only. A KOMBATMP bet has no in-round action and no force-close: it settles with its round, so `force_close` never names one.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bet_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,48}$`; The bet's id, `createLiveBet`'s `bet_id`. |
| `currency` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The bet's currency. |
| `stake` | [`Amount`](#amount-1) | yes | — |
| `payout` | [`Amount`](#amount-1) | yes | — |
| `refund` | [`Amount`](#amount-1) | yes | — |
| `settled_by` | `string` | yes | enum: `play`, `outage`; Which path settled the bet, read from the record's last action. |
| `view` | [`KombatmpResult`](#kombatmpresult) \| [`KombatmpRefund`](#kombatmprefund) | yes | The bet's settled view. |

### `KombatmpFrameData`

Union of KOMBATMP's `LiveFrame.data` bodies (the game specification).

- **Type:** `KombatmpRound | KombatmpBell | KombatmpExchange | KombatmpEnd | KombatmpClosed | KombatmpAborted | KombatmpBetAccepted | KombatmpBetError | KombatmpPaid | KombatmpProjectedSnapshot | LiveIdleSnapshot | KombatmpSettlement | LiveHubError`

- **`oneOf[0]`:** [`KombatmpRound`](#kombatmpround)

- **`oneOf[1]`:** [`KombatmpBell`](#kombatmpbell)

- **`oneOf[2]`:** [`KombatmpExchange`](#kombatmpexchange)

- **`oneOf[3]`:** [`KombatmpEnd`](#kombatmpend)

- **`oneOf[4]`:** [`KombatmpClosed`](#kombatmpclosed)

- **`oneOf[5]`:** [`KombatmpAborted`](#kombatmpaborted)

- **`oneOf[6]`:** [`KombatmpBetAccepted`](#kombatmpbetaccepted)

- **`oneOf[7]`:** [`KombatmpBetError`](#kombatmpbeterror)

- **`oneOf[8]`:** [`KombatmpPaid`](#kombatmppaid)

- **`oneOf[9]`:** [`KombatmpProjectedSnapshot`](#kombatmpprojectedsnapshot)

- **`oneOf[10]`:** [`LiveIdleSnapshot`](#liveidlesnapshot)

- **`oneOf[11]`:** [`KombatmpSettlement`](#kombatmpsettlement)

- **`oneOf[12]`:** [`LiveHubError`](#livehuberror)

### `KombatmpFrame`

A server-to-client frame on `/v1/live/kombat-multiplayer` (`game: "kombat-multiplayer"`). `type` is its body's own `type` (`round`, `bell`, `x`, `end`, `closed`, `aborted`, `bet`, `error`, `paid`), `snapshot` for a snapshot, or `settled` for a settlement, whose body has none; `request_id` is set on `bet`, `error` and `paid` (the bet's `Bet:` id) and on a `snapshot` that answers a command. The socket's first frame, `welcome` (`{protocol, game}`), is a plain `LiveFrame` as on every live game, not a `KombatmpFrame`.

- **Who gets what.** `round`, `bell`, `x`, `end`, `closed` and `aborted` go to every socket of the round, which is one per environment and shared by every operator; `bet`, `error`, `paid`, `settled` and a `snapshot` go to one player's sockets. No frame carries a player's identity, an operator's, or a composite player key, and none lets a player count or order other players' or operators' bets: a bet's number counts its own player's bets alone (`KombatmpArenaBetId`), and the snapshot has no round-wide totals.
- **What is revealed when.** Exchange `n` leaves the writer only in its own `x`, drawn at that step after every bet priced at `n − 1` was fixed; the seed only in `closed`, `aborted`, and a snapshot taken after them. A bet's settled view is written when the fight ends or the round aborts.
- **One answer per request.** A bet goes in over REST (`createLiveBet`), which answers it; the round also tells the bettor's sockets, `bet` once placed or one `error`. `snapshot`, the only socket command, is answered by one `snapshot` frame (`KombatmpProjectedSnapshot`, or `LiveIdleSnapshot` while no round is open), or one `error` (`LiveHubError`) when `live` refuses it.
- **Clocks** are the live server's: the bell at `bell_at`, 10,000 ms after the round opened, which `live` runs at `bell_at` plus 251 ms, after the 250 ms pre-fight grace (`BELL_GRACE_MS`, inclusive), and stamps `bell_at` (the `bell` frame's `at` too: a step's published time, `LiveFrame.at`), so a bet that reaches `live` by `bell_at` plus 250 ms is pre-fight and a later one meets the fight; exchange `n` at `bell_at` plus `n` × `beat_ms` (`next_at`); then 5,000 ms of result before the next round opens (`next_round_at`): a schedule the link and the clock decide, never the bets. A close that overruns the result is an alerted fault: the next round opens at the schedule's next fixed slot, the origin (`next_round_at`) plus a whole number of result times (5,000 ms), the same for every operator, with no frame saying why; after `aborted`, too, the next round opens at a fixed slot of the schedule. Every round opens with its whole lobby.

---

- **Type:** `LiveFrame & object`

- **`allOf[0]`:** [`LiveFrame`](#liveframe)

- **`allOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `game` | `"kombat-multiplayer"` | yes | const: `"kombat-multiplayer"`; Always `kombat-multiplayer`. |
| `data` | [`KombatmpFrameData`](#kombatmpframedata) | yes | — |

### `KombatmpCommand`

A KOMBATMP player's socket command, in the `LiveCommand` envelope: `snapshot`, and nothing else. A bet has no in-round action, so the round takes no socket move: a bet is placed over REST (`createLiveBet`, whose `bet` is the engine's only player command), the bell and every exchange are the live server's steps of the round on its clock, an outage is the live server's abort, and a KOMBATMP bet has no force-close. A player's command of any other kind (`bet`, `force_close` and every platform kind included) is refused `invalid_action` (`LiveHubError`) before the round sees it; the round itself refuses any kind but a REST bet, and any request id in the `Platform:` namespace, with `invalid_action`.

- **Type:** `KombatmpSnapshotCommand`

- **`oneOf[0]`:** [`KombatmpSnapshotCommand`](#kombatmpsnapshotcommand)

### `KombatmpSnapshotCommand`

Ask for a fresh snapshot (`KombatmpProjectedSnapshot`, or `LiveIdleSnapshot` while no round is open).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"snapshot"` | yes | const: `"snapshot"`; Always `snapshot`. |
| `request_id` | [`KombatmpSocketRequestId`](#kombatmpsocketrequestid) | yes | — |
| `data` | `object` | no | None; `{}` is allowed. |

### `StackOPassSocketRequestId`

A STACKOPASS socket command's `request_id`, chosen by the client: 1 to 64 bytes of UTF-8 (`live` counts bytes) that do not start with `Platform:` in any case, the platform's namespace, which `live` refuses with `invalid_input` (`LiveHubError`) in any spelling before the table sees the command. STACKOPASS takes no REST bet, so `Bet:` is not reserved here. Its scope is the player's current hand: `live` claims a move on the hand (`open`, `cashout`, `leave`) under a key built from the hand's round id and this id, and keeps an applied `pass` or empty-handed `leave` until the seat's next buy-in (`StackOPassCommand`), so the same id on the player's next hand is a new command. The table's own steps are claimed under `Platform:` keys, which no player can send.

- **Type:** `string`
- **Constraints:** minLength: `1`; maxLength: `64`

### `StackOPassTableId`

A table's id: 22 base64url characters drawn at random by `live` (132 bits from `crypto/rand`), never from a counter, so no id tells how many tables there are or were, an operator's or another's, and another operator's table cannot be guessed (5). It names the table in every frame, in `watch` and in the buy-in's `live_seat` (`createSessionRound` in `openapi.yaml`). Each table belongs to one environment and one operator, and seats only that operator's players only (its brands may share it), so a viewer is shown, can watch and can buy in at its own operator's tables only, and another operator's table answers as one that is gone (`no_table`, `409 closed`). The id says nothing of operator or brand.

- **Type:** `string`
- **Constraints:** pattern: `^[A-Za-z0-9_-]{22}$`

### `StackOPassSeatIndex`

A seat at a table, `0.. 5` clockwise.

- **Type:** `integer`
- **Constraints:** min: `0`; max: `5`

### `StackOPassRisk`

A table's fixed risk `N`, the devil's `1 in N` on every pack (round 2, the game specification): each table has one for its whole life, and every hand at it plays at it.

- **Type:** `integer`
- **Constraints:** enum: `9`, `5`, `3`

### `StackOPassStack`

A multiplier with exactly 2 decimals, `0.00.. 10000.00` (the game specification: no pack is offered whose best case passes `10,000.00x`, so no stack or cash-out passes it).

- **Type:** `string`
- **Constraints:** pattern: `^((0|[1-9][0-9]{0,3})\.[0-9]{2}|10000\.00)$`

### `StackOPassBlock`

Why a hand may open no more packs (`openBlock`, the game specification), the first that binds in this order: `MAX_PACKS` (40 packs opened), `MAX_MULTIPLIER` (the next pack's best case would pass `10,000.00x`), `MAX_PROFIT` (it could profit more than the maximum profit snapshotted at the buy-in).

- **Type:** `string`
- **Constraints:** enum: `MAX_PACKS`, `MAX_MULTIPLIER`, `MAX_PROFIT`

### `StackOPassCard`

One slot of an opened pack: the devil's slot (`devil: true`, with `id`, `tier` and `value` all `null`), or a card (`devil: false`, with all three set). A devil pack's other four cards are drawn and shown too.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `slot` | `integer` | yes | min: `0`; max: `4`; The slot, `0.. 4`, left to right. |
| `devil` | `boolean` | yes | Whether the devil is in this slot. |
| `id` | `integer | null` | yes | min: `1`; max: `242`; The card's picture, `1.. 242`, rarest first; `null` in the devil's slot. |
| `tier` | `string | null` | yes | enum: `COMMON`, `UNCOMMON`, `RARE`, `SUPER_RARE`, `EPIC`, `LEGENDARY`, `null`; The card's tier; `null` in the devil's slot. |
| `value` | `string | null` | yes | pattern: `^[0-7]\.[0-9]{2}$`; The card's value at the table's risk, with 2 decimals (`"0.19"`.. `"7.50"`); `null` in the devil's slot. |

### `StackOPassPack`

An opened pack, the engine's `pack`: its number in the hand, the table's risk, its five slots, and for a safe pack its total and the hand's new stack (`multiplier`, `⌊100 S⌋ / 100`); a devil pack has `devil: true`, exactly one devil slot, and `total` and `multiplier` both `"0.00"`. It is drawn from its player's own seed pair, and once opened it is public at the table.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `n` | `integer` | yes | min: `1`; max: `40`; The pack's number in its hand, `1.. 40`. |
| `risk` | [`StackOPassRisk`](#stackopassrisk) | yes | — |
| `devil` | `boolean` | yes | Whether the devil was in the pack, which busts the hand. |
| `cards` | array<[`StackOPassCard`](#stackopasscard)> | yes | minItems: `5`; maxItems: `5`; The five slots, in slot order. |
| `total` | `string` | yes | pattern: `^(0\|[1-9]\|[1-3][0-9])\.[0-9]{2}$`; The five cards' sum (`"0.95"`.. `"37.50"`), or `"0.00"` for a devil pack. |
| `multiplier` | [`StackOPassStack`](#stackopassstack) | yes | — |

### `StackOPassRisks`

The risk of every pack the hand opened, the table's `N` repeated (round 2 has no heat).

- **Type:** `array<StackOPassRisk>`
- **Constraints:** maxItems: `40`

### `StackOPassHandView`

An open hand as its own player sees it on the socket: the engine's open `hand` view with its `blocks` (one entry per risk, as the record keeps them) replaced by `block`, the entry of the table's own risk, since round 2 never deals a hand at another. `block` is `null` while a pack is offered; it is set only in the `hand` frame right after a safe pack that leaves the hand blocked, and the table's forced cash-out follows at once. `packs` and `safe` are equal while the hand is open, and `stack` is `⌊100 S⌋ / 100` (`"0.95"` before the first pack).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `"OPEN"` | yes | const: `"OPEN"`; Always `OPEN`. |
| `packs` | `integer` | yes | min: `0`; max: `40`; Packs opened. |
| `safe` | `integer` | yes | min: `0`; max: `40`; Safe packs opened; equal to `packs` while the hand is open. |
| `stack` | [`StackOPassStack`](#stackopassstack) | yes | — |
| `block` | [`StackOPassBlock`](#stackopassblock) \| `null` | yes | The table's risk's `openBlock`, or `null` while a pack is offered. |
| `multiplier` | `null` | yes | Always `null` while the hand is open. |
| `payout` | `null` | yes | Always `null` while the hand is open. |
| `risks` | [`StackOPassRisks`](#stackopassrisks) | yes | — |

### `StackOPassSettledHand`

A settled hand's `hand`: `BUSTED` (the devil pack counted in `packs`, `safe` one less, `stack` and `multiplier` `"0.00"`, `payout` 0), `CASHED_OUT` (`safe` equal to `packs`, at least 1, `multiplier` `⌊100 S⌋ / 100`) or `REFUNDED` (closed before its first pack: `packs` 0, `stack` `"0.95"`, `multiplier` `"1.00"`, `payout` the stake). `blocks` is `null` once settled.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `status` | `string` | yes | enum: `BUSTED`, `CASHED_OUT`, `REFUNDED`; How the hand ended. |
| `packs` | `integer` | yes | min: `0`; max: `40`; Packs opened, the devil's included. |
| `safe` | `integer` | yes | min: `0`; max: `40`; Safe packs opened. |
| `stack` | [`StackOPassStack`](#stackopassstack) | yes | — |
| `blocks` | `null` | yes | Always `null` once settled. |
| `multiplier` | [`StackOPassStack`](#stackopassstack) | yes | — |
| `payout` | [`Amount`](#amount-1) | yes | — |
| `risks` | [`StackOPassRisks`](#stackopassrisks) | yes | — |

### `StackOPassGameResult`

A settled hand's record, the engine's `game_result`, keys in this order: `risks` the table's risk once per opened pack, `packs` each pack's five slots (`D` at the devil's) joined by `,` and the packs by `|`, `auto` present only on a cash-out that names it (the block of the table's forced cash-out, or `FORFEIT` for a force-close after at least one pack). A hand closed before its first pack writes exactly `{"v":1,"table":1,"risks":"","status":"REFUNDED","packs":"","safe":0,"multiplier":"1.00","edge_bps":500}`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `v` | `1` | yes | const: `1`; The record's version, `1`. |
| `table` | `1` | yes | const: `1`; The card table's version, `1`. |
| `risks` | `string` | yes | pattern: `^(\|9(,9)*\|5(,5)*\|3(,3)*)$`; maxLength: `79`; The table's risk once per opened pack (`"5,5"`), or `""` for a refund. |
| `status` | `string` | yes | enum: `BUSTED`, `CASHED_OUT`, `REFUNDED`; How the hand ended. |
| `packs` | `string` | yes | pattern: `^(\|(D\|[1-9][0-9]?\|1[0-9]{2}\|2[0-3][0-9]\|24[0-2])(,(D\|[1-9][0-9]?\|1[0-9]{2}\|2[0-3][0-9]\|24[0-2])){4}(\\|(D\|[1-9][0-9]?\|1[0-9]{2}\|2[0-3][0-9]\|24[0-2])(,(D\|[1-9][0-9]?\|1[0-9]{2}\|2[0-3][0-9]\|24[0-2])){4})*)$`; maxLength: `799`; The opened packs' slots, or `""` for a refund. |
| `safe` | `integer` | yes | min: `0`; max: `40`; Safe packs opened. |
| `multiplier` | [`StackOPassStack`](#stackopassstack) | yes | — |
| `edge_bps` | `500` | yes | const: `500`; The house edge in basis points, `500`. |
| `auto` | `string` | no | enum: `MAX_PROFIT`, `MAX_MULTIPLIER`, `MAX_PACKS`, `FORFEIT`; The table's forced cash-out's block, or `FORFEIT` for a force-close after at least one pack. |

### `StackOPassSettledView`

A settled hand's view, its record's last step's `view`: `pack` and `busted: true` only on a bust; `refunded: true` only on a refund (where `profit` and `profit_capped` are absent); `auto` the block of the table's forced cash-out, `FORFEIT` for a force-close after at least one pack, and `null` otherwise (a player's own cash-out or leave, a bust, a refund); `ended_by` `DEVIL`, `CASHOUT` (a player's cash-out or leave), `FORCED:<block>` (the table's forced cash-out), `REFUND` (a player's cash-out or leave before the first pack) or `FORCE_CLOSED` (the platform's force-close, a refund before the first pack). `profit` is `payout − stake`, negative on a loss, and `profit_capped` is always `false`: every pack was priced before it was opened.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `hand` | [`StackOPassSettledHand`](#stackopasssettledhand) | yes | — |
| `pack` | [`StackOPassPack`](#stackopasspack) | no | — |
| `busted` | `true` | no | const: `true`; Present, and `true`, only on a bust. |
| `auto` | `string | null` | yes | enum: `MAX_PROFIT`, `MAX_MULTIPLIER`, `MAX_PACKS`, `FORFEIT`, `null`; The forced cash-out's block, `FORFEIT` for a force-close after a pack, else `null`. |
| `refunded` | `true` | no | const: `true`; Present, and `true`, only on a refund. |
| `profit` | `string` | no | pattern: `^-?(0\|[1-9][0-9]{0,29})(\.[0-9]{1,18})?$`; `payout − stake` at the currency's scale, negative on a loss; absent on a refund. |
| `profit_capped` | `false` | no | const: `false`; Always `false`; absent on a refund. |
| `ended_by` | `string` | yes | enum: `DEVIL`, `CASHOUT`, `FORCED:MAX_PACKS`, `FORCED:MAX_MULTIPLIER`, `FORCED:MAX_PROFIT`, `REFUND`, `FORCE_CLOSED`; How the hand ended. |
| `game_result` | [`StackOPassGameResult`](#stackopassgameresult) | yes | — |

### `StackOPassSettlement`

`data` of the `settled` frame for a STACKOPASS hand, sent to its player's sockets when `live` settles the hand or learns that it was settled elsewhere (the operator's force-close, `worker`'s inactivity rule): a `LiveSettlement` whose `bet_id` is the hand's round id and whose `view` is its record's last view. `settled_by` is the live server's, since the record writes one force-close action for all of them: `play` for a bust, the player's cash-out or leave, and the table's forced cash-out; `force_close` for the platform's force-close (60 s away, 3 timeouts, the operator, `worker`'s inactivity rule, a draw no rejection limit allowed, a seat lost at the buy-in, and the live server's sweep of a round no table holds 60 s after it opened); `outage` for a hand at a table the outage rule ended (its writer stopped past the takeover window). `refund` is the whole stake for a refund and `0` otherwise; `payout` is `⌊stake · c / 100⌋` with `c` the view's `multiplier` in cents (`"1.23"` is 123), the stake for a refund, `0` on a bust.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bet_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,64}$`; The hand's round id (`GET /v1/session/rounds/{id}`). |
| `currency` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The hand's currency. |
| `stake` | [`Amount`](#amount-1) | yes | — |
| `payout` | [`Amount`](#amount-1) | yes | — |
| `refund` | [`Amount`](#amount-1) | yes | — |
| `settled_by` | `string` | yes | enum: `play`, `force_close`, `outage`; Which path settled the hand, as `live` knows it. |
| `view` | [`StackOPassSettledView`](#stackopasssettledview) | yes | — |

### `StackOPassSeat`

A seat as every watcher of the table sees it, with no identity and no amount: `empty`; `buying` (held for a buy-in whose money is in flight, at most 30 s); `open` (a hand that can open packs); `busted`, `cashed_out` or `refunded` (the hand ended, and the seat stays its player's for a new buy-in for 90 s). `packs` and `stack` are `null` while `empty` or `buying`; otherwise `packs` counts the packs opened (the devil's included) and `stack` is the hand's `⌊100 S⌋ / 100` while `open` (`"0.95"` before the first pack) and the multiplier it was paid once ended (`"0.00"` busted, `"1.00"` refunded). `away` is `true` while the seat's player has no socket, and always `false` when `empty`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `seat` | [`StackOPassSeatIndex`](#stackopassseatindex) | yes | — |
| `state` | `string` | yes | enum: `empty`, `buying`, `open`, `busted`, `cashed_out`, `refunded`; The seat's state. |
| `packs` | `integer | null` | yes | min: `0`; max: `40`; Packs opened by the seat's hand; `null` while `empty` or `buying`. |
| `stack` | [`StackOPassStack`](#stackopassstack) \| `null` | yes | The hand's stack, or the multiplier it was paid; `null` while `empty` or `buying`. |
| `away` | `boolean` | yes | Whether the seat's player has no socket now. |

### `StackOPassTurnState`

The seat on the clock and when its turn ends (Unix milliseconds, 10,000 ms after it began).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `seat` | [`StackOPassSeatIndex`](#stackopassseatindex) | yes | — |
| `deadline_at` | `integer` | yes | When the turn ends; a turn with no `open`, `pass`, `cashout` or `leave` by then is passed for the seat. |

### `StackOPassTableState`

A table as every watcher sees it: its fixed risk, the devil's chance at it, its six seats, the turn (`null` while no seat is on the clock: before the first turn, after an open while its pack is shown, after a reshuffle, and while no seat has an open hand), and `lap_passes`, the passes on the pack now on the table (`0.. 5`: an open resets it to 0, a seat that passed it and then leaves the rotation takes its pass off, and when every open hand has passed it once the table reshuffles and starts again at 0).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |
| `risk` | [`StackOPassRisk`](#stackopassrisk) | yes | — |
| `devil_chance` | `string` | yes | enum: `11.11`, `20.00`, `33.33`; The devil's chance per pack in percent, truncated to 2 decimals (`1 in 9`, `1 in 5`, `1 in 3`). |
| `seats` | array<[`StackOPassSeat`](#stackopassseat)> | yes | minItems: `6`; maxItems: `6`; The six seats, in seat order. |
| `turn` | [`StackOPassTurnState`](#stackopassturnstate) \| `null` | yes | The turn, or `null` while no seat is on the clock. |
| `lap_passes` | `integer` | yes | min: `0`; max: `5`; Passes on the pack now on the table. |

### `StackOPassTableRow`

One of the viewer's operator's tables in the lobby, with how many of its six seats are not `empty`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |
| `risk` | [`StackOPassRisk`](#stackopassrisk) | yes | — |
| `occupied` | `integer` | yes | min: `0`; max: `6`; Seats not `empty`. |

### `StackOPassTablesList`

The viewer's operator's tables in the environment (never another operator's, nor a count of them), at least one per risk with a free seat: `live` opens one as needed for that operator, and closes an empty table no socket watches after 60 s, one with a free seat per risk always staying. The counts are that operator's players, with no identity.

- **Type:** `array<StackOPassTableRow>`
- **Constraints:** minItems: `3`

### `StackOPassTables`

`data` of the `tables` broadcast to the sockets that watch the lobby (no table), whenever the lobby changes, at most twice a second.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"tables"` | yes | const: `"tables"`; Always `tables`. |
| `tables` | [`StackOPassTablesList`](#stackopasstableslist) | yes | — |

### `StackOPassMe`

The viewer's own seat, in their snapshot only, present while they hold one: its table and seat and state; `round_id`, `currency` and `stake` of its hand, except while `buying`; and `hand` (`StackOPassHandView`) while the hand is `open`. A player holds at most one seat in the environment.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |
| `seat` | [`StackOPassSeatIndex`](#stackopassseatindex) | yes | — |
| `state` | `string` | yes | enum: `buying`, `open`, `busted`, `cashed_out`, `refunded`; The seat's state. |
| `round_id` | `string` | no | pattern: `^[A-Za-z0-9_-]{1,64}$`; The hand's round id. |
| `currency` | `string` | no | pattern: `^[A-Z0-9]{2,12}$`; The hand's currency. |
| `stake` | [`Amount`](#amount-1) | no | — |
| `hand` | [`StackOPassHandView`](#stackopasshandview) | no | — |

### `StackOPassSnapshot`

`data` of a `snapshot` frame: the answer to `snapshot` and to `watch`, and the frame `live` sends unasked right after the `welcome` of every socket, a reconnect included. `tables` is the lobby; `table` the table the socket now watches, or `null` for the lobby (a viewer who holds a seat always watches its table); `me` the viewer's own seat, present only while they hold one. A hand that settled while the viewer had no socket is not repeated here: read it over REST (`GET /v1/session/rounds/{id}`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"snapshot"` | yes | const: `"snapshot"`; Always `snapshot`. |
| `tables` | [`StackOPassTablesList`](#stackopasstableslist) | yes | — |
| `table` | [`StackOPassTableState`](#stackopasstablestate) \| `null` | yes | The watched table, or `null` for the lobby. |
| `me` | [`StackOPassMe`](#stackopassme) | no | — |

### `StackOPassSeated`

`data` of the `seated` broadcast to the table's watchers whenever a seat's public state changes: held for a buy-in (`buying`), seated (`open`), a pack opened (`packs`, `stack`), the hand ended (`busted`, `cashed_out`, `refunded`), or its player left or came back (`away`). An emptied seat is told by `left`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"seated"` | yes | const: `"seated"`; Always `seated`. |
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |
| `seat` | [`StackOPassSeat`](#stackopassseat) | yes | — |

### `StackOPassTurn`

`data` of the `turn` broadcast whenever the turn moves: to `seat` until `deadline_at` (10,000 ms), or to no seat (`seat` and `deadline_at` both `null`): after an open, while its pack is shown (2,500 ms); after a reshuffle (1,200 ms); before an idle table's first turn after a buy-in (1,500 ms); and while no seat has an open hand. The turn goes clockwise to the next `open` seat; a blocked hand is cashed out by the table instead of taking it. A move that reaches `live` before `deadline_at` is applied before the timeout pass.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"turn"` | yes | const: `"turn"`; Always `turn`. |
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |
| `seat` | [`StackOPassSeatIndex`](#stackopassseatindex) \| `null` | yes | The seat on the clock, or `null`. |
| `deadline_at` | `integer | null` | yes | When the seat's turn ends (Unix milliseconds), or `null` with no seat. |

### `StackOPassOpened`

`data` of the `opened` broadcast to the table's watchers after a seat opened a pack: the pack, safe or the devil's, drawn from that player's own seed pair. The opener's own `hand` (safe) or `settled` (a bust) frame and the seat's `seated` follow.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"opened"` | yes | const: `"opened"`; Always `opened`. |
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |
| `seat` | [`StackOPassSeatIndex`](#stackopassseatindex) | yes | — |
| `pack` | [`StackOPassPack`](#stackopasspack) | yes | — |

### `StackOPassPassed`

`data` of the `passed` broadcast after the seat on the clock passed: by its player (`player`), or by the table at its turn's deadline (`timeout`; a seat's third timeout in a row force-closes its hand). `lap_passes` counts the passes on this pack with this one (`1.. 6`, less any pass taken off by its seat leaving the rotation); when it reaches the number of open hands, `reshuffled` follows. A pass reads no word of any player's seed pair.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"passed"` | yes | const: `"passed"`; Always `passed`. |
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |
| `seat` | [`StackOPassSeatIndex`](#stackopassseatindex) | yes | — |
| `by` | `string` | yes | enum: `player`, `timeout`; Who passed. |
| `lap_passes` | `integer` | yes | min: `1`; max: `6`; The passes on this pack, this one included. |

### `StackOPassReshuffled`

`data` of the `reshuffled` broadcast when every open hand passed the pack once: the pack is discarded (no word is read), and the next turn comes 1,200 ms later at the same risk.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"reshuffled"` | yes | const: `"reshuffled"`; Always `reshuffled`. |
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |

### `StackOPassCashedOut`

`data` of the `cashed_out` broadcast to the table's watchers when a seat's hand closed without a bust: `CASHED_OUT` at `multiplier`, or `REFUNDED` (before its first pack, `"1.00"`). `reason` says why, without the amount, the stake or the block: `cashout` (its player's cash-out, or the table's forced cash-out, which the frame does not tell apart because a `MAX_PROFIT` block depends on the stake), `left` (its player left), `away` (60 s with no socket), `timeouts` (three in a row), `force_close` (another platform force-close: the operator, `worker`'s inactivity rule, a draw no rejection limit allowed) or `outage` (the outage rule). Its player's `settled` frame carries the rest. A watcher who sees a forced cash-out come at once after a safe pack, with no `MAX_PACKS` (40 packs) or `MAX_MULTIPLIER` (from the stack) to explain it, can infer `MAX_PROFIT`, which bounds that hand's stake against its brand's maximum profit; that is accepted, since the maximum profit is another operator's setting, so the frame alone does not hide it.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"cashed_out"` | yes | const: `"cashed_out"`; Always `cashed_out`. |
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |
| `seat` | [`StackOPassSeatIndex`](#stackopassseatindex) | yes | — |
| `status` | `string` | yes | enum: `CASHED_OUT`, `REFUNDED`; How the hand closed. |
| `multiplier` | [`StackOPassStack`](#stackopassstack) | yes | — |
| `reason` | `string` | yes | enum: `cashout`, `left`, `away`, `timeouts`, `force_close`, `outage`; Why it closed. |

### `StackOPassLeft`

`data` of the `left` broadcast when a seat became `empty`: its player left (`left`), was away 60 s (`away`) or timed out three times (`timeouts`); its ended hand saw no new buy-in for 90 s (`idle`); the buy-in that held it failed, was refused or ran out before its round was seated (`buy_in_failed`); or the outage rule closed the table's hands (`outage`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"left"` | yes | const: `"left"`; Always `left`. |
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |
| `seat` | [`StackOPassSeatIndex`](#stackopassseatindex) | yes | — |
| `reason` | `string` | yes | enum: `left`, `away`, `timeouts`, `idle`, `buy_in_failed`, `outage`; Why the seat emptied. |

### `StackOPassHand`

`data` of the `hand` frame to its player's sockets only: their open hand after the buy-in seated it (no `pack`) and after each safe pack (with that `pack`), with its round id, currency and stake. A bust or a close sends `settled` instead.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"hand"` | yes | const: `"hand"`; Always `hand`. |
| `table` | [`StackOPassTableId`](#stackopasstableid) | yes | — |
| `seat` | [`StackOPassSeatIndex`](#stackopassseatindex) | yes | — |
| `round_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,64}$`; The hand's round id (`GET /v1/session/rounds/{id}`). |
| `currency` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The hand's currency. |
| `stake` | [`Amount`](#amount-1) | yes | — |
| `hand` | [`StackOPassHandView`](#stackopasshandview) | yes | — |
| `pack` | [`StackOPassPack`](#stackopasspack) | no | — |

### `StackOPassOpenAck`

`data` of the `ack` answering an applied `open`: the pack's number in the hand and whether the devil busted it. The `opened` broadcast and the opener's `hand` or `settled` frame carry the rest; a repeated `request_id` gets this `ack` again, without them.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"ack"` | yes | const: `"ack"`; Always `ack`. |
| `request_id` | [`StackOPassSocketRequestId`](#stackopasssocketrequestid) | yes | — |
| `kind` | `"open"` | yes | const: `"open"`; Always `open`. |
| `pack` | `integer` | yes | min: `1`; max: `40`; The pack's number in the hand. |
| `busted` | `boolean` | yes | Whether the devil was in it. |

### `StackOPassMoveAck`

`data` of the `ack` answering an applied `pass`, `cashout` or `leave`. A cash-out's or a leave's `settled` frame follows (a leave with no open hand only empties the seat); a pass's `passed` broadcast follows.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"ack"` | yes | const: `"ack"`; Always `ack`. |
| `request_id` | [`StackOPassSocketRequestId`](#stackopasssocketrequestid) | yes | — |
| `kind` | `string` | yes | enum: `pass`, `cashout`, `leave`; The command's `type`. |

### `StackOPassError`

`data` of the table's `error` frame refusing a `watch`, `open`, `pass`, `cashout` or `leave`, which changed nothing: `not_seated` (the player holds no seat), `no_hand` (their seat's hand has ended: only `leave` and a new buy-in remain), `not_turn` (`open` or `pass` off the seat's turn), `busy` (the seat's buy-in, previous move, or one of the table's own steps on the seat — forced cash-out of a blocked hand, force-close, or catch-up — is still being applied: the move changed nothing and may be sent again under a new `request_id`), `seated` (`watch` of another table while holding a seat), `no_table` (`watch` of a table that is gone or is not the viewer's operator's, in the same words for both), `invalid_action` (`data` not its shape, a `risk` on a `cashout` included), `closed` (the hand was settled elsewhere: the table then closes it), `pending` (a repeat of a `request_id` whose first command is still being applied), `request_id_reused` (a `request_id` this hand already used for a command of another `type` or `data`), `no_acceptable_draw` (the pack hit the draw's rejection limit: nothing moved, and the table force-closes the hand) or `internal`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"error"` | yes | const: `"error"`; Always `error`. |
| `request_id` | [`StackOPassSocketRequestId`](#stackopasssocketrequestid) | yes | — |
| `kind` | `string` | yes | enum: `watch`, `open`, `pass`, `cashout`, `leave`; The command's `type`. |
| `code` | `string` | yes | enum: `not_seated`, `no_hand`, `not_turn`, `busy`, `seated`, `no_table`, `invalid_action`, `closed`, `pending`, `request_id_reused`, `no_acceptable_draw`, `internal`; Why the table refused it. |
| `message` | `string` | yes | minLength: `1`; The refusal in words safe to show the player. |

### `StackOPassFrameData`

Union of STACKOPASS's `LiveFrame.data` bodies (the game specification).

- **Type:** `StackOPassTables | StackOPassSnapshot | StackOPassSeated | StackOPassTurn | StackOPassOpened | StackOPassPassed | StackOPassReshuffled | StackOPassCashedOut | StackOPassLeft | StackOPassHand | StackOPassOpenAck | StackOPassMoveAck | StackOPassError | StackOPassSettlement | LiveHubError`

- **`oneOf[0]`:** [`StackOPassTables`](#stackopasstables)

- **`oneOf[1]`:** [`StackOPassSnapshot`](#stackopasssnapshot)

- **`oneOf[2]`:** [`StackOPassSeated`](#stackopassseated)

- **`oneOf[3]`:** [`StackOPassTurn`](#stackopassturn)

- **`oneOf[4]`:** [`StackOPassOpened`](#stackopassopened)

- **`oneOf[5]`:** [`StackOPassPassed`](#stackopasspassed)

- **`oneOf[6]`:** [`StackOPassReshuffled`](#stackopassreshuffled)

- **`oneOf[7]`:** [`StackOPassCashedOut`](#stackopasscashedout)

- **`oneOf[8]`:** [`StackOPassLeft`](#stackopassleft)

- **`oneOf[9]`:** [`StackOPassHand`](#stackopasshand)

- **`oneOf[10]`:** [`StackOPassOpenAck`](#stackopassopenack)

- **`oneOf[11]`:** [`StackOPassMoveAck`](#stackopassmoveack)

- **`oneOf[12]`:** [`StackOPassError`](#stackopasserror)

- **`oneOf[13]`:** [`StackOPassSettlement`](#stackopasssettlement)

- **`oneOf[14]`:** [`LiveHubError`](#livehuberror)

### `StackOPassFrame`

A server-to-client frame on `/v1/live/stack-o-pass` (`game: "stack-o-pass"`). `type` is its body's own `type`, or `settled` for a settlement and `error` for the live server's own refusal (`LiveHubError`), neither of whose bodies has one; `request_id` is set on `ack` and `error`, and on a `snapshot` that answers a command. The socket's first frame, `welcome` (`{protocol, game}`), is a plain `LiveFrame`, and a `snapshot` follows it unasked. One command gets exactly one answer: an `ack` or one `error`, or a `snapshot` for `snapshot` and `watch`; its effects arrive as the frames below, and `live` sends no second, generic `ack`.

- **Who gets what.** A table's broadcasts (`seated`, `turn`, `opened`, `passed`, `reshuffled`, `cashed_out`, `left`) go to every socket watching it, one table per socket. Table membership and the lobby's scope follow per-operator isolation: a table seats and shows one operator's players, only that operator's sockets may watch it, and `tables` lists that operator's tables to its sockets watching the lobby; These frames keep a stable schema. A table takes at most 300 watching sockets, its seated players' included; a `watch` of a full table is refused `limit` (`LiveHubError`), and a player's own table is never full to them. `hand`, `ack`, `error`, `settled` and `snapshot` go to one player's sockets only.
- **What is public.** A broadcast names seats by index, never by a player's identity, an operator's, a brand's, a round id or a composite player key, and carries no amount, currency, stake, payout, block or client seed: only seat states, pack counts, stacks and paid multipliers, and every opened pack's cards, which are its player's past draws. A hand's money, round id and block reach its own player alone.
- **What is never sent.** No frame carries a server seed, a hand's next draw or anything derived from one: a hand draws only when it opens a pack, and a pass, a reshuffle, a turn or a timeout reads no word of any seed pair. A player's seed pair is revealed only by its rotation, over REST.
- **Clocks** are the live server's: a turn of 10,000 ms, 2,500 ms to show an opened pack, 1,200 ms after a reshuffle, 1,500 ms before an idle table's first turn after a buy-in, a seat away for 60,000 ms or with three timeouts in a row force-closed, an ended seat freed after 90,000 ms without a new buy-in.

---

- **Type:** `LiveFrame & object`

- **`allOf[0]`:** [`LiveFrame`](#liveframe)

- **`allOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `game` | `"stack-o-pass"` | yes | const: `"stack-o-pass"`; Always `stack-o-pass`. |
| `data` | [`StackOPassFrameData`](#stackopassframedata) | yes | — |

### `StackOPassWatchData`

A `watch`'s `data`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `table` | [`StackOPassTableId`](#stackopasstableid) \| `null` | yes | The table to watch, or `null` to watch the lobby. |

### `StackOPassNoData`

None; `{}` is allowed. A `cashout` that names a `risk` is refused (`invalid_action`), since only the table's forced cash-out names one.

- **Type:** `object`

### `StackOPassCommand`

A STACKOPASS player's socket command, in the `LiveCommand` envelope: `snapshot`, `watch`, `open`, `pass`, `cashout` or `leave`, and nothing else; a player's command of any other kind is refused `invalid_action` (`LiveHubError`) before the table sees it. The buy-in is not a socket command: it is a session round over REST (`createSessionRound` with `live_seat`). The table's own moves are not commands at all, and no player-facing schema lists them: the platform's force-close (`force_close`, platform force-close, for 60 s away, 3 timeouts, the operator, `worker`'s inactivity rule, a draw no rejection limit allowed and the outage rule), the forced cash-out (a cash-out that names the table's risk, sent as soon as a safe pack leaves the hand blocked) and the timeout pass. `open` and `pass` are the seat's on its turn only; `cashout` and `leave` any time.

- **`watch`** (`table`, or `null`): which table this socket watches; the answer is a `snapshot`. Only a table of the viewer's operator; another is `no_table`, in the same words as a gone one. A player who holds a seat watches its table, and `watch` of any other is refused `seated` first. A `watch` of a table already at its 300-watcher cap (seated players' sockets included) is refused `limit` (`LiveHubError`); a player's own table is never full to them.
- **A table with one player** plays on: a `pass` there completes the lap, so the table reshuffles and the turn comes back to the same seat 1,200 ms later; no word is read, and nothing a hand draws or pays depends on who else sits at the table.
- **`open`**: open the next pack, drawn from the player's own seed pair at the table's risk.
- **`pass`**: hand the pack to the next open seat; it reads no word and leaves the hand as it is.
- **`cashout`**: close the hand at `⌊100 S⌋ / 100`, or for a full refund before its first pack. `data` names no `risk`: a cash-out that named one would record the table's forced cash-out.
- **`leave`**: the player's own cash-out, sent as `cashout` (never as the platform's force-close, so the hand records `ended_by: CASHOUT` or `REFUND` and no `auto`), and then the seat empties; with no open hand it only empties the seat. It pays what the source's `forfeit(LEFT)` paid.
- **Request ids** (`StackOPassSocketRequestId`). `live` applies `open`, `cashout` and `leave` to the hand's round as a step, claimed under a key built from the hand's round id and the `request_id` (claim, which no REST `Idempotency-Key` can take) together with the command as sent (its `type` and `data`), so a repeated id gets its first answer again for 72 hours, across a takeover, and the same id for another command is `request_id_reused`; it keeps an applied `pass` or empty-handed `leave` with the table's state until the seat's next buy-in, or until the table closes (60 s after its last seat emptied with nobody watching): a repeat after that answers `not_seated`, which changes nothing either. A refused command is remembered nowhere and is decided again on the hand as it then is, which is safe because a refusal changed nothing; a repeat while the first is still being applied is `pending`. `snapshot` and `watch` are answered afresh every time. The table's own steps (the forced cash-out, a timeout pass, a force-close) are claimed under `Platform:` keys, which `live` refuses from a player, so a player's repeat never replays the table's answer.

---

- **Type:** `StackOPassSnapshotCommand | StackOPassWatchCommand | StackOPassOpenCommand | StackOPassPassCommand | StackOPassCashoutCommand | StackOPassLeaveCommand`

- **`oneOf[0]`:** [`StackOPassSnapshotCommand`](#stackopasssnapshotcommand)

- **`oneOf[1]`:** [`StackOPassWatchCommand`](#stackopasswatchcommand)

- **`oneOf[2]`:** [`StackOPassOpenCommand`](#stackopassopencommand)

- **`oneOf[3]`:** [`StackOPassPassCommand`](#stackopasspasscommand)

- **`oneOf[4]`:** [`StackOPassCashoutCommand`](#stackopasscashoutcommand)

- **`oneOf[5]`:** [`StackOPassLeaveCommand`](#stackopassleavecommand)

### `StackOPassSnapshotCommand`

Ask for a fresh snapshot (`StackOPassSnapshot`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"snapshot"` | yes | const: `"snapshot"`; Always `snapshot`. |
| `request_id` | [`StackOPassSocketRequestId`](#stackopasssocketrequestid) | yes | — |
| `data` | [`StackOPassNoData`](#stackopassnodata) | no | — |

### `StackOPassWatchCommand`

Watch a table, or the lobby.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"watch"` | yes | const: `"watch"`; Always `watch`. |
| `request_id` | [`StackOPassSocketRequestId`](#stackopasssocketrequestid) | yes | — |
| `data` | [`StackOPassWatchData`](#stackopasswatchdata) | yes | — |

### `StackOPassOpenCommand`

Open the next pack, on the seat's turn.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"open"` | yes | const: `"open"`; Always `open`. |
| `request_id` | [`StackOPassSocketRequestId`](#stackopasssocketrequestid) | yes | — |
| `data` | [`StackOPassNoData`](#stackopassnodata) | no | — |

### `StackOPassPassCommand`

Pass the pack, on the seat's turn.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"pass"` | yes | const: `"pass"`; Always `pass`. |
| `request_id` | [`StackOPassSocketRequestId`](#stackopasssocketrequestid) | yes | — |
| `data` | [`StackOPassNoData`](#stackopassnodata) | no | — |

### `StackOPassCashoutCommand`

Cash the hand out, at any time.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"cashout"` | yes | const: `"cashout"`; Always `cashout`. |
| `request_id` | [`StackOPassSocketRequestId`](#stackopasssocketrequestid) | yes | — |
| `data` | [`StackOPassNoData`](#stackopassnodata) | no | — |

### `StackOPassLeaveCommand`

Leave the table, cashing the hand out first.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"leave"` | yes | const: `"leave"`; Always `leave`. |
| `request_id` | [`StackOPassSocketRequestId`](#stackopasssocketrequestid) | yes | — |
| `data` | [`StackOPassNoData`](#stackopassnodata) | no | — |

### `TrapdoorSocketRequestId`

A TRAPDOOR socket command's `request_id`, chosen by the client: 1 to 64 bytes of UTF-8 (`live` counts bytes) that do not start with `Platform:` (the platform's commands) or `Bet:` (the REST bets placed in the show, `TrapdoorBetRequestId`), in any case. `live` refuses `Platform:` with `invalid_input` (`LiveHubError`) before the show sees the command, in any spelling, leading whitespace, control or format characters and JSON escapes included, and from refuses `Bet:` the same way. The show keeps one answer per player and request id whatever the command's kind, so these namespaces are what keep a socket move and a REST bet from ever answering each other.

- **Type:** `string`
- **Constraints:** minLength: `1`; maxLength: `64`

### `TrapdoorBetRequestId`

A REST bet's request id in the show, `Bet:<bet_id>:<n>`: `<bet_id>` is `createLiveBet`'s `bet_id` and `<n>` the number of its debit attempt, whose wallet transaction id is `<bet_id>:0:<n>:debit` (6). `api` makes it, so no client chooses it, and no socket `request_id` can take its form (`TrapdoorSocketRequestId`). It names one placement attempt only: a repeat of the REST call's `Idempotency-Key` replays `api`'s stored answer and never reaches the show, and a new attempt has a new `<n>`.

- **Type:** `string`
- **Constraints:** pattern: `^Bet:[A-Za-z0-9_-]{1,48}:[1-9][0-9]{0,4}$`; maxLength: `64`

### `TrapdoorShowIndex`

A TRAPDOOR show's public id: the index of its link in the published hash chain, which the source's database id was. `show` and `index` are both this number, in every frame and record.

- **Type:** `integer`
- **Constraints:** min: `1`; max: `9007199254740991`

### `TrapdoorFormat`

The show's format, by its index (`MEGA` when the index is a multiple of 10; the game specification).

- **Type:** `string`
- **Constraints:** enum: `CLASSIC`, `MEGA`

### `TrapdoorBean`

A bean's label: its ordinal among its own player's beans in the show, so `1`, since a player holds one bean per show. It counts and orders no other player's bean, whatever anyone else bet or when (platform policy): reserved when the show takes the bet for placement (before its money commits) and journaled with it, it is the same after a takeover, a placement whose money failed spends none, before or after a takeover (the player's next bet is labelled as if it had never been tried), and it is never a player's identity. Only the bean's own player is told it (`entry`, `bean`, the snapshot's `me`, the record's first view); no broadcast names a bean.

- **Type:** `integer`
- **Constraints:** min: `1`; max: `1`

### `TrapdoorDoor`

A door, `1.. n_g` for its gate (the game specification; at most 5).

- **Type:** `integer`
- **Constraints:** min: `1`; max: `5`

### `TrapdoorGate`

A gate, `1.. G` (`G` is 8 in CLASSIC, 12 in MEGA).

- **Type:** `integer`
- **Constraints:** min: `1`; max: `12`

### `TrapdoorBank`

A bank multiplier `bank(g)` with exactly 2 decimals (`"1.42"`; the game specification).

- **Type:** `string`
- **Constraints:** pattern: `^[1-9][0-9]*\.[0-9]{2}$`

### `TrapdoorHex`

64 lowercase hex characters (a seed, a commitment or a salt).

- **Type:** `string`
- **Constraints:** pattern: `^[0-9a-f]{64}$`

### `TrapdoorLayout`

One gate's trapdoors, `t_g` distinct doors in ascending order.

- **Type:** `array<TrapdoorDoor>`
- **Constraints:** minItems: `1`; maxItems: `3`

### `TrapdoorBeanPlan`

A bean's pre-plan as the show keeps it and answers it: both keys always present, `doors` always an object, its gates ascending. The bounds are MEGA's widest; a show holds only plans valid for its format.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bank_at` | `integer | null` | yes | min: `1`; max: `11`; Bank after surviving this gate, or `null`. |
| `doors` | `object` | yes | The planned door per gate `2.. G`, keyed by the gate as a decimal string. |

### `TrapdoorPlanData`

A `plan` command's `data`: a pre-plan as a client sends it, the same as `createLiveBet`'s `params.plan` (`TrapdoorPlanInput` in `openapi.yaml`; the game specification). Absent, `null`, `[]`, `{}`, `{"doors":[]}`, `{"doors":null}` and `{"bank_at":null}` are the empty plan. Integers are read as sent (`2.0` and `"2"` are refused), a gate key has no leading zero (`"02"` is refused), and the show refuses a gate, door or `bank_at` outside its own format's (`bad_plan`).

- **Type:** `object | array | null`
- **Constraints:** maxItems: `0`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bank_at` | `integer | null` | no | min: `1`; max: `11`; Bank after surviving this gate, or `null`. |
| `doors` | `object | array | null` | no | maxItems: `0`; The door per later gate, keyed by the gate as a decimal string; `[]` or `null` is no door. |

### `TrapdoorLobby`

`data` of the `lobby` broadcast that opens a show for bets, and the `show` of every TRAPDOOR snapshot: the link's public part, the format and its bank table. Bets (`createLiveBet`, naming this `show`) are taken until `lobby_closes_at` plus 1,500 ms, inclusive; then gate 1's window opens. The seed stays in the writer until `results` or `aborted`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"lobby"` | yes | const: `"lobby"`; Always `lobby`. |
| `show` | [`TrapdoorShowIndex`](#trapdoorshowindex) | yes | — |
| `chain` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The published hash chain's id. `<chain>-<index>` is the show's round id, which fits 64 characters for any index; `live` opens no show on a chain whose id it cannot carry. |
| `index` | [`TrapdoorShowIndex`](#trapdoorshowindex) | yes | — |
| `format` | [`TrapdoorFormat`](#trapdoorformat) | yes | — |
| `commit` | [`TrapdoorHex`](#trapdoorhex) | yes | The link's commitment `s_{i-1} = sha256_hex(s_i)`, published before the chain's first show. |
| `salt` | [`TrapdoorHex`](#trapdoorhex) | yes | The chain's public salt, a block hash fixed after the commitment. |
| `salt_source` | `string` | yes | minLength: `1`; Where the salt comes from (`bitcoin:<height>`). |
| `lobby_closes_at` | `integer` | yes | Unix time in milliseconds when the lobby closes, 10,000 ms after it opened. |
| `banks` | array<[`TrapdoorBank`](#trapdoorbank)> | yes | minItems: `8`; maxItems: `12`; `bank(1).. bank(G)`, the multiplier a bean banks after surviving each gate (8 in CLASSIC, 12 in MEGA). |

### `TrapdoorBeanEntry`

A placed bean: the same object as `createLiveBet`'s `view` in `openapi.yaml`, and the first view of the bean's record. `cap_gate` is snapshotted at the bet: the bean banks `CAP` after surviving it, so no payout is ever cut.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `show` | [`TrapdoorShowIndex`](#trapdoorshowindex) | yes | — |
| `index` | [`TrapdoorShowIndex`](#trapdoorshowindex) | yes | — |
| `format` | [`TrapdoorFormat`](#trapdoorformat) | yes | — |
| `bean` | [`TrapdoorBean`](#trapdoorbean) | yes | — |
| `bet_amt` | [`Amount`](#amount-1) | yes | — |
| `cap_gate` | [`TrapdoorGate`](#trapdoorgate) | yes | — |
| `max_multiplier` | [`TrapdoorBank`](#trapdoorbank) | yes | — |
| `reserved_profit` | [`Amount`](#amount-1) | yes | — |
| `door1` | `integer` | yes | min: `1`; max: `3`; The door for gate 1 the bet named. |
| `plan` | [`TrapdoorBeanPlan`](#trapdoorbeanplan) | yes | — |

### `TrapdoorEntry`

`data` of the `entry` frame sent to the bettor's own sockets once the show's journal holds the bet. A replay (a takeover) may commit different players' bets in another order than live did, and `live` never re-sends what a replay sends, so the order of different players' `entry` frames carries nothing: nothing may number or order them by when they were sent. `entry.bean` is the bean's label.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"entry"` | yes | const: `"entry"`; Always `entry`. |
| `request_id` | [`TrapdoorBetRequestId`](#trapdoorbetrequestid) | yes | — |
| `entry` | [`TrapdoorBeanEntry`](#trapdoorbeanentry) | yes | — |

### `TrapdoorReveal`

`data` of the `reveal` broadcast after a gate's window closed: every live bean's decision was fixed, then, and only then, the gate was drawn. `traps` is the layout and `last` says whether it was the Golden Door, after which `results` follows. The link and the clock alone decide it: it names, counts and lists no bean. Each player whose bean was alive before the gate learns what the gate did to it from its own `bean` frame, which follows, and, when the bean settled, from its settlement.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"reveal"` | yes | const: `"reveal"`; Always `reveal`. |
| `gate` | [`TrapdoorGate`](#trapdoorgate) | yes | — |
| `traps` | [`TrapdoorLayout`](#trapdoorlayout) | yes | — |
| `last` | `boolean` | yes | Whether this was the Golden Door. |

### `TrapdoorBeanGate`

`data` of the `bean` frame, sent after each gate's `reveal` to the sockets of every player whose bean was alive before that gate, and to nobody else: what the gate did to that bean, as its record says it. `door` is the door it played, or `null` when it banked at the window's close (no door played). `state` is `alive` when it survived and plays on (`reason` and `multiplier` `null`); `fell` when it fell on a trapdoor (`reason` `null`, `multiplier` `"0.00"`); `banked` when it banked at the window's close (`reason` `MANUAL`, `PLAN`, `NO_PICK` or `DISCONNECT`, `multiplier` `bank(gate − 1)`) or after surviving the gate (`CAP` at its cap gate, `FINALE` at the Golden Door, `multiplier` `bank(gate)`). A bean that fell or banked has its settlement follow, with the same `reason` and `multiplier` in its view. The frame depends on its player's own bean alone; a force-close and the outage rule send none: their settlements say it.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"bean"` | yes | const: `"bean"`; Always `bean`. |
| `gate` | [`TrapdoorGate`](#trapdoorgate) | yes | — |
| `bean` | [`TrapdoorBean`](#trapdoorbean) | yes | — |
| `door` | [`TrapdoorDoor`](#trapdoordoor) \| `null` | yes | The door the bean played at this gate, or `null` when it banked at the window's close. |
| `state` | `string` | yes | enum: `alive`, `fell`, `banked`; The bean's state after this gate. |
| `reason` | `string | null` | yes | enum: `MANUAL`, `PLAN`, `NO_PICK`, `DISCONNECT`, `CAP`, `FINALE`, `null`; Why it banked; `null` when it is alive or fell. |
| `multiplier` | `string` \| `null` | yes | The bean's multiplier as its record's view gives it (`bank`, or `"0.00"` for a fall), or `null` while it is alive. |

### `TrapdoorResults`

`data` of the `results` broadcast that ends a show after the Golden Door: the seed `s_i` and every layout, so every bean's record verifies (`sha256_hex(seed) == commit`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"results"` | yes | const: `"results"`; Always `results`. |
| `show` | [`TrapdoorShowIndex`](#trapdoorshowindex) | yes | — |
| `seed` | [`TrapdoorHex`](#trapdoorhex) | yes | — |
| `commit` | [`TrapdoorHex`](#trapdoorhex) | yes | — |
| `salt` | [`TrapdoorHex`](#trapdoorhex) | yes | — |
| `layouts` | array<[`TrapdoorLayout`](#trapdoorlayout)> | yes | minItems: `8`; maxItems: `12`; Every gate's layout, gates `1.. G` in order. |

### `TrapdoorAborted`

`data` of the `aborted` broadcast when the outage rule ends a show: the show ends at its last journaled gate `last_gate` (K). Every bean still alive banks `bank(K)` with reason `ABORT`, or, when no gate was drawn (K = 0), gets its stake back; a bean that had already fallen or banked keeps its result. The frame names, counts and lists no bean: each bean the abort settled is told on its own player's sockets by its settlement (`settled_by: outage`). The seed is revealed, and the layouts of the K gates drawn. This is TRAPDOOR's own `aborted` frame: `live` sends no other for its show.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"aborted"` | yes | const: `"aborted"`; Always `aborted`. |
| `show` | [`TrapdoorShowIndex`](#trapdoorshowindex) | yes | — |
| `last_gate` | `integer` | yes | min: `0`; max: `11`; K, the last gate drawn (`0` before gate 1); never the Golden Door, after which the show is over. |
| `seed` | [`TrapdoorHex`](#trapdoorhex) | yes | — |
| `commit` | [`TrapdoorHex`](#trapdoorhex) | yes | — |
| `salt` | [`TrapdoorHex`](#trapdoorhex) | yes | — |
| `layouts` | array<[`TrapdoorLayout`](#trapdoorlayout)> | yes | maxItems: `11`; The layouts of gates `1.. K`, in order (empty at K = 0). |

### `TrapdoorMe`

The viewer's own bean, in their snapshot only, whole: a socket that reconnects learns from it everything the frames it missed said of its bean (`entry`, `bean`, its settlement's view), and nothing of any other bean. `result` is there once the bean is no longer `alive`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bean` | [`TrapdoorBean`](#trapdoorbean) | yes | — |
| `state` | `string` | yes | enum: `alive`, `banked`, `fell`, `refunded`; The bean's state. |
| `cap_gate` | [`TrapdoorGate`](#trapdoorgate) | yes | — |
| `door1` | `integer` | yes | min: `1`; max: `3`; The door for gate 1 the bet named. |
| `picks` | array<[`TrapdoorDoor`](#trapdoordoor)> | yes | maxItems: `12`; The doors the bean played, gates `1..` in order. |
| `pick` | [`TrapdoorDoor`](#trapdoordoor) | no | The bean's live pick for the open window's gate, when it has one. |
| `banking` | `boolean` | yes | Whether the bean clicked bank in the open window (never at gate 1). |
| `plan` | [`TrapdoorBeanPlan`](#trapdoorbeanplan) | yes | — |
| `result` | [`TrapdoorResult`](#trapdoorresult) | no | The bean's settled view, its record's `game_result` and its settlement's `view`, once it fell, banked or was refunded. |

### `TrapdoorSnapshot`

A TRAPDOOR show as one viewer sees it now, `TrapdoorProjectedSnapshot.show`. `phase` is `lobby` until the lobby's close (gate 1's picks are taken from the lobby on), `window` from then until the Golden Door is drawn (`gate` is the next gate to be drawn), then `results`, or `aborted` after an outage; `gate` is `0` in those two. `seed` is there only once the show is over, and `me` only for a viewer with a bean in it. It carries no crowd figure, no count, list or bar of other beans: crowd figures are omitted so that any count is the viewer's own operator's, computed by `live`, and TRAPDOOR v1 shows none. Adding one is an additive key on `TrapdoorProjectedSnapshot`, made in the live server's projection, never in this one.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"snapshot"` | yes | const: `"snapshot"`; Always `snapshot`. |
| `show` | [`TrapdoorLobby`](#trapdoorlobby) | yes | — |
| `phase` | `string` | yes | enum: `lobby`, `window`, `results`, `aborted`; Where the show is. |
| `gate` | `integer` | yes | min: `0`; max: `12`; The gate to be drawn next (`1` in the lobby), or `0` once the show is over. |
| `layouts` | array<[`TrapdoorLayout`](#trapdoorlayout)> | yes | maxItems: `12`; The layouts drawn so far, gates `1..` in order. |
| `seed` | [`TrapdoorHex`](#trapdoorhex) | no | The revealed seed `s_i`, once the show is over (`results` or `aborted`). |
| `me` | [`TrapdoorMe`](#trapdoorme) | no | — |

### `TrapdoorProjectedSnapshot`

`data` of a `snapshot` frame on `/v1/live/trapdoor` while a show is open: the viewer's `TrapdoorSnapshot` under `show`, and the viewer's own bet. It carries no `operator_totals`, no `round_totals` and no count: a show's figure less the viewer's own operator's, which its operator knows from its records, would tell it the other operators'. `live` adds no totals for TRAPDOOR.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `show` | [`TrapdoorSnapshot`](#trapdoorsnapshot) | yes | — |
| `self_bets` | array<[`LiveSelfBet`](#liveselfbet)> | no | maxItems: `1`; The viewer's own bet in the show, when there is one (a player has at most one bean per show). |

### `TrapdoorPickAck`

`data` of the `ack` answering an applied `pick`: the bean's live pick for `gate` is now `door`. It decides the gate only if nothing ranks above it at the window's close (`TrapdoorCommand`): a later `bank` in the same window, or the bean's plan banking after `gate − 1`, comes first; send a `plan` without that `bank_at` to play on.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"ack"` | yes | const: `"ack"`; Always `ack`. |
| `request_id` | [`TrapdoorSocketRequestId`](#trapdoorsocketrequestid) | yes | The command's `request_id`. |
| `kind` | `"pick"` | yes | const: `"pick"`; Always `pick`. |
| `gate` | [`TrapdoorGate`](#trapdoorgate) | yes | — |
| `door` | [`TrapdoorDoor`](#trapdoordoor) | yes | — |

### `TrapdoorBankAck`

`data` of the `ack` answering an applied `bank`: the bean banks `bank(gate − 1)` at this window's close, unless a later `pick` in the same window replaces the click.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"ack"` | yes | const: `"ack"`; Always `ack`. |
| `request_id` | [`TrapdoorSocketRequestId`](#trapdoorsocketrequestid) | yes | The command's `request_id`. |
| `kind` | `"bank"` | yes | const: `"bank"`; Always `bank`. |
| `gate` | `integer` | yes | min: `2`; max: `12`; The gate whose window the click is in. |

### `TrapdoorPlanAck`

`data` of the `ack` answering an applied `plan`: the pre-plan as the show now keeps it, used from the next window's close.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"ack"` | yes | const: `"ack"`; Always `ack`. |
| `request_id` | [`TrapdoorSocketRequestId`](#trapdoorsocketrequestid) | yes | The command's `request_id`. |
| `kind` | `"plan"` | yes | const: `"plan"`; Always `plan`. |
| `plan` | [`TrapdoorBeanPlan`](#trapdoorbeanplan) | yes | — |

### `TrapdoorMoveError`

`data` of the show's `error` frame refusing a `pick`, `bank` or `plan`, which changed nothing (the game specification, the source's codes): `no_bean` (no bean in this show), `not_alive` (it fell or banked), `phase` (no window is open: the lock or the reveal, which `live` refuses for the show, `TrapdoorCommand`), `late` (that gate's window has closed), `bad_gate` (that gate's window is not open), `bad_door` (no such door at that gate), `no_bank_at_gate_1`, `bad_plan` (a plan the show does not take), `invalid_action` (the command's `data` is not its shape), `pending` (the player's bet or the platform's force-close of its bean is still being placed or settled: the move changed nothing, the show remembers no answer for it, and the same id may be sent again; through `live` a socket does not receive this: `live` refuses a move while the player's own bet or force-close is in flight with `LiveHubError` `pending`, which likewise changed nothing).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"error"` | yes | const: `"error"`; Always `error`. |
| `request_id` | [`TrapdoorSocketRequestId`](#trapdoorsocketrequestid) | yes | The command's `request_id`. |
| `kind` | `string` | yes | enum: `pick`, `bank`, `plan`; The command's `type`. |
| `code` | `string` | yes | enum: `no_bean`, `not_alive`, `phase`, `late`, `bad_gate`, `bad_door`, `no_bank_at_gate_1`, `bad_plan`, `invalid_action`, `pending`; Why the show refused it. |
| `message` | `string` | yes | minLength: `1`; The refusal in words safe to show the player. |

### `TrapdoorBetError`

`data` of the show's `error` frame to the bettor's sockets when a bet was not placed. The REST answer to `createLiveBet` is the authority (its problem carries the same `code`); this frame tells the bettor's open sockets too. `code` is an engine code: the show's own refusals (`invalid_input`, `stake_out_of_range`, `max_stake`, `closed`, `limit`); the reason `live` aborted a placement whose money failed; or `pending` for a second placement under a request id whose first is still in flight, which the show answers without remembering it. A placement `live` aborted never happened: the show forgets it, and `live` keeps its request id void, so a reuse of that id is refused (`api` never reuses one: each debit attempt has its own, `TrapdoorBetRequestId`). Any other request id answers its first outcome again, its `entry` or its refusal.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"error"` | yes | const: `"error"`; Always `error`. |
| `request_id` | [`TrapdoorBetRequestId`](#trapdoorbetrequestid) | yes | — |
| `kind` | `"bet"` | yes | const: `"bet"`; Always `bet`. |
| `code` | `string` | yes | enum: `invalid_input`, `invalid_action`, `stake_out_of_range`, `max_stake`, `unknown_profile`, `not_offered`, `odds_changed`, `closed`, `limit`, `pending`, `seed_not_revealed`, `unknown_game`, `unknown_version`, `no_acceptable_draw`, `internal`; Why the bet was not placed. |
| `message` | `string` | yes | minLength: `1`; The refusal in words safe to show the player. |
| `max_stake` | [`Amount`](#amount-1) | no | With `max_stake` only, the largest stake that bet takes. |

### `TrapdoorResult`

A settled bean's view, the record's `game_result`, with exactly these keys in this order. `picks` and `traps` hold the gates the bean played, each already revealed; `at` is the last gate played, the gate whose bank is paid for a bank, and `0` for a refund. `end` is `BANKED` (with a `reason`), `ELIMINATED` (`reason` `null`, `multiplier` `"0.00"`) or `REFUNDED` (`picks` and `traps` empty, `multiplier` `"1.00"`, `reason` `ABORT` or `DISCONNECT`). A bean that banks at a window's close banks `bank` with the gates `1.. at` only.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `v` | `1` | yes | const: `1`; The record's version, `1`. |
| `show` | [`TrapdoorShowIndex`](#trapdoorshowindex) | yes | — |
| `index` | [`TrapdoorShowIndex`](#trapdoorshowindex) | yes | — |
| `format` | [`TrapdoorFormat`](#trapdoorformat) | yes | — |
| `cap` | [`TrapdoorGate`](#trapdoorgate) | yes | — |
| `picks` | array<[`TrapdoorDoor`](#trapdoordoor)> | yes | maxItems: `12`; The door played at each gate `1.. at`. |
| `traps` | array<[`TrapdoorLayout`](#trapdoorlayout)> | yes | maxItems: `12`; Each played gate's layout. |
| `end` | `string` | yes | enum: `BANKED`, `ELIMINATED`, `REFUNDED`; How the bean ended. |
| `at` | `integer` | yes | min: `0`; max: `12`; The last gate played (`0` for a refund). |
| `reason` | `string | null` | yes | enum: `MANUAL`, `PLAN`, `NO_PICK`, `DISCONNECT`, `ABORT`, `CAP`, `FINALE`, `null`; Why it banked or was refunded; `null` for a fall. |
| `multiplier` | `string` | yes | pattern: `^[0-9]+\.[0-9]{2}$`; `bank` with 2 decimals for a bank, `"0.00"` for a fall, `"1.00"` for a refund. |

### `TrapdoorSettlement`

`data` of the `settled` frame for a TRAPDOOR bean: a `LiveSettlement` whose `view` is the bean's `TrapdoorResult`. `settled_by` comes from the record's last action, never from `reason`, since `DISCONNECT` names both a socket gone at a window's close (`play`) and a force-close: `force_close` when that action's `do` is `force_close` (the view banks `bank(K)` with `DISCONNECT`, or refunds with `DISCONNECT` before gate 1), `outage` when its `do` is `abort` (reason `ABORT`), and `play` otherwise (a fall, `MANUAL`, `PLAN`, `NO_PICK`, a `DISCONNECT` at a window's close, `CAP`, `FINALE`). `refund` is the whole stake for a refund and `0` for every other end, and `payout` is `⌊stake · bank / 100⌋` for a bank, `0` for a fall.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bet_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,48}$`; The bet's id, `createLiveBet`'s `bet_id`. |
| `currency` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The bet's currency. |
| `stake` | [`Amount`](#amount-1) | yes | — |
| `payout` | [`Amount`](#amount-1) | yes | — |
| `refund` | [`Amount`](#amount-1) | yes | — |
| `settled_by` | `string` | yes | enum: `play`, `force_close`, `outage`; Which path settled the bean, read from the record's last action. |
| `view` | [`TrapdoorResult`](#trapdoorresult) | yes | — |

### `TrapdoorFrameData`

Union of TRAPDOOR's `LiveFrame.data` bodies (the game specification).

- **Type:** `TrapdoorLobby | TrapdoorEntry | TrapdoorReveal | TrapdoorBeanGate | TrapdoorResults | TrapdoorAborted | TrapdoorProjectedSnapshot | LiveIdleSnapshot | TrapdoorPickAck | TrapdoorBankAck | TrapdoorPlanAck | TrapdoorMoveError | TrapdoorBetError | TrapdoorSettlement | LiveHubError`

- **`oneOf[0]`:** [`TrapdoorLobby`](#trapdoorlobby)

- **`oneOf[1]`:** [`TrapdoorEntry`](#trapdoorentry)

- **`oneOf[2]`:** [`TrapdoorReveal`](#trapdoorreveal)

- **`oneOf[3]`:** [`TrapdoorBeanGate`](#trapdoorbeangate)

- **`oneOf[4]`:** [`TrapdoorResults`](#trapdoorresults)

- **`oneOf[5]`:** [`TrapdoorAborted`](#trapdooraborted)

- **`oneOf[6]`:** [`TrapdoorProjectedSnapshot`](#trapdoorprojectedsnapshot)

- **`oneOf[7]`:** [`LiveIdleSnapshot`](#liveidlesnapshot)

- **`oneOf[8]`:** [`TrapdoorPickAck`](#trapdoorpickack)

- **`oneOf[9]`:** [`TrapdoorBankAck`](#trapdoorbankack)

- **`oneOf[10]`:** [`TrapdoorPlanAck`](#trapdoorplanack)

- **`oneOf[11]`:** [`TrapdoorMoveError`](#trapdoormoveerror)

- **`oneOf[12]`:** [`TrapdoorBetError`](#trapdoorbeterror)

- **`oneOf[13]`:** [`TrapdoorSettlement`](#trapdoorsettlement)

- **`oneOf[14]`:** [`LiveHubError`](#livehuberror)

### `TrapdoorFrame`

A server-to-client frame on `/v1/live/trapdoor` (`game: "trapdoor"`). `type` is its body's own `type` (`lobby`, `entry`, `reveal`, `bean`, `results`, `aborted`, `snapshot`, `ack`, `error`), or `settled` for a settlement, whose body has none; `request_id` is set on `entry`, `ack` and `error`. One command gets exactly one answer: an `ack` when the show applied it, or one `error` when it did not; `live` sends no second, generic `ack` after a TRAPDOOR command's own answer. The socket's first frame, `welcome` (`{protocol, game}`), is a plain `LiveFrame` as on every live game, not a `TrapdoorFrame`.

- **Who gets what.** `lobby`, `reveal`, `results` and `aborted` go to every socket of the show, which is one per environment and shared by every operator: the link and the clock decide them, never a bet, and none names, counts or lists a bean. `entry`, `bean`, `ack`, `error`, `settled` and a `snapshot` go to one player's sockets and depend on that player's own bean alone. No frame is caused by another operator's bet, and none carries a player's identity, an operator's, a count or list of other players' beans, or a composite player key (platform policy); a bean's label (`TrapdoorBean`) counts its own player's beans only. Every `at` is `LiveFrame.at`'s: the time of the frame's one cause (a step, a command, the socket's join, the outage rule), never one `live` reached after waiting on other players' work; so `entry` carries the bet's own arrival at `live`, not the time its money committed.
- **What is revealed when.** A gate's layout leaves the writer only in its own `reveal`, after every decision for it was fixed; the seed only in `results`, `aborted`, and a snapshot taken after them. A bean settled before then has a view with only the gates it played.
- **Clocks** are the live server's: a lobby of 10,000 ms, bets until 1,500 ms past its close; a window of 3,000 ms per gate, with a strict edge; then the lock and the reveal before the next window. The next show's lobby opens at the Golden Door's due time (its window's close plus 50 ms) plus the results hold: the drumroll, the Golden Door's reveal and the results, 7,900 ms CLASSIC and 8,900 ms MEGA, a schedule the link and the clock decide, never the beans. A close that overruns the hold is an alerted fault: the lobby then opens at the first slot at or after the instant the close ended, slots being whole results holds counted from where it would have opened ("Time"), the same for every operator, with no frame saying why; after `aborted` the same rule runs from gate K's due time (from the show's own origin at K = 0).

---

- **Type:** `LiveFrame & object`

- **`allOf[0]`:** [`LiveFrame`](#liveframe)

- **`allOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `game` | `"trapdoor"` | yes | const: `"trapdoor"`; Always `trapdoor`. |
| `data` | [`TrapdoorFrameData`](#trapdoorframedata) | yes | — |

### `TrapdoorPickData`

A `pick`'s `data`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `gate` | `integer` | yes | The gate, a JSON integer literal; the show answers `bad_gate` or `late` for a gate whose window is not open. |
| `door` | `integer` | yes | The door, a JSON integer literal; the show answers `bad_door` outside `1.. n_gate`. |

### `TrapdoorBankData`

A `bank`'s `data`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `gate` | `integer` | yes | The gate whose window is open, a JSON integer literal; `1` is `no_bank_at_gate_1`. |

### `TrapdoorCommand`

A TRAPDOOR player's socket command, in the `LiveCommand` envelope: `snapshot`, `pick`, `bank` or `plan`, and nothing else. The bet is not a socket command (`createLiveBet`), and `force_close`, `no_pick` and `disconnect` are the platform's: `live` sends them under a `Platform:` request id, and a player's command of any kind but these four is refused `invalid_action` (`LiveHubError`) before the show sees it. At gate `g`'s close each live bean's decision is, in this order: at gate 1, its live pick, else `door1`; from gate 2, a bank click in this window (`MANUAL`), else its plan's `bank_at = g − 1` (`PLAN`), else its live pick, else its plan's door, else `DISCONNECT` when its player has no socket and `NO_PICK` otherwise. So a planned bank beats a live pick: send a `plan` without that `bank_at` to play on. A command is applied at its own arrival: `live` stamps it when it receives it, before any queue it shares with other players, and applies it against the show's step schedule, so every step due at or before the arrival has run, and no step due after the arrival runs before the command is applied. Gate `g`'s draw (`Step(g)`) runs only after every `pick`, `bank` and `plan` that arrived before gate `g`'s window closed is applied, and after the live server's `disconnect` for each live bean whose player has no socket then; a move that arrives at or after the close never decides gate `g` (`late` for a `pick` or `bank` naming it, `phase` during the lock and the reveal, below).

- **`pick`** (`gate`, `door`): the bean's live pick for that gate, gate 1's from the lobby on (it replaces the bet's `door1`), gate `g`'s during its window; it replaces a bank click in the same window, and ranks below the plan's `bank_at` (above).
- **`bank`** (`gate` >= 2): bank `bank(gate − 1)` at that window's close.
- **`plan`** (`TrapdoorPlanData`, `data` absent clears it): the bean's pre-plan from the next window's close.
- **The window is the live server's.** It stamps each move with its own clock and refuses it before the show sees it when no window takes it, with the show's own `error` frame (`TrapdoorMoveError`): `late` for a gate whose window has ended (the edge is strict), `phase` during the lock and the reveal. At gate `g`'s close it sends `disconnect` with `{"gate": g}` for each live bean whose player has no socket then (`no_pick` with the same body records that the player had one, the default), and then draws gate `g` (`Step(g)`): the decision rule of the game specification banks a bean so marked `DISCONNECT` and any other bean with no door and no bank `NO_PICK`. Neither platform command is answered on any socket.
- **Request ids.** A socket `request_id` (`TrapdoorSocketRequestId`) never takes the form of the platform's (`Platform:`) or of a REST bet's (`Bet:`, `TrapdoorBetRequestId`), so a socket move and a bet never answer each other. A repeated socket id gets its first answer again while one writer holds the show (the last 256 ids per player). An applied command is journaled, so its answer survives a takeover; a refused one is not, so after a takeover the same id is decided again on the show as it then is. A refusal changed nothing, so that is safe.

---

- **Type:** `TrapdoorSnapshotCommand | TrapdoorPickCommand | TrapdoorBankCommand | TrapdoorPlanCommand`

- **`oneOf[0]`:** [`TrapdoorSnapshotCommand`](#trapdoorsnapshotcommand)

- **`oneOf[1]`:** [`TrapdoorPickCommand`](#trapdoorpickcommand)

- **`oneOf[2]`:** [`TrapdoorBankCommand`](#trapdoorbankcommand)

- **`oneOf[3]`:** [`TrapdoorPlanCommand`](#trapdoorplancommand)

### `TrapdoorSnapshotCommand`

Ask for a fresh snapshot (`TrapdoorProjectedSnapshot`, or `LiveIdleSnapshot` between shows).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"snapshot"` | yes | const: `"snapshot"`; Always `snapshot`. |
| `request_id` | [`TrapdoorSocketRequestId`](#trapdoorsocketrequestid) | yes | — |
| `data` | `object` | no | None; `{}` is allowed. |

### `TrapdoorPickCommand`

Pick a door for a gate.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"pick"` | yes | const: `"pick"`; Always `pick`. |
| `request_id` | [`TrapdoorSocketRequestId`](#trapdoorsocketrequestid) | yes | — |
| `data` | [`TrapdoorPickData`](#trapdoorpickdata) | yes | — |

### `TrapdoorBankCommand`

Bank at the open window's close.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"bank"` | yes | const: `"bank"`; Always `bank`. |
| `request_id` | [`TrapdoorSocketRequestId`](#trapdoorsocketrequestid) | yes | — |
| `data` | [`TrapdoorBankData`](#trapdoorbankdata) | yes | — |

### `TrapdoorPlanCommand`

Replace the bean's pre-plan.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"plan"` | yes | const: `"plan"`; Always `plan`. |
| `request_id` | [`TrapdoorSocketRequestId`](#trapdoorsocketrequestid) | yes | — |
| `data` | [`TrapdoorPlanData`](#trapdoorplandata) | no | — |

### `CrashSocketRequestId`

A CRASH socket command's `request_id`, chosen by the client: 1 to 64 bytes of UTF-8 (`live` counts bytes) that do not start with `Platform:` (the platform's `force_close`) or `Bet:` (the REST bets placed in the show, `CrashBetRequestId`), in any case. `live` refuses `Platform:` with `invalid_input` (`LiveHubError`) before the show sees the command, in any spelling, and from refuses `Bet:` the same way. The show keeps one answer per player and request id whatever the command's kind, so these namespaces are what keep a cash-out and a REST bet from ever answering each other.

- **Type:** `string`
- **Constraints:** minLength: `1`; maxLength: `64`

### `CrashBetRequestId`

A CRASH REST bet's request id in the show, `Bet:<bet_id>:<n>`, the form TRAPDOOR's takes (`TrapdoorBetRequestId`): `<bet_id>` is `createLiveBet`'s `bet_id` and `<n>` the number of its debit attempt, whose wallet transaction id is `<bet_id>:0:<n>:debit` (6). `api` makes it, so no client chooses it, and no socket `request_id` can take its form (`CrashSocketRequestId`). It names one placement attempt only: a repeat of the REST call's `Idempotency-Key` replays `api`'s stored answer and never reaches the show, and a new attempt has a new `<n>`.

- **Type:** `string`
- **Constraints:** pattern: `^Bet:[A-Za-z0-9_-]{1,48}:[1-9][0-9]{0,4}$`; maxLength: `64`

### `CrashChainIndex`

A CRASH show's public id: the index of its link in the published hash chain, `1.. 10,000,000`, which is also the link's nonce. It is the `index` of the show's frames and the `round_index` of its bets' views, and `createLiveBet` names the show by it (`show`).

- **Type:** `integer`
- **Constraints:** min: `1`; max: `10000000`

### `CrashHex`

64 lowercase hex characters (a seed, a commitment or a salt).

- **Type:** `string`
- **Constraints:** pattern: `^[0-9a-f]{64}$`

### `CrashMultiplier`

A multiplier on CRASH's curve, `1.00` to `1000000.00`, with exactly 2 decimals.

- **Type:** `string`
- **Constraints:** pattern: `^([1-9][0-9]{0,5}\.[0-9]{2}|1000000\.00)$`

### `CrashTarget`

A winning multiplier, `1.01` to `1000000.00`, with exactly 2 decimals: an `auto_cashout` target or a cap as the show keeps it.

- **Type:** `string`
- **Constraints:** pattern: `^(1\.(0[1-9]|[1-9][0-9])|([2-9]|[1-9][0-9]{1,5})\.[0-9]{2}|1000000\.00)$`

### `CrashTick`

A tick of the flight, `t = 0.. 2,303`, one every 100 ms; step `k` runs tick `k − 1`.

- **Type:** `integer`
- **Constraints:** min: `0`; max: `2303`

### `CrashLobby`

`data` of the `lobby` broadcast that opens a show for bets, and the `show` of every CRASH snapshot: the link's public part and when the lobby closes. Bets (`createLiveBet`, naming this `index` as `show`) are taken while the show is `WAITING`, which it is for every bet that reaches `live` before `lobby_closes_at` (`CrashCommand`'s arrival rule); `live` ends that with the show's first step at `lobby_closes_at` (a lobby of 5,000 ms), which launches the rocket or busts it at 1.00x. The seed stays in the writer until `crashed` or `aborted`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"lobby"` | yes | const: `"lobby"`; Always `lobby`. |
| `chain` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The published hash chain's id. `<chain>-<index>` is the show's round id (`LiveBet.show_round_id`), which fits 64 characters; `live` opens no show on a chain whose id it cannot carry. |
| `index` | [`CrashChainIndex`](#crashchainindex) | yes | — |
| `commit` | [`CrashHex`](#crashhex) | yes | The link's commitment `s_{i-1} = sha256_hex(s_i)`, published before the chain's first show. |
| `salt` | [`CrashHex`](#crashhex) | yes | The chain's public salt, a block hash fixed after the commitment. |
| `salt_source` | `string` | yes | pattern: `^bitcoin:[1-9][0-9]{5,8}$`; Where the salt comes from, `bitcoin:<height>`. |
| `lobby_closes_at` | `integer` | yes | Unix time in milliseconds when the lobby closes, 5,000 ms after the show opened. |

### `CrashPlacedBet`

A placed CRASH bet: the same object as `createLiveBet`'s `view` in `openapi.yaml` (`CrashBetView`), and the first view of the bet's record. It holds the bet's inputs and limits only, never anything drawn. `cap_multiplier` is `C_cap`, snapshotted at the bet from the maximum profit; the bet exits on its own at its `auto_cashout`, else at `cap_multiplier`, so no payout is ever cut. `exposure` is its worst-case credit, `⌊stake · C_eff / 100⌋` at that exit.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `chain_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The show's chain, the `chain` of its `lobby`. |
| `round_index` | [`CrashChainIndex`](#crashchainindex) | yes | — |
| `bet_amt` | [`Amount`](#amount-1) | yes | — |
| `auto_cashout` | [`CrashTarget`](#crashtarget) \| `null` | yes | The bet's automatic cash-out target, or `null` when it named none. |
| `cap_multiplier` | [`CrashTarget`](#crashtarget) | yes | — |
| `exposure` | [`Amount`](#amount-1) | yes | — |

### `CrashBetAccepted`

`data` of the `bet` frame sent to the bettor's own sockets once the show's journal holds the bet. A replay (a takeover) may commit different players' bets in another order than live did, and `live` never re-sends what a replay sends, so the order of different players' `bet` frames carries nothing.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"bet"` | yes | const: `"bet"`; Always `bet`. |
| `request_id` | [`CrashBetRequestId`](#crashbetrequestid) | yes | — |
| `bet` | [`CrashPlacedBet`](#crashplacedbet) | yes | — |

### `CrashTickFrame`

`data` of the `tick` broadcast for each tick the rocket survives: `multiplier` is the curve at that tick, `M(t)` (`1.00` at ticks 0 and 1, `1.01` from tick 2), and `elapsed_ms` is `100 · tick`. The tick that crashes the rocket, and tick 2,303, have no `tick` frame: `crashed` is theirs. Bets that exit at this tick on their own (`auto_cashout` or cap) settle in the same step, each told to its own player alone.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"tick"` | yes | const: `"tick"`; Always `tick`. |
| `tick` | `integer` | yes | min: `0`; max: `2302`; The tick, `0.. 2,302`. |
| `multiplier` | [`CrashMultiplier`](#crashmultiplier) | yes | — |
| `elapsed_ms` | `integer` | yes | min: `0`; max: `230200`; `100 · tick`, the flight's time at this tick. |

### `CrashCrashed`

`data` of the `crashed` broadcast that ends a show: the rocket crashed at `crash_point` on step `step` (tick `step − 1`), or reached the 1,000,000.00x finale. It reveals the seed `s_i` (`sha256_hex(server_seed) == commit`), so every bet's record verifies. `step` equals `crash_step`; `multiplier` is the curve at `tick`, the first value above `crash_point`, equal to it only at a 1.00x bust (`step` 1) and at the finale (`step` 2,304). Every bet still open settles in this step: one whose `auto_cashout` or cap is at most `crash_point` wins there, between two ticks if need be, and the rest lose; their settlements follow on their players' sockets. The next lobby opens at this step's due time plus `hold_ms` (4,000 ms), however many bets settled, or at the schedule's next fixed slot if the close overran the hold (an alerted fault, `CrashFrame`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"crashed"` | yes | const: `"crashed"`; Always `crashed`. |
| `step` | `integer` | yes | min: `1`; max: `2304`; The step that ended the show, `crash_step`. |
| `tick` | [`CrashTick`](#crashtick) | yes | — |
| `multiplier` | [`CrashMultiplier`](#crashmultiplier) | yes | — |
| `crash_point` | [`CrashMultiplier`](#crashmultiplier) | yes | — |
| `crash_step` | `integer` | yes | min: `1`; max: `2304`; The step that reveals the show, the first whose tick's multiplier passes `crash_point`. |
| `chain` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The show's chain. |
| `index` | [`CrashChainIndex`](#crashchainindex) | yes | — |
| `server_seed` | [`CrashHex`](#crashhex) | yes | The revealed seed `s_i`. |
| `commit` | [`CrashHex`](#crashhex) | yes | — |
| `salt` | [`CrashHex`](#crashhex) | yes | — |

### `CrashAborted`

`data` of the `aborted` broadcast when the outage rule ends a show at its last journaled step `step` (K), with no draw. Every bet still open settles as the platform's force-close would at K, with reason `ABORT` (`settled_by: outage`): a refund in the lobby (K = 0), a push at 1.00x at ticks 0 and 1, a cash-out at the tick's multiplier from tick 2; a bet already settled keeps its result. Their settlements follow on their players' sockets. `tick` and `multiplier` are `null` at K = 0, else tick `K − 1` and its multiplier, which is at most `crash_point`; `crash_step` is past `step`. The seed is revealed, and with it the crash point the rocket never reached. This is CRASH's own `aborted` frame: `live` sends no other for its show. Its `at`, and that of the settlements it makes, is the time the outage rule ended the show, which no bet moves; the next lobby opens at a fixed slot of the schedule.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"aborted"` | yes | const: `"aborted"`; Always `aborted`. |
| `step` | `integer` | yes | min: `0`; max: `2303`; K, the show's last journaled step (`0` in the lobby). |
| `tick` | `integer` \| `null` | yes | Tick `K − 1`, or `null` at K = 0. |
| `multiplier` | [`CrashMultiplier`](#crashmultiplier) \| `null` | yes | The multiplier at `tick`, or `null` at K = 0. |
| `crash_point` | [`CrashMultiplier`](#crashmultiplier) | yes | — |
| `crash_step` | `integer` | yes | min: `1`; max: `2304`; The step that would have revealed the show. |
| `chain` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The show's chain. |
| `index` | [`CrashChainIndex`](#crashchainindex) | yes | — |
| `server_seed` | [`CrashHex`](#crashhex) | yes | The revealed seed `s_i`. |
| `commit` | [`CrashHex`](#crashhex) | yes | — |
| `salt` | [`CrashHex`](#crashhex) | yes | — |

### `CrashMe`

The viewer's own bet, in their snapshot only: the placed bet, whether it has settled, and once it has, its settled view (`CrashResult`), the same as its settlement's.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bet` | [`CrashPlacedBet`](#crashplacedbet) | yes | — |
| `settled` | `boolean` | yes | Whether the bet has settled. |
| `view` | [`CrashResult`](#crashresult) | no | — |

### `CrashSnapshot`

A CRASH show as one viewer sees it now, `CrashProjectedSnapshot.show`. `phase` is `WAITING` in the lobby (`step` 0, with `tick`, `multiplier` and `elapsed_ms` `null`), `ACTIVE` while the rocket flies (`step` the last one run, its tick `step − 1` and that tick's multiplier), then `CRASHED`, or `ABORTED` after an outage, with `reveal`, the show's own `crashed` or `aborted` frame, which holds the seed: `reveal` is there only once the show is over. `me` is there only for a viewer with a bet in the show. It carries no crowd figure: crowd figures follow Owner isolation policy: CRASH v1 omits crowd counts so broadcasts depend only on the chain link and clock.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"snapshot"` | yes | const: `"snapshot"`; Always `snapshot`. |
| `show` | [`CrashLobby`](#crashlobby) | yes | — |
| `phase` | `string` | yes | enum: `WAITING`, `ACTIVE`, `CRASHED`, `ABORTED`; Where the show is. |
| `step` | `integer` | yes | min: `0`; max: `2304`; The last step run (`0` in the lobby). |
| `tick` | [`CrashTick`](#crashtick) \| `null` | yes | The tick of `step`, `step − 1`, or `null` at step 0. |
| `multiplier` | [`CrashMultiplier`](#crashmultiplier) \| `null` | yes | The multiplier at `tick`, or `null` at step 0. |
| `elapsed_ms` | `integer` \| `null` | yes | `100 · tick`, or `null` at step 0. |
| `reveal` | [`CrashCrashed`](#crashcrashed) \| [`CrashAborted`](#crashaborted) | no | The show's `crashed` or `aborted` frame, once it is over. |
| `me` | [`CrashMe`](#crashme) | no | — |

### `CrashProjectedSnapshot`

`data` of a `snapshot` frame on `/v1/live/crash` while a show is open: the viewer's `CrashSnapshot` under `show`, and the viewer's own bet. It carries no `operator_totals`, no `round_totals` and no count: a show's figure less the viewer's own operator's, which its operator knows from its records, would tell it the other operators'. `live` strips the engine's `bets` and `open` and adds no totals for CRASH.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `show` | [`CrashSnapshot`](#crashsnapshot) | yes | — |
| `self_bets` | array<[`LiveSelfBet`](#liveselfbet)> | no | maxItems: `1`; The viewer's own bet in the show, when there is one (a player has at most one per show). |

### `CrashCashoutAck`

`data` of the `ack` answering an applied `cashout`: the player's bet cashed out at the tick its arrival names, the last tick whose step was due at or before the command reached `live`, at that tick's multiplier (`CrashCommand`); no other player's command moves it. Its settlement follows on the same sockets, and nothing on any other operator's. A repeat of the request id gets this `ack` again, a takeover included.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"ack"` | yes | const: `"ack"`; Always `ack`. |
| `request_id` | [`CrashSocketRequestId`](#crashsocketrequestid) | yes | The command's `request_id`. |
| `kind` | `"cashout"` | yes | const: `"cashout"`; Always `cashout`. |

### `CrashCashoutError`

`data` of the show's `error` frame refusing a `cashout`, which changed nothing (the game specification steps 9 to 12, in that order): `invalid_action` (the command's `data` holds a field), `wrong_phase` (the rocket is not flying: the lobby, or the show is over), `no_bet` (no open bet in this show: none placed, or it already settled), `not_cashable` (ticks 0 and 1, where the curve shows 1.00x, which is no win). The message is the spec's, `socket command refused: <code>`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"error"` | yes | const: `"error"`; Always `error`. |
| `request_id` | [`CrashSocketRequestId`](#crashsocketrequestid) | yes | The command's `request_id`. |
| `kind` | `"cashout"` | yes | const: `"cashout"`; Always `cashout`. |
| `code` | `string` | yes | enum: `invalid_action`, `wrong_phase`, `no_bet`, `not_cashable`; Why the show refused it. |
| `message` | `string` | yes | pattern: `^socket command refused: (invalid_action\|wrong_phase\|no_bet\|not_cashable)$`; `socket command refused: <code>`, the same code. |

### `CrashBetError`

`data` of the show's `error` frame to the bettor's sockets when a bet was not placed. The REST answer to `createLiveBet` is the authority (its problem carries the same `code`); this frame tells the bettor's open sockets too. `code` is an engine code: the show's own refusals, in the game specification's order (`invalid_input` for params, `closed` once the lobby has closed, `limit` for a second bet by the player in the show, `invalid_input` for a stake whose `stake + max_profit` does not fit an amount, `stake_out_of_range`, `invalid_input` for `auto_cashout`, `max_stake` with `max_stake`), or the reason `live` aborted a placement whose money failed. A placement `live` aborted never happened: the show forgets it, and `live` keeps its request id void, so a reuse of that id is refused (`api` never reuses one: each debit attempt has its own, `CrashBetRequestId`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"error"` | yes | const: `"error"`; Always `error`. |
| `request_id` | [`CrashBetRequestId`](#crashbetrequestid) | yes | — |
| `kind` | `"bet"` | yes | const: `"bet"`; Always `bet`. |
| `code` | `string` | yes | enum: `invalid_input`, `invalid_action`, `stake_out_of_range`, `max_stake`, `unknown_profile`, `not_offered`, `odds_changed`, `closed`, `limit`, `pending`, `seed_not_revealed`, `unknown_game`, `unknown_version`, `no_acceptable_draw`, `internal`; Why the bet was not placed. |
| `message` | `string` | yes | minLength: `1`; The refusal in words safe to show the player (from the game specification for the show's own refusals). |
| `max_stake` | [`Amount`](#amount-1) | no | With `max_stake` only, the largest stake that bet takes at its `auto_cashout` (else at 1.01x). |

### `CrashResultBeforeReveal`

A CRASH bet's settled view when it settled before the step that revealed its show: a cash-out (manual, or on its own at a tick the rocket survived), the platform's force-close, or the outage abort. It has no `crash_point` and no `crash_step`, which this schema refuses, and `seed_revealed_at_settle` is `false`: every field is the bet's input, its limits or the public curve at its step. `ended_by` is `CASHED_OUT` (reason `MANUAL`, `AUTO` or `CAP`, with `multiplier` the exit, at least 1.01) or `FORCE_CLOSED` (reason `FORCE_CLOSED`, or `ABORT` for the outage), which in the lobby (`settled_step` 0, `at_tick` and `elapsed_ms` `null`) is a refund with `multiplier` `null`, at ticks 0 and 1 a push at `1.00`, and from tick 2 a cash-out at the tick's multiplier.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `chain_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The show's chain. |
| `round_index` | [`CrashChainIndex`](#crashchainindex) | yes | — |
| `ended_by` | `string` | yes | enum: `CASHED_OUT`, `FORCE_CLOSED`; How the bet ended. |
| `reason` | `string` | yes | enum: `MANUAL`, `AUTO`, `CAP`, `FORCE_CLOSED`, `ABORT`; Why. |
| `auto_cashout` | [`CrashTarget`](#crashtarget) \| `null` | yes | The bet's `auto_cashout`, or `null`. |
| `cap_multiplier` | [`CrashTarget`](#crashtarget) | yes | — |
| `settled_step` | `integer` | yes | min: `0`; max: `2303`; The step it settled on (`0` in the lobby). |
| `at_tick` | `integer` \| `null` | yes | The tick it settled at, `settled_step − 1`, or `null` in the lobby. |
| `elapsed_ms` | `integer` \| `null` | yes | `100 · at_tick`, or `null` in the lobby. |
| `multiplier` | [`CrashMultiplier`](#crashmultiplier) \| `null` | yes | The multiplier paid, or `null` for a refund. |
| `seed_revealed_at_settle` | `false` | yes | const: `false`; Always `false` here. |

### `CrashResultAtReveal`

A CRASH bet's settled view when it settled on the step that revealed its show: the crash, or the 1,000,000.00x finale. It carries `crash_point` and `crash_step` (`settled_step` equals `crash_step`) and `seed_revealed_at_settle` `true`. `ended_by` is `CRASHED` (reason `CRASHED`, `multiplier` `null`: the stake is lost) or `CASHED_OUT` (reason `AUTO`, `CAP` or `MAX_MULTIPLIER`, at its exit, at most `crash_point`, between two ticks if need be).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `chain_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,43}$`; The show's chain. |
| `round_index` | [`CrashChainIndex`](#crashchainindex) | yes | — |
| `ended_by` | `string` | yes | enum: `CRASHED`, `CASHED_OUT`; How the bet ended. |
| `reason` | `string` | yes | enum: `CRASHED`, `AUTO`, `CAP`, `MAX_MULTIPLIER`; Why. |
| `auto_cashout` | [`CrashTarget`](#crashtarget) \| `null` | yes | The bet's `auto_cashout`, or `null`. |
| `cap_multiplier` | [`CrashTarget`](#crashtarget) | yes | — |
| `settled_step` | `integer` | yes | min: `1`; max: `2304`; The step it settled on, `crash_step`. |
| `at_tick` | [`CrashTick`](#crashtick) | yes | — |
| `elapsed_ms` | `integer` | yes | min: `0`; max: `230300`; `100 · at_tick`. |
| `multiplier` | [`CrashTarget`](#crashtarget) \| `null` | yes | The multiplier paid, or `null` for a loss. |
| `crash_point` | [`CrashMultiplier`](#crashmultiplier) | yes | — |
| `crash_step` | `integer` | yes | min: `1`; max: `2304`; The step that revealed the show. |
| `seed_revealed_at_settle` | `true` | yes | const: `true`; Always `true` here. |

### `CrashResult`

A settled CRASH bet's view, the record's `game_result`, with exactly its keys in this order: `chain_id, round_index, ended_by, reason, auto_cashout, cap_multiplier, settled_step, at_tick, elapsed_ms, multiplier`, then `crash_point, crash_step` only when it settled on the step that revealed the show, then `seed_revealed_at_settle`. It is fixed when the bet settles and never changes, so a bet that settled before the reveal never shows the crash point, even in a snapshot taken after it (the `crashed` frame does).

- **Type:** `CrashResultBeforeReveal | CrashResultAtReveal`

- **`oneOf[0]`:** [`CrashResultBeforeReveal`](#crashresultbeforereveal)

- **`oneOf[1]`:** [`CrashResultAtReveal`](#crashresultatreveal)

### `CrashSettlement`

`data` of the `settled` frame for a CRASH bet: a `LiveSettlement` whose `view` is the bet's `CrashResult`. `settled_by` comes from the record's last action's `kind`: `force_close` for the platform's force-close (reason `FORCE_CLOSED`), `abort` for the outage (`outage`, reason `ABORT`), and `play` for `cashout` (`MANUAL`) and `step` (a crash, an exit on its own, the finale). `payout` is `⌊stake · multiplier / 100⌋`, `0` for a loss, the stake for a push; `refund` is the whole stake for a refund in the lobby, where `payout` is the stake too, and `0` otherwise. The record (`GET /v1/rounds/{id}/verify`) has two steps: the placed bet, whose view is `CrashPlacedBet`, and the step that settled it, whose action is `{kind, step}`.

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `bet_id` | `string` | yes | pattern: `^[A-Za-z0-9_-]{1,48}$`; The bet's id, `createLiveBet`'s `bet_id`. |
| `currency` | `string` | yes | pattern: `^[A-Z0-9]{2,12}$`; The bet's currency. |
| `stake` | [`Amount`](#amount-1) | yes | — |
| `payout` | [`Amount`](#amount-1) | yes | — |
| `refund` | [`Amount`](#amount-1) | yes | — |
| `settled_by` | `string` | yes | enum: `play`, `force_close`, `outage`; Which path settled the bet, read from the record's last action. |
| `view` | [`CrashResult`](#crashresult) | yes | — |

### `CrashFrameData`

Union of CRASH's `LiveFrame.data` bodies (the game specification).

- **Type:** `CrashLobby | CrashBetAccepted | CrashTickFrame | CrashCrashed | CrashAborted | CrashProjectedSnapshot | LiveIdleSnapshot | CrashCashoutAck | CrashCashoutError | CrashBetError | CrashSettlement | LiveHubError`

- **`oneOf[0]`:** [`CrashLobby`](#crashlobby)

- **`oneOf[1]`:** [`CrashBetAccepted`](#crashbetaccepted)

- **`oneOf[2]`:** [`CrashTickFrame`](#crashtickframe)

- **`oneOf[3]`:** [`CrashCrashed`](#crashcrashed)

- **`oneOf[4]`:** [`CrashAborted`](#crashaborted)

- **`oneOf[5]`:** [`CrashProjectedSnapshot`](#crashprojectedsnapshot)

- **`oneOf[6]`:** [`LiveIdleSnapshot`](#liveidlesnapshot)

- **`oneOf[7]`:** [`CrashCashoutAck`](#crashcashoutack)

- **`oneOf[8]`:** [`CrashCashoutError`](#crashcashouterror)

- **`oneOf[9]`:** [`CrashBetError`](#crashbeterror)

- **`oneOf[10]`:** [`CrashSettlement`](#crashsettlement)

- **`oneOf[11]`:** [`LiveHubError`](#livehuberror)

### `CrashFrame`

A server-to-client frame on `/v1/live/crash` (`game: "crash"`). `type` is its body's own `type` (`lobby`, `bet`, `tick`, `crashed`, `aborted`, `snapshot`, `ack`, `error`), or `settled` for a settlement, whose body has none; `request_id` is set on `bet`, `ack` and `error`. One command gets exactly one answer: an `ack` when the show applied it, or one `error` when it did not; `live` sends no second, generic `ack` after a CRASH command's own answer. The socket's first frame, `welcome` (`{protocol, game}`), is a plain `LiveFrame` as on every live game, not a `CrashFrame`.

- **Who gets what.** `lobby`, `tick`, `crashed` and `aborted` go to every socket of the show, which is one per environment and shared by every operator: the link and the clock decide them, never a bet. `bet`, `ack`, `error`, `settled` and a `snapshot` go to one player's sockets. No frame is caused by another operator's bet, and none carries a player's identity, an operator's, a count or amount of other players' bets, or a composite player key (platform policy): `live` does not forward the engine's `bet_placed` and `cashed_out` broadcasts, and strips the snapshot's `bets` and `open`. Every `at` a party reads is a step's due time (its frames and the settlements it makes), a command's own arrival at `live` (its `ack` or `error`, and the settlement it makes), or, on `aborted` and the settlements the outage rule makes, the time that rule ended the show, which no bet moves (an outage is a fault, as an overrun is); never a time `live` reached after waiting on other players' work (the cross-operator isolation Time rule). The platform's `force_close` is answered to `live` alone: `live` forwards to no socket the show's answer to a platform command, a refusal included. The envelope's `request_id` is the body's own (`live` copies it) on `bet`, `ack` and the show's `error`, a socket or REST bet id and never the platform's; the only frame whose `request_id` can take the platform's form is the live server's own `LiveHubError` refusing a player's command that used one, which echoes the player's own id.
- **What is revealed when.** The crash point, the crash step and the seed leave the writer only in `crashed`, `aborted`, a snapshot taken after them, and the views of bets settled on that same step. A bet settled before then has a view without them (`CrashResultBeforeReveal`), and nothing before the reveal depends on the crash point beyond the public fact that the rocket survived the last tick.
- **Clocks** are the live server's: a lobby of 5,000 ms, then one step every 100 ms (`tick_ms`) until the crash or the finale, then `hold_ms` (4,000 ms) to the next lobby: a schedule the link and the clock decide, never the bets. A close that overruns `hold_ms` is an alerted fault: the next lobby opens at the schedule's next fixed slot, the same for every operator, with no frame saying why; after `aborted`, too, the next lobby opens at a fixed slot of the schedule. The slots are the due time of the step the show ended on (its crash, the finale, or the step `aborted` names; the lobby's opening when that is 0) plus a whole number of `hold_ms`: the next lobby opens at the first, `hold_ms` after that step, or, when the close or the outage ended past it, at the first slot at or after that end; either way with its whole 5,000 ms lobby.

---

- **Type:** `LiveFrame & object`

- **`allOf[0]`:** [`LiveFrame`](#liveframe)

- **`allOf[1]`**:

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `game` | `"crash"` | yes | const: `"crash"`; Always `crash`. |
| `data` | [`CrashFrameData`](#crashframedata) | yes | — |

### `CrashCommand`

A CRASH player's socket command, in the `LiveCommand` envelope: `snapshot` or `cashout`, and nothing else. The bet is not a socket command (`createLiveBet`), and `force_close` is the platform's: `live` sends it under a `Platform:` request id, one bet at a time, while the show runs on, and a player's command of any kind but these two is refused `invalid_action` (`LiveHubError`) before the show sees it.

- **A command is applied at its own arrival.** `live` stamps a command when it receives it, before any queue it shares with other players, and applies it against the step schedule: every step due at or before the arrival has run, and no step due after the arrival runs before the command is applied. So what a command decides depends on its own arrival time and the show, never on how many other commands `live` holds, with one exception: a command whose plan is still in flight when the tick barrier times out is fenced, and the player gets `pending` for it and for its id from then on (Request ids, below), which the load of every operator can bring about (under tick-barrier contention). The platform's `force_close` is applied the same way, so its price (the game specification's value at the tick its arrival names) does not depend on other players' activity either.
- **`cashout`** (no data): cash the player's open bet out at the tick its arrival names, the last tick whose step was due at or before the command reached `live` (`live` steps the show every 100 ms). One that arrives before the crash step's due time is priced at the last tick the rocket survived, however many commands are queued with it; one that arrives after that due time finds the show over (`wrong_phase`). It is refused at ticks 0 and 1 (`not_cashable`) and outside the flight (`wrong_phase`), and a bet that has settled has nothing to cash out (`no_bet`). There is no REST cash-out: a headless client sends it on this socket, which its session token opens (`createLiveTicket`).
- **A bet whose socket drops** stays in the show and needs no command to end: it exits at its `auto_cashout` or its `cap_multiplier`, whichever the rocket reaches first, else at the crash, and the outage rule settles it if the show stops (`CrashAborted`). An operator's backend can end it at any time with `forceClosePlayer` (`POST /v1/players/{player_ref}/force-close`, for CRASH), which pays the game specification's value: the stake back in the lobby, a push at ticks 0 and 1, a cash-out at the tick's multiplier from tick 2.
- **Request ids.** A socket `request_id` (`CrashSocketRequestId`) never takes the form of the platform's (`Platform:`) or of a REST bet's (`Bet:`, `CrashBetRequestId`), so a cash-out and a bet never answer each other. A repeated socket id gets its first answer again while one writer holds the show (the last 256 ids per player). An applied cash-out is journaled, so its `ack` survives a takeover; a refused one is not, so after a takeover the same id is decided again on the show as it then is: a `cashout` refused `not_cashable` at tick 1 and retried under the same id at tick 2 cashes out. A refusal changed nothing, so that is safe, but a client must not reuse a refused id for a new intent. A command whose plan `live` fenced (the tick barrier, an outage drain, a quarantine: the gaps and takeover floor) was neither applied nor decided, and `live` answers its id `pending` (`LiveHubError`) from then on, before and after a takeover: the client sends a new id. While the player's previous command is still settling, `live` answers `pending` and remembers nothing.

---

- **Type:** `CrashSnapshotCommand | CrashCashoutCommand`

- **`oneOf[0]`:** [`CrashSnapshotCommand`](#crashsnapshotcommand)

- **`oneOf[1]`:** [`CrashCashoutCommand`](#crashcashoutcommand)

### `CrashSnapshotCommand`

Ask for a fresh snapshot (`CrashProjectedSnapshot`, or `LiveIdleSnapshot` between shows).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"snapshot"` | yes | const: `"snapshot"`; Always `snapshot`. |
| `request_id` | [`CrashSocketRequestId`](#crashsocketrequestid) | yes | — |
| `data` | `object` | no | None; `{}` is allowed. |

### `CrashCashoutCommand`

Cash the player's open bet out at the tick its arrival names (`CrashCommand`).

- **Type:** `object`

| Field | Type | Required | Constraints and description |
|---|---|---|---|
| `type` | `"cashout"` | yes | const: `"cashout"`; Always `cashout`. |
| `request_id` | [`CrashSocketRequestId`](#crashsocketrequestid) | yes | — |
| `data` | `object` | no | None; `{}` is allowed, and a field is `invalid_action`. |
