Amba

Challenges

Time-boxed challenges — goal type, goal value, reward XP, optional reward achievement.

Challenges are time-bounded goals (start_at → end_at) that users join and make progress against. Participant progress lives in user_challenges.

Source: apps/api/src/routes/admin/challenges.ts.

Endpoints

MethodPathDescription
POST/admin/projects/:projectId/challengesCreate a challenge.
GET/admin/projects/:projectId/challengesList challenges, optionally filtered by ?status=active|upcoming|ended.
GET/admin/projects/:projectId/challenges/:challengeIdFetch a challenge.
PATCH/admin/projects/:projectId/challenges/:challengeIdPartial update.
DELETE/admin/projects/:projectId/challenges/:challengeIdDelete.
GET/admin/projects/:projectId/challenges/:challengeId/participantsPaginated participants, ordered by progress.

POST /admin/projects/:projectId/challenges

Request

FieldTypeRequired
namestringyes
descriptionstringno
start_atISO-8601yes
end_atISO-8601yes
goal_typestringyes
goal_valuenumberyes
reward_xpnumberno (default 0)
reward_achievement_iduuidno

Response 201

{
  "data": {
    "id": "…",
    "name": "…",
    "goal_type": "workouts",
    "goal_value": 10,
    "reward_xp": 100,
    "start_at": "…",
    "end_at": "…"
  }
}

Try it:

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

Curl:

curl -X POST '${BASE_URL}/admin/projects/{projectId}/challenges' \
  -H 'Authorization: Bearer ${DEV_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{}'

GET /admin/projects/:projectId/challenges

Query

ParamValuesDescription
statusactive, upcoming, endedOptional filter. Omit for all.

Response 200

{
  "data": [
    { "id": "…", "name": "…", "start_at": "…", "end_at": "…", "goal_type": "…", "goal_value": 10 }
  ]
}

Try it:

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

Curl:

curl -X GET '${BASE_URL}/admin/projects/{projectId}/challenges' \
  -H 'Authorization: Bearer ${DEV_TOKEN}'

GET /admin/projects/:projectId/challenges/:challengeId

Errors

  • 404 NOT_FOUND.

Try it:

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

Curl:

curl -X GET '${BASE_URL}/admin/projects/{projectId}/challenges/{challengeId}' \
  -H 'Authorization: Bearer ${DEV_TOKEN}'

PATCH /admin/projects/:projectId/challenges/:challengeId

Allowed fields: name, description, start_at, end_at, goal_type, goal_value, reward_xp, reward_achievement_id, is_active.

Try it:

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

Curl:

curl -X PATCH '${BASE_URL}/admin/projects/{projectId}/challenges/{challengeId}' \
  -H 'Authorization: Bearer ${DEV_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{}'

DELETE /admin/projects/:projectId/challenges/:challengeId

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

Try it:

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

Curl:

curl -X DELETE '${BASE_URL}/admin/projects/{projectId}/challenges/{challengeId}' \
  -H 'Authorization: Bearer ${DEV_TOKEN}'

GET /admin/projects/:projectId/challenges/:challengeId/participants

Paginated list of participants, ordered by progress DESC.

Query

ParamDefault
limit50
offset0

Response 200

{
  "data": [
    {
      "app_user_id": "…",
      "challenge_id": "…",
      "progress": 5,
      "completed_at": null,
      "app_users": { "display_name": "…", "avatar_url": "…" }
    }
  ],
  "total": 123,
  "offset": 0,
  "limit": 50
}

Try it:

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

Curl:

curl -X GET '${BASE_URL}/admin/projects/{projectId}/challenges/{challengeId}/participants' \
  -H 'Authorization: Bearer ${DEV_TOKEN}'