Skip to content

getGameHighScores

Get a game's high score data. Returns the target user plus several entries from their neighboring ranks.

Request

POST /:token/getGameHighScores

Parameters

ParameterTypeRequiredDescription
user_idIntegerYesUnique identifier of the target user
chat_idIntegerNoRequired when inline_message_id is not specified: the chat that contains the game card
message_idIntegerNoRequired when inline_message_id is not specified: the message ID of the game card
inline_message_idStringNoRequired when chat_id and message_id are not specified: the inline message identifier

Provide either chat_id + message_id or inline_message_id.

Response

Returns an array of GameHighScore objects. The result includes the target user and several neighbors on each side; if the target user and their neighbors are not at the top, several top-ranked users are also included.

json
{
  "ok": true,
  "result": [
    { "position": 1, "user": { "id": 111, "first_name": "Alice" }, "score": 980 },
    { "position": 2, "user": { "id": 222, "first_name": "Bob" }, "score": 760 },
    { "position": 3, "user": { "id": 333, "first_name": "Carol" }, "score": 540 }
  ]
}

Error Codes

CodeDescription
400Bad request parameters, e.g. missing carrier parameters or the game does not exist
401Invalid or expired token
403Bot does not have permission to view this game's high scores
404User, chat, or message does not exist
500Internal server error

Examples

cURL

bash
curl -X POST "https://api.safew.bot/<token>/getGameHighScores" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": 111222333,
    "chat_id": 987654321,
    "message_id": 100
  }'