Get the ranks
Read the connected player's place in the community and the top players of this game.
GET /v1/player/ranks · for player session
Use it to show the player's level and place, and a leaderboard of this game's players. Send the player session as the bearer token. The request needs the game loop. For the three conditions (game loop enabled for the game, member consent, server membership) and the error each returns, see What has to be true first.
Query parameters
Prop
Type
Returns
Prop
Type
me contains:
Prop
Type
Each entry of top contains:
Prop
Type
me is there even when the member is not in the top list.
Who is in the top list
Players of this game only: members connected through Connect to this game who have consented to share their rank with it (and whose consent is current), who are in the server, are not banned, do not have a role hidden from the leaderboard, and have XP. They are ordered by XP, highest first. rank in top and me.rank are places in this list. communityRank is the member's place among everyone in the community.
A name is the member's display name, or "A member" where CEEJAY has none. The list never includes a Discord ID, an avatar, a cosmetic or a coin balance, and there is no coin leaderboard.
Example
curl "https://ceejay.communitystudios.xyz/api/v1/player/ranks?top=5" \
-H "Authorization: Bearer $CEEJAY_PLAYER_SESSION"The TypeScript example uses connect.hub.getRanks from the Connect client in the TypeScript SDK. The player must be connected first: the client manages and refreshes the player session. It returns the data of the response below.
{
"success": true,
"data": {
"me": {
"xp": 5420,
"level": 12,
"tier": {
"name": "Veteran",
"color": "#f94801"
},
"rank": 7,
"communityRank": 41,
"progress": {
"current": 120,
"needed": 400,
"percent": 30
}
},
"top": [
{
"rank": 1,
"displayName": "Nova",
"level": 31,
"xp": 98000
}
]
}
}Limits
120 reads a minute for one player session. The three X-RateLimit headers report that count. Every request made with a player session also counts toward 140 a minute. See Rate limits. Over a limit the response is 429 with the code rate_limited, retryAfter and a Retry-After header.
Errors
| Status | code | error | When |
|---|---|---|---|
400 | bad_request | top must be a whole number from 1 to 20 | top is outside 1 to 20, negative, a fraction or text |
401 | connection_ended | This connection has ended | The connection or this device was ended since the player session was made. Discard the stored tokens and show the player as disconnected. See Renew a player session for the reasons |
409 | hub_not_enabled | This game does not show the community's quests, shop and rank | The game loop is disabled for the game. Do not show the community's quests, shop or rank in the game |
409 | sharing_needed | The member has not consented to sharing their data with this game | The member has not consented to share their quests, rewards, shop and rank with the game, or must consent again. The body includes manageUrl: send the player there |
409 | membership_required | The member has to be in the server to use this | The Discord account is not in the server. The body includes membership (pending, left or not_member) and, for left and not_member, joinUrl, the URL to send the player to |
503 | bot_unavailable | This could not be done right now and nothing was changed. Try again in a few seconds | CEEJAY's bot could not be reached or was too busy, and nothing was changed. The body includes retryAfter, in seconds: retry after that many seconds |
504 | bot_timeout | The answer did not arrive in time, and the request may or may not have been done. Send the same request again: it is safe to repeat | The request timed out, so it is not known whether it was processed. Retry the same request: it is safe to repeat |
Every error body also includes requestId, and a 400 with the code bad_request identifies the invalid field in field. Match on code; message text can change.
The errors every request of a game shares (the key, the state of the game, the origin, 405, 429, 500) are on the Errors page, and the errors specific to the game loop are under Codes of the game loop.

