Achievements
Badges and achievements that unlock automatically based on event counts, streak lengths, or XP thresholds.
Achievements are badges that unlock automatically when users meet specific criteria. They can award bonus XP on unlock and support hidden achievements.
How it works
- Admin defines achievements with criteria (event count, streak length, XP threshold, or property value)
- Amba evaluates criteria in the background
- When a user meets the criteria, the achievement unlocks and optional bonus XP is awarded
- Hidden achievements only appear in the user's list after being unlocked
SDK usage
Get all achievements with progress
Get a specific achievement
Criteria types
| Type | Description | Required fields |
|---|---|---|
event_count | Track an event N times | event_name, target_value |
streak_length | Maintain a streak for N days | streak_definition_id, target_value |
xp_threshold | Reach N total XP | target_value |
property_value | User property reaches N | property_key, target_value |
Manual grant & revoke (support & moderation)
Achievements normally unlock through automatic criteria evaluation. For support, promos, or corrections you can also award or claw one back for a specific user with amba_achievements_grant and amba_achievements_revoke (REST: POST /admin/achievements/:id/grant, POST /admin/achievements/:id/revoke).
A manual grant is idempotent — re-granting an already-unlocked achievement keeps the original unlock time. It does not auto-award the achievement's xp_reward (that's reserved for a genuine criteria-driven unlock); award XP separately with amba_xp_grant if you want it. Revoke removes the user's unlock entirely, returning a not-found error if they didn't hold it.
Admin API reference
| Method | Path | Description |
|---|---|---|
POST | /admin/achievements | Create achievement |
GET | /admin/achievements | List all achievements |
POST | /admin/achievements/:id/grant | Manually unlock for a user (support) |
POST | /admin/achievements/:id/revoke | Claw back a user's unlock |
Client API reference
| Method | Path | Description |
|---|---|---|
GET | /client/achievements | Get all achievements with user progress |
GET | /client/achievements/:id | Get specific achievement with progress |
MCP tools
| Tool | Description |
|---|---|
amba_achievements_create | Create an achievement with criteria and optional XP reward |
amba_achievements_list | List all achievements for a project |
amba_achievements_grant | Manually unlock an achievement for a user (support / promo) |
amba_achievements_revoke | Claw back a user's unlock (inverse of grant) |