Amba

Leaderboards

Leaderboard definitions (metric, period, max entries) + admin-side ranked entries.

Leaderboards are named rankings of users by a metric (xp, streak, custom, high_score). A high_score board ranks scores your server submits through POST …/scores; see Score leaderboards. Entries are written automatically by the engagement pipeline; ranking and tiebreaker logic is shared with the segment-rule and gamification engines.

Endpoints

MethodPathDescription
POST/admin/projects/:projectId/leaderboardsCreate a leaderboard.
GET/admin/projects/:projectId/leaderboardsList leaderboards.
GET/admin/projects/:projectId/leaderboards/:leaderboardIdFetch.
PATCH/admin/projects/:projectId/leaderboards/:leaderboardIdPartial update.
DELETE/admin/projects/:projectId/leaderboards/:leaderboardIdDelete.
GET/admin/projects/:projectId/leaderboards/:leaderboardId/entriesPaginated ranked entries with user display info.
POST/admin/projects/:projectId/leaderboards/:leaderboardId/scoresSubmit a score to a high_score board.

POST /admin/projects/:projectId/leaderboards

Request

FieldTypeRequiredDefault
namestringyes—
metricstringyes—
periodstringno"all_time"
max_entriesnumberno100
custom_eventstringnonull
sortstringno"desc"
keyedboolnofalse

metric is one of xp, streak, custom, high_score. period is one of all_time, daily, weekly, monthly (UTC windows; weeks open on Sunday). sort (desc ranks the highest score first, asc the lowest) and keyed (rank per key) apply to high_score boards only.

Errors

  • 400 VALIDATION_ERROR: a missing name or metric, or an unknown value.
  • 409 LEADERBOARD_EXISTS: the name is taken.

Response 201

{ "data": { "id": "…", "name": "…", "metric": "xp", "period": "all_time", "max_entries": 100 } }

Try it:

POST/admin/projects/%7B%7BprojectId%7D%7D/leaderboards
developer auth
curl -X POST 'https://api.amba.dev/v1/admin/projects/%7B%7BprojectId%7D%7D/leaderboards' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Weekly XP",
  "metric": "xp"
}'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X POST "${BASE_URL}/admin/projects/${PROJECT_ID}/leaderboards" \
  -H "Authorization: Bearer ${DEV_TOKEN}" \
  -H 'Content-Type: application/json' \
  -d '{"name":"Weekly XP","metric":"xp"}'

GET /admin/projects/:projectId/leaderboards

{ "data": [{ "id": "…", "name": "…", "metric": "xp" }] }

Try it:

GET/admin/projects/%7B%7BprojectId%7D%7D/leaderboards
developer auth
curl -X GET 'https://api.amba.dev/v1/admin/projects/%7B%7BprojectId%7D%7D/leaderboards'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET "${BASE_URL}/admin/projects/${PROJECT_ID}/leaderboards" \
  -H "Authorization: Bearer ${DEV_TOKEN}"

GET /admin/projects/:projectId/leaderboards/:leaderboardId

Errors

  • 404 NOT_FOUND.

Try it:

GET/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7D
developer auth
curl -X GET 'https://api.amba.dev/v1/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7D'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET "${BASE_URL}/admin/projects/${PROJECT_ID}/leaderboards/{leaderboardId}" \
  -H "Authorization: Bearer ${DEV_TOKEN}"

PATCH /admin/projects/:projectId/leaderboards/:leaderboardId

Allowed fields: name, metric, period, max_entries, custom_event, is_active, sort, keyed.

Once a high_score board holds scores, its metric, period, sort and keyed are fixed, because stored bests were recorded under them. Changing one answers 409 SCORE_SETTINGS_LOCKED; create a new leaderboard instead.

Try it:

PATCH/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7D
developer auth
curl -X PATCH 'https://api.amba.dev/v1/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7D'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X PATCH "${BASE_URL}/admin/projects/${PROJECT_ID}/leaderboards/{leaderboardId}" \
  -H "Authorization: Bearer ${DEV_TOKEN}" \
  -H 'Content-Type: application/json' \
  -d '{}'

DELETE /admin/projects/:projectId/leaderboards/:leaderboardId

{ "data": { "deleted": true } }

Try it:

DELETE/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7D
developer auth
curl -X DELETE 'https://api.amba.dev/v1/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7D'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X DELETE "${BASE_URL}/admin/projects/${PROJECT_ID}/leaderboards/{leaderboardId}" \
  -H "Authorization: Bearer ${DEV_TOKEN}"

GET /admin/projects/:projectId/leaderboards/:leaderboardId/entries

Paginated entries ordered by rank ascending (entries without a rank sort last). Each row carries the user's display_name and avatar_url.

Query

ParamDefault
limit50
offset0
key—
period_startcurrent window

:leaderboardId accepts the id or the name. key and period_start apply to high_score boards: key picks the board on a keyed definition, and period_start (YYYY-MM-DD, any UTC date inside the window) picks a past window. A score board returns { rank, app_user_id, display_name, avatar_url, score, achieved_at } rows plus key, period and period_start (null on all-time boards).

Response 200

{
  "data": [
    {
      "leaderboard_id": "…",
      "app_user_id": "…",
      "rank": 1,
      "score": 1234,
      "app_users": { "display_name": "…", "avatar_url": "…" }
    }
  ],
  "total": 100,
  "offset": 0,
  "limit": 50
}

Try it:

GET/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7D/entries
developer auth
curl -X GET 'https://api.amba.dev/v1/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7D/entries'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET "${BASE_URL}/admin/projects/${PROJECT_ID}/leaderboards/{leaderboardId}/entries" \
  -H "Authorization: Bearer ${DEV_TOKEN}"

POST /admin/projects/:projectId/leaderboards/:leaderboardId/scores

Submit a player's score to a high_score board. Call it from trusted server code with a server key or developer token. The board keeps the player's best score for the current UTC window (per key on a keyed board). The write is atomic: when two submits for the same player race, the better score wins. :leaderboardId accepts the id or the name.

Request

FieldTypeRequired
app_user_idstringyes
scorenumberyes
keystringon keyed boards only
idempotency_keystringno

Response 200

{
  "data": {
    "leaderboard_id": "…",
    "leaderboard": "arcade-daily",
    "key": "pacman",
    "period": "daily",
    "period_start": "2026-11-06",
    "app_user_id": "…",
    "score": 48210,
    "best_score": 48210,
    "achieved_at": "2026-11-06T18:04:11.532Z",
    "new_personal_best": true,
    "rank": 3,
    "replayed": false
  }
}

rank counts from 1. A tie goes to whoever reached the score first. A repeat with the same idempotency_key returns the first submit's new_personal_best with replayed: true.

Errors

  • 400 VALIDATION_ERROR: bad app_user_id or score, a missing key on a keyed board, or a key on an unkeyed board.
  • 400 NOT_A_SCORE_LEADERBOARD: the board ranks another metric.
  • 404 NOT_FOUND / 404 USER_NOT_FOUND.
  • 409 IDEMPOTENCY_KEY_REUSED: the key was used for a different user, board key or score.
  • 409 LEADERBOARD_INACTIVE.

Curl:

curl -X POST "${BASE_URL}/admin/projects/${PROJECT_ID}/leaderboards/arcade-daily/scores" \
  -H "Authorization: Bearer ${AMBA_SERVER_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{"app_user_id":"…","score":48210,"key":"pacman","idempotency_key":"run_9f2e"}'