Skip to main content
GET
/
game
/
{id}
Get Game
curl --request GET \
  --url https://api.example.com/game/{id}
{
  "200": {},
  "404": {},
  "gameId": "<string>",
  "playerId": "<string>",
  "status": "<string>",
  "playerScore": 123,
  "dealerScore": 123,
  "playerCards": [
    {
      "rank": "<string>",
      "suit": "<string>",
      "hidden": true
    }
  ],
  "dealerCards": [
    {
      "rank": "<string>",
      "suit": "<string>",
      "hidden": true
    }
  ]
}

Request

Returns the current state of a Blackjack game, including player and dealer cards, scores, and game status. Note that dealer cards may be partially hidden while the game is in progress.

Path Parameters

id
string
required
The unique identifier of the game to retrieve

cURL Example

curl http://localhost:8080/game/550e8400-e29b-41d4-a716-446655440000

Response

Returns the complete game state including cards and scores.
gameId
string
Unique identifier for the game
playerId
string
Unique identifier for the player
status
string
Current status of the game. Possible values:
  • IN_PROGRESS - Game is active
  • PLAYER_WIN - Player won
  • DEALER_WIN - Dealer won
  • TIE - Game ended in a tie
playerScore
integer
Current score of the player’s hand
dealerScore
integer
Current score of the dealer’s hand (may be partial if cards are hidden)
playerCards
array
Array of card objects representing the player’s hand
dealerCards
array
Array of card objects representing the dealer’s hand. Some cards may be hidden during active gameplay.

Response Example (Game in Progress)

{
  "gameId": "550e8400-e29b-41d4-a716-446655440000",
  "playerId": "660e8400-e29b-41d4-a716-446655440001",
  "status": "IN_PROGRESS",
  "playerScore": 19,
  "dealerScore": 10,
  "playerCards": [
    {
      "rank": "KING",
      "suit": "HEARTS",
      "hidden": false
    },
    {
      "rank": "NINE",
      "suit": "DIAMONDS",
      "hidden": false
    }
  ],
  "dealerCards": [
    {
      "rank": "TEN",
      "suit": "CLUBS",
      "hidden": false
    },
    {
      "rank": null,
      "suit": null,
      "hidden": true
    }
  ]
}

Response Example (Game Completed)

{
  "gameId": "550e8400-e29b-41d4-a716-446655440000",
  "playerId": "660e8400-e29b-41d4-a716-446655440001",
  "status": "PLAYER_WIN",
  "playerScore": 20,
  "dealerScore": 19,
  "playerCards": [
    {
      "rank": "KING",
      "suit": "HEARTS",
      "hidden": false
    },
    {
      "rank": "QUEEN",
      "suit": "DIAMONDS",
      "hidden": false
    }
  ],
  "dealerCards": [
    {
      "rank": "TEN",
      "suit": "CLUBS",
      "hidden": false
    },
    {
      "rank": "NINE",
      "suit": "SPADES",
      "hidden": false
    }
  ]
}

Status Codes

200
OK
Game state successfully retrieved
404
Not Found
Game with the specified ID does not exist

Notes

  • Dealer cards remain partially hidden (one face-down card) while the game is IN_PROGRESS
  • Once the game ends, all dealer cards are revealed
  • The dealer’s score reflects only visible cards during active gameplay

Build docs developers (and LLMs) love