Amba

XP

Current user's XP, per-event ledger history, and active XP rules.

XP is awarded automatically by POST /client/events based on matching xp_rules. These endpoints are read-only.

Source: apps/api/src/routes/client/xp.ts.

Endpoints

MethodPathDescription
GET/client/xpCurrent user's XP + level.
GET/client/xp/historyPaginated XP ledger.
GET/client/xp/rulesActive rules (public view — no internal fields).

GET /client/xp

Returns defaults (total_xp: 0, level: 1) if no row exists yet.

Response 200

{
  "data": {
    "app_user_id": "…",
    "total_xp": 1234,
    "level": 12,
    "xp_this_period": 150,
    "last_xp_at": "…"
  }
}

Errors

  • 500 FETCH_FAILED.

Try it:

GET/client/xp
client auth
curl -X GET 'https://api.amba.dev/client/xp'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET '${BASE_URL}/client/xp' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}'

GET /client/xp/history

Query

ParamDefault
limit50
offset0

Response 200

{
  "data": [
    {
      "id": "…",
      "app_user_id": "…",
      "event_name": "workout_completed",
      "xp_amount": 10,
      "occurred_at": "…"
    }
  ],
  "total": 123,
  "offset": 0,
  "limit": 50
}

Try it:

GET/client/xp/history
client auth
curl -X GET 'https://api.amba.dev/client/xp/history'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET '${BASE_URL}/client/xp/history' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}'

GET /client/xp/rules

Active XP rules (public columns only).

Response 200

{
  "data": [{ "id": "…", "name": "Workout XP", "event_name": "workout_completed", "xp_amount": 10 }]
}

Try it:

GET/client/xp/rules
client auth
curl -X GET 'https://api.amba.dev/client/xp/rules'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET '${BASE_URL}/client/xp/rules' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}'

On this page