# [Game] FairPlay API ## Docs - Getting Started [Introduction](https://dev-gdoc.ambfairgame.com/introduction-2460510m0.md): - Getting Started [Session and Token](https://dev-gdoc.ambfairgame.com/session-and-token-2460511m0.md): - Getting Started [Request and Response](https://dev-gdoc.ambfairgame.com/request-and-response-2460512m0.md): - Getting Started [Real-time Events (SSE)](https://dev-gdoc.ambfairgame.com/real-time-events-sse-2460513m0.md): - Getting Started [Lotto Rules — หวยเฮงเฮง](https://dev-gdoc.ambfairgame.com/lotto-rules-%E0%B8%AB%E0%B8%A7%E0%B8%A2%E0%B9%80%E0%B8%AE%E0%B8%87%E0%B9%80%E0%B8%AE%E0%B8%87-2460514m0.md): - Getting Started [Provably Fair](https://dev-gdoc.ambfairgame.com/provably-fair-2460515m0.md): - Game > Lotto (หวยเฮงเฮง) [Lotto Rules](https://dev-gdoc.ambfairgame.com/lotto-rules-2460542m0.md): - Appendix [Game List](https://dev-gdoc.ambfairgame.com/game-list-2460516m0.md): - Appendix [Error Codes](https://dev-gdoc.ambfairgame.com/error-codes-2460517m0.md): - Appendix [Rate Limits](https://dev-gdoc.ambfairgame.com/rate-limits-2460518m0.md): ## API Docs - Player > Demo [Demo Login](https://dev-gdoc.ambfairgame.com/demo-login-44546895e0.md): Creates or resumes a demo (play-money) player session and returns its token. FE calls it when a game is opened in demo mode, before any authenticated call. - Player [Player Bet History](https://dev-gdoc.ambfairgame.com/player-bet-history-44546894e0.md): Returns the player's own bet records in the session currency, newest first, with offset pagination. FE calls it for the bet history screen. - Common > Game > By Game Code > Provably Fair [Set Client Seed](https://dev-gdoc.ambfairgame.com/set-client-seed-44546899e0.md): Sets the player's client seed for the game and resets the nonce to 0. FE calls it when the player changes the client seed in the provably-fair panel. - Common > Game > By Game Code > Provably Fair [Verify Result](https://dev-gdoc.ambfairgame.com/verify-result-44546900e0.md): Recomputes a result from a revealed server seed so the player can compare it with the recorded result and the earlier commitment. FE calls it from the provably-fair verify screen. - Common > Game > By Game Code > Provably Fair [Get Revealed Server Seed](https://dev-gdoc.ambfairgame.com/get-revealed-server-seed-44546901e0.md): Returns the plaintext of an already revealed server seed by its hash. FE calls it to fetch the seed needed for POST /provably-fair/verify-result. - Common > Game > By Game Code [Check Session](https://dev-gdoc.ambfairgame.com/check-session-44546896e0.md): Validates the session token for a game and returns the player's identity, current balance and currency. FE calls it once when the game loads. - Common > Game > By Game Code [Get Balance](https://dev-gdoc.ambfairgame.com/get-balance-44546897e0.md): Returns a fresh balance for the player in the given game. FE calls it to refresh the balance, e.g. after a bet or a settlement. - Common > Game > By Game Code [Get Provably-Fair State](https://dev-gdoc.ambfairgame.com/get-provably-fair-state-44546898e0.md): Returns the server seed hash, client seed and nonce that the player's next bet will use. FE calls it to show the provably-fair panel before the player bets. - Common > Game [Lobby Game List](https://dev-gdoc.ambfairgame.com/lobby-game-list-44547902e0.md): Returns the active games for the player's currency, with labels in the player's language. FE calls it to render the game lobby. - Wallet [Wallet Status](https://dev-gdoc.ambfairgame.com/wallet-status-44546902e0.md): Returns the player's local wallet balance for operators that use the transfer wallet. FE polls it while an operator deposit or withdrawal is in progress. - Game > Lotto (หวยเฮงเฮง) > Rooms > By Room [Join Round](https://dev-gdoc.ambfairgame.com/join-round-44546906e0.md): Returns the room's open round for the caller's currency (id, status, betting close time, seed commitment) and the caller's own pending bets. Call it when entering a room, right after the event stream opens or reconnects, and whenever the client needs to resync. - Game > Lotto (หวยเฮงเฮง) > Rooms > By Room [Place Multi-player Bet](https://dev-gdoc.ambfairgame.com/place-multi-player-bet-44546907e0.md): Places one or more bets in a Lotto room's open round with a single debit of the summed stake. The หวยเฮงเฮง client uses POST /gapi/v1/g/lotto/tickets/create instead. - Game > Lotto (หวยเฮงเฮง) > Rooms > By Room [Get Round Result](https://dev-gdoc.ambfairgame.com/get-round-result-44546908e0.md): Returns a round's status and, once settled, the revealed seed, the game result and the caller's own per-bet results and totals. Call it for a round the player bet in, after it closes. - Game > Lotto (หวยเฮงเฮง) > Rooms > By Room [Room Event Stream](https://dev-gdoc.ambfairgame.com/room-event-stream-44546909e0.md): Opens a Server-Sent Events stream of real-time room events (new round, bets, client-seed slots, settlement) for one room + currency. Open it with EventSource when the player enters a room. - Game > Lotto (หวยเฮงเฮง) > Tickets [Create Ticket](https://dev-gdoc.ambfairgame.com/create-ticket-44546910e0.md): Confirms the whole basket as one ticket with one debit, and returns the ticket id, the new balance and each line's settle rate and potential win. Idempotent per `requestId`. - Game > Lotto (หวยเฮงเฮง) > Tickets [Inquiry My Tickets](https://dev-gdoc.ambfairgame.com/inquiry-my-tickets-44546911e0.md): Lists the caller's tickets, newest first, filtered by the WAITING / SETTLED tab and an optional won / lost filter. Used by the bet history screen. - Game > Lotto (หวยเฮงเฮง) > Tickets [Get Ticket](https://dev-gdoc.ambfairgame.com/get-ticket-44546912e0.md): Returns one of the caller's tickets with its lines, each line's rate and result, the drawn number and the ticket totals. - Game > Lotto (หวยเฮงเฮง) > Round [Get My Bets](https://dev-gdoc.ambfairgame.com/get-my-bets-44546913e0.md): Returns every bet line the caller placed in a round, with the round status and lucky number, for the result-waiting screen. - Game > Lotto (หวยเฮงเฮง) > Round [Get My Result](https://dev-gdoc.ambfairgame.com/get-my-result-44546914e0.md): Returns the drawn number, the caller's settled lines and totals, and the next open round, for the won / lost screen. - Game > Lotto (หวยเฮงเฮง) > Round [Get Round Provably Fair](https://dev-gdoc.ambfairgame.com/get-round-provably-fair-44546915e0.md): Returns a round's provably-fair data: the seed commitment and, after settlement, the revealed seed, the client-seed input and the drawn number, so the player can verify the draw. - Game > Lotto (หวยเฮงเฮง) > Results [Inquiry Results](https://dev-gdoc.ambfairgame.com/inquiry-results-44546916e0.md): Lists a room's settled draws for the session currency, newest first, with the lucky number that applied to each round. Used by the result history screen. - Game > Lotto (หวยเฮงเฮง) [Get Rooms](https://dev-gdoc.ambfairgame.com/get-rooms-44546903e0.md): Lists the active LOTTO rooms serving the player's session currency, each with its open round, last result and lucky number. Used by the หวยเฮงเฮง room list screen. - Game > Lotto (หวยเฮงเฮง) [Get Current Round](https://dev-gdoc.ambfairgame.com/get-current-round-44546904e0.md): Returns the header of the number-entry screen for a room: the open round with its close time and seed commitment, the lucky number and the last two results. Call it after the player picks a room and again when a round closes. - Game > Lotto (หวยเฮงเฮง) [Get Pay Table](https://dev-gdoc.ambfairgame.com/get-pay-table-44546905e0.md): Returns the bet-type buttons with their live rates, the room's bet limits for the session currency and the lucky-number settings. Call it when opening the number-entry screen for a room. - [Language List](https://dev-gdoc.ambfairgame.com/language-list-44546892e0.md): Returns the active UI languages and the language resolved from the Accept-Language header. FE calls it to build the language picker. - [Ping](https://dev-gdoc.ambfairgame.com/ping-44546893e0.md): Liveness check for the Game API. Returns a small JSON object without the standard envelope. ## Schemas - [DemoLoginRequest](https://dev-gdoc.ambfairgame.com/demologinrequest-12783900d0.md): - [DemoLoginResponse](https://dev-gdoc.ambfairgame.com/demologinresponse-12783901d0.md): - [DemoProfileResponse](https://dev-gdoc.ambfairgame.com/demoprofileresponse-12783902d0.md): - [ProfileResponse](https://dev-gdoc.ambfairgame.com/profileresponse-16180649d0.md): - [GetHistoryResponse](https://dev-gdoc.ambfairgame.com/gethistoryresponse-12783903d0.md): - [BetRecord](https://dev-gdoc.ambfairgame.com/betrecord-12783904d0.md): - [GameInfo](https://dev-gdoc.ambfairgame.com/gameinfo-12783905d0.md): - [Room](https://dev-gdoc.ambfairgame.com/room-12783906d0.md): - [GetGameResponse](https://dev-gdoc.ambfairgame.com/getgameresponse-12783907d0.md): - [BetRequest](https://dev-gdoc.ambfairgame.com/betrequest-12783908d0.md): - [Bet](https://dev-gdoc.ambfairgame.com/bet-12783909d0.md): - [BetResponse](https://dev-gdoc.ambfairgame.com/betresponse-12783910d0.md): - [BetResult](https://dev-gdoc.ambfairgame.com/betresult-12783911d0.md): - [GetProvablyFairResponse](https://dev-gdoc.ambfairgame.com/getprovablyfairresponse-12783912d0.md): - [SetClientSeedRequest](https://dev-gdoc.ambfairgame.com/setclientseedrequest-12783913d0.md): - [SetClientSeedResponse](https://dev-gdoc.ambfairgame.com/setclientseedresponse-12783914d0.md): - [RotateServerSeedResponse](https://dev-gdoc.ambfairgame.com/rotateserverseedresponse-12783915d0.md): - [VerifyResultRequest](https://dev-gdoc.ambfairgame.com/verifyresultrequest-12783850d0.md): - [VerifyResultResponse](https://dev-gdoc.ambfairgame.com/verifyresultresponse-12783851d0.md): - [GetServerSeedResponse](https://dev-gdoc.ambfairgame.com/getserverseedresponse-12827526d0.md): - [GetStatusResponse](https://dev-gdoc.ambfairgame.com/getstatusresponse-16180650d0.md): - [JoinRoundResponse](https://dev-gdoc.ambfairgame.com/joinroundresponse-16180651d0.md): - [PlaceMultiPlayerBetRequest](https://dev-gdoc.ambfairgame.com/placemultiplayerbetrequest-16180652d0.md): - [PlaceBetResponse](https://dev-gdoc.ambfairgame.com/placebetresponse-16180653d0.md): - [RoundResultResponse](https://dev-gdoc.ambfairgame.com/roundresultresponse-16180654d0.md): - [SuccessResponse](https://dev-gdoc.ambfairgame.com/successresponse-12783852d0.md): - [ErrorResponse](https://dev-gdoc.ambfairgame.com/errorresponse-12783853d0.md):