Amba

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

  1. Admin defines achievements with criteria (event count, streak length, XP threshold, or property value)
  2. Amba evaluates criteria in the background
  3. When a user meets the criteria, the achievement unlocks and optional bonus XP is awarded
  4. Hidden achievements only appear in the user's list after being unlocked

SDK usage

Get all achievements with progress

const achievements = await client.achievements.getAll();
// Returns achievements with unlock status and progress:
// [
//   { key: "first_workout", name: "First Workout", unlocked_at: "2025-01-10T...", progress: { current: 1, target: 1 } },
//   { key: "streak_master_7", name: "Streak Master", unlocked_at: null, progress: { current: 4, target: 7 } }
// ]

Get a specific achievement

const achievement = await client.achievements.get('streak_master_7');

Criteria types

TypeDescriptionRequired fields
event_countTrack an event N timesevent_name, target_value
streak_lengthMaintain a streak for N daysstreak_definition_id, target_value
xp_thresholdReach N total XPtarget_value
property_valueUser property reaches Nproperty_key, target_value

Admin API reference

MethodPathDescription
POST/admin/achievementsCreate achievement
GET/admin/achievementsList all achievements

Client API reference

MethodPathDescription
GET/client/achievementsGet all achievements with user progress
GET/client/achievements/:idGet specific achievement with progress

MCP tools

ToolDescription
amba_create_achievementCreate an achievement with criteria and optional XP reward
amba_list_achievementsList all achievements for a project

Example: Fitness app achievements

Agent: "Create achievements for a fitness app"

amba_create_achievement({
  key: "first_workout",
  name: "First Workout",
  description: "Complete your first workout",
  xp_reward: 100,
  criteria: { type: "event_count", event_name: "workout_completed", target_value: 1 }
})

amba_create_achievement({
  key: "streak_master_7",
  name: "Streak Master",
  description: "Maintain a 7-day workout streak",
  xp_reward: 500,
  criteria: { type: "streak_length", streak_definition_id: "streak_xxx", target_value: 7 }
})

amba_create_achievement({
  key: "xp_legend",
  name: "XP Legend",
  description: "Earn 10,000 XP",
  xp_reward: 1000,
  is_hidden: true,
  criteria: { type: "xp_threshold", target_value: 10000 }
})

Database tables

TablePurpose
achievement_definitionsAchievement definitions with criteria, XP reward, hidden flag
user_achievementsUnlock records with timestamp and progress

On this page