Leaderboards
Leaderboard definitions (metric, period, max entries) + admin-side ranked entries.
Leaderboards are named rankings of app_users by a metric (xp, streak_length, custom). leaderboard_entries rows are written by the engagement pipeline; the ranking / tiebreaker logic lives in the shared segment-rule + gamification helpers.
Source: apps/api/src/routes/admin/leaderboards.ts.
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /admin/projects/:projectId/leaderboards | Create a leaderboard. |
| GET | /admin/projects/:projectId/leaderboards | List leaderboards. |
| GET | /admin/projects/:projectId/leaderboards/:leaderboardId | Fetch. |
| PATCH | /admin/projects/:projectId/leaderboards/:leaderboardId | Partial update. |
| DELETE | /admin/projects/:projectId/leaderboards/:leaderboardId | Delete. |
| GET | /admin/projects/:projectId/leaderboards/:leaderboardId/entries | Paginated ranked entries with user display info. |
POST /admin/projects/:projectId/leaderboards
Request
| Field | Type | Required | Default |
|---|---|---|---|
name | string | yes | — |
metric | string | yes | — |
period | string | no | "all_time" |
max_entries | number | no | 100 |
custom_event | string | no | null |
Response 201
Try it:
POST
developer auth/admin/projects/%7B%7BprojectId%7D%7D/leaderboardscurl -X POST 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/leaderboards'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
GET /admin/projects/:projectId/leaderboards
Try it:
GET
developer auth/admin/projects/%7B%7BprojectId%7D%7D/leaderboardscurl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/leaderboards'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
GET /admin/projects/:projectId/leaderboards/:leaderboardId
Errors
404 NOT_FOUND.
Try it:
GET
developer auth/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7Dcurl -X GET 'https://api.amba.dev/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:
PATCH /admin/projects/:projectId/leaderboards/:leaderboardId
Allowed fields: name, metric, period, max_entries, custom_event, is_active.
Try it:
PATCH
developer auth/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7Dcurl -X PATCH 'https://api.amba.dev/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:
DELETE /admin/projects/:projectId/leaderboards/:leaderboardId
Try it:
DELETE
developer auth/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7Dcurl -X DELETE 'https://api.amba.dev/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:
GET /admin/projects/:projectId/leaderboards/:leaderboardId/entries
Paginated entries ordered by rank ASC NULLS LAST, joined to app_users for display name + avatar.
Query
| Param | Default |
|---|---|
limit | 50 |
offset | 0 |
Response 200
Try it:
GET
developer auth/admin/projects/%7B%7BprojectId%7D%7D/leaderboards/%7B%7BleaderboardId%7D%7D/entriescurl -X GET 'https://api.amba.dev/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: