Skip to content

High Scores

A call to this endpoint will retrieve metadata about either the latest masters for a game, or the highest points earners for a game. The game is targeted via its unique ID.

On-site Representation

When browsing a game page, for example, Sonic the Hedgehog, a table representing the high scores can be seen on the page's sidebar:

High Scores

HTTP Request

GET

https://retroachievements.org/API/API_GetGameRankAndScore.php?g=14402

Query Parameters

NameRequired?Description
yYesYour web API key.
gYesThe target game ID.
t1 for latest masters. 0 for non-master high scores. Defaults to 0.

Client Library

ts
import {
  buildAuthorization,
  getGameRankAndScore,
} from "@retroachievements/api";

// First, build your authorization object.
const username = "<your username on RA>";
const webApiKey = "<your web API key>";

const authorization = buildAuthorization({ username, webApiKey });

// Then, make the API call.
const gameRankAndScore = await getGameRankAndScore(authorization, {
  gameId: 14402,
  type: "latest-masters",
});
kotlin
val credentials = RetroCredentials("<username>", "<web api key>")
val api: RetroInterface = RetroClient(credentials).api

val response: NetworkResponse<GetGameRankAndScore.Response, ErrorResponse> = api.getGameRankAndScore(
    gameId = 14402
)

if (response is NetworkResponse.Success) {
    // handle the data
    val rankAndScore: GetGameRankAndScore.Response = response.body

} else if (response is NetworkResponse.Error) {
    // if the server returns an error it be found here
    val errorResponse: ErrorResponse? = response.body

    // if the api (locally) had an internal error, it'll be found here
    val internalError: Throwable? = response.error
}

Response

How entities are ordered in this response should be noted. For latest-masters, the first entry will be the most recent mastery for the set. For high-scores it will be the first person to master the set.

json
[
  {
    "User": "Arekdias",
    "NumAchievements": 15,
    "TotalScore": 219,
    "LastAward": "2023-06-07 14:43:18"
  }
  // ...
]
json
[
  {
    "user": "BruceLee1255",
    "totalScore": 0,
    "lastAward": "2019-07-30 23:19:43",
    "rank": 27
  }
  // ...
]

Source

RepoURL
RAWebhttps://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetGameRankAndScore.php
api-jshttps://github.com/RetroAchievements/api-js/blob/main/src/game/getGameRankAndScore.ts
api-kotlinhttps://github.com/RetroAchievements/api-kotlin/blob/main/src/main/kotlin/org/retroachivements/api/RetroInterface.kt

Released under the MIT license.