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 |
Admin API reference
| Method | Path | Description |
|---|---|---|
POST | /admin/achievements | Create achievement |
GET | /admin/achievements | List all achievements |
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_create_achievement | Create an achievement with criteria and optional XP reward |
amba_list_achievements | List all achievements for a project |
Example: Fitness app achievements
Database tables
| Table | Purpose |
|---|---|
achievement_definitions | Achievement definitions with criteria, XP reward, hidden flag |
user_achievements | Unlock records with timestamp and progress |