Amba

Streaks

Read the current user's streak state and record a manual qualifying event.

POST /client/events automatically qualifies streaks whose qualifying_event matches. Use POST /client/streaks/:streakId/qualify for manual qualification (e.g. UI actions not mapped to an event).

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

Endpoints

MethodPathDescription
GET/client/streaksAll of the current user's streaks, with definition metadata.
POST/client/streaks/:streakId/qualifyRecord a qualifying event against a streak definition.

GET /client/streaks

Response 200

{
  "data": [
    {
      "id": "…",
      "app_user_id": "…",
      "streak_definition_id": "…",
      "current_count": 7,
      "longest_count": 42,
      "last_qualified_at": "…",
      "current_period_start": "…",
      "freezes_remaining": 1,
      "status": "active",
      "streak_definitions": {
        "name": "Daily check-in",
        "qualifying_event": "check_in",
        "period": "daily"
      }
    }
  ]
}

Errors

  • 500 FETCH_FAILED.

Try it:

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

Curl:

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

POST /client/streaks/:streakId/qualify

Response 200 (existing row updated) / 201 (first-time qualifier)

{
  "data": {
    "id": "…",
    "current_count": 8,
    "longest_count": 42,
    "last_qualified_at": "…",
    "status": "active"
  }
}

Errors

  • 500 UPDATE_FAILED.

Try it:

POST/client/streaks/%7B%7BstreakId%7D%7D/qualify
client auth
curl -X POST 'https://api.amba.dev/client/streaks/%7B%7BstreakId%7D%7D/qualify'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X POST '${BASE_URL}/client/streaks/{streakId}/qualify' \
  -H 'X-Api-Key: ${CLIENT_API_KEY}' \
  -H 'Authorization: Bearer ${SESSION_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{}'

On this page