Console
Leaderboards

Ranking

Returns ranked entries for a leaderboard. Supports global and friends-only scopes with pagination. Always includes the authenticated user's position, even if they fall outside the top N.

POST /api/leaderboards/ranking.php
Authorization: AppID:AppKey or user session token

Identify the leaderboard (one of)

FieldTypeDescription
leaderboard_idintNumeric leaderboard ID
slug + app_idstringSlug and app package name together

Options

FieldTypeDescription
scopestringglobal (default) or friends
limitintEntries to return (1–100). Default: 50
offsetintSkip first N entries for pagination (global scope only)

Friends scope — identify user (when auth is AppID:AppKey — one of)

FieldTypeDescription
user_idintNumeric user ID
userkeystringUser's userKey
tokenstringUser's session token

When authenticated with a user token in the header, scope=friends and my_position work without extra body fields.

Success response 200

{
  "success": true,
  "leaderboard": {
    "id": 1,
    "slug": "goals",
    "name": "Top Scorers",
    "points_name": "Goals",
    "sort_order": "desc"
  },
  "scope": "global",
  "count": 3,
  "entries": [
    {
      "rank": 1,
      "id": 10,
      "username": "champion",
      "name": "Champion",
      "profileimg": "https://...",
      "idverify": 1,
      "score": 87,
      "updated_at": "2026-05-29 16:00:00"
    },
    {
      "rank": 2,
      "id": 42,
      "username": "vanelton",
      "score": 47,
      "updated_at": "2026-05-29 15:00:00"
    }
  ],
  "my_position": {
    "rank": 2,
    "score": 47,
    "updated_at": "2026-05-29 15:00:00",
    "leaderboard_id": 1
  }
}

my_position is always the user's global rank regardless of the requested scope, so you can show "Your global rank: #2" even when displaying a friends-only board. It is null when authenticated with AppID:AppKey without a user identifier.

Pagination

// Page 1
{ "slug": "goals", "app_id": "com.myapp.game", "limit": 20, "offset": 0 }   // ranks 1–20
// Page 2
{ "slug": "goals", "app_id": "com.myapp.game", "limit": 20, "offset": 20 }  // ranks 21–40