XP
Manage XP rules and inspect per-user XP balances.
XP rules map engagement events to XP awards; they're evaluated by the engagement-event pipeline on every POST /client/events write. This module also exposes read endpoints over user_xp.
Source: apps/api/src/routes/admin/xp.ts.
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /admin/projects/:projectId/xp | Create an XP rule. |
| GET | /admin/projects/:projectId/xp | List XP rules. |
| PATCH | /admin/projects/:projectId/xp/:ruleId | Partial update. |
| DELETE | /admin/projects/:projectId/xp/:ruleId | Delete a rule. |
| GET | /admin/projects/:projectId/xp/users/:userId | Fetch a single user's XP. |
| GET | /admin/projects/:projectId/xp/users | Paginated leaderboard-style list of users by total XP. |
POST /admin/projects/:projectId/xp
Request
| Field | Type | Required | Default |
|---|---|---|---|
name | string | yes | — |
event_name | string | yes | — |
xp_amount | number | yes | — |
max_per_day | number | null | no | null |
cooldown_seconds | number | no | 0 |
Response 201
Try it:
POST
developer auth/admin/projects/%7B%7BprojectId%7D%7D/xpcurl -X POST 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/xp'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
GET /admin/projects/:projectId/xp
Try it:
GET
developer auth/admin/projects/%7B%7BprojectId%7D%7D/xpcurl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/xp'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
PATCH /admin/projects/:projectId/xp/:ruleId
Allowed fields: name, event_name, xp_amount, max_per_day, cooldown_seconds, is_active.
Errors
404 NOT_FOUND.500 UPDATE_FAILED.
Try it:
PATCH
developer auth/admin/projects/%7B%7BprojectId%7D%7D/xp/%7B%7BruleId%7D%7Dcurl -X PATCH 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/xp/%7B%7BruleId%7D%7D'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
DELETE /admin/projects/:projectId/xp/:ruleId
Try it:
DELETE
developer auth/admin/projects/%7B%7BprojectId%7D%7D/xp/%7B%7BruleId%7D%7Dcurl -X DELETE 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/xp/%7B%7BruleId%7D%7D'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
GET /admin/projects/:projectId/xp/users/:userId
Response 200
Errors
404 NOT_FOUND— user has nouser_xprow yet.
Try it:
GET
developer auth/admin/projects/%7B%7BprojectId%7D%7D/xp/users/%7B%7BuserId%7D%7Dcurl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/xp/users/%7B%7BuserId%7D%7D'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl:
GET /admin/projects/:projectId/xp/users
Paginated list ordered by total_xp DESC.
Query
| Param | Default |
|---|---|
limit | 50 |
offset | 0 |
Response 200
Try it:
GET
developer auth/admin/projects/%7B%7BprojectId%7D%7D/xp/userscurl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/xp/users'Loading auth… Configure auth in the settings drawer (top-right) to run this request.
Curl: