Skip to main content

Get User Achievements

Retrieve all achievements (locked and unlocked) for a user, including progress towards each milestone.

Path Parameters

userId
string
required
MongoDB ObjectId of the user
This endpoint does not require authentication. Achievements are publicly viewable.

Response

success
boolean
Indicates if the request was successful
data
object
Achievements data object

Available Achievements

🎯 Primera Rutina

Requirement: Complete 1 workoutUnlock your first achievement by completing your very first training session.

🔥 Racha de 7 días

Requirement: 7-day streakTrain for 7 consecutive days without missing a day.

💪 Dedicación

Requirement: 10 workouts completedComplete a total of 10 workout sessions.

👑 Guerrero

Requirement: 50 workouts completedReach the milestone of 50 completed workout sessions.

🌟 Leyenda

Requirement: 30-day streakMaintain a training streak for an entire month (30 consecutive days).

🏆 Incansable

Requirement: 100 exercises completedComplete 100 individual exercises across all your workouts.

📅 Consistente

Requirement: Maximum streak ≥ 28 daysDemonstrate consistency by achieving at least a 4-week training streak.

Example Request

curl -X GET 'https://api.fitaiid.com/api/logros/507f1f77bcf86cd799439011'

Example Response

{
  "success": true,
  "data": {
    "achievements": [
      {
        "id": "first_workout",
        "icon": "🎯",
        "nombre": "Primera Rutina",
        "descripcion": "Completaste tu primera sesión",
        "condition": true,
        "unlocked": true,
        "unlockedAt": "2024-01-15T10:30:00.000Z"
      },
      {
        "id": "week_streak",
        "icon": "🔥",
        "nombre": "Racha de 7 días",
        "descripcion": "Una semana sin parar",
        "condition": true,
        "unlocked": true,
        "unlockedAt": "2024-02-01T18:45:00.000Z"
      },
      {
        "id": "ten_workouts",
        "icon": "💪",
        "nombre": "Dedicación",
        "descripcion": "10 rutinas completadas",
        "condition": true,
        "unlocked": true,
        "unlockedAt": "2024-02-10T20:00:00.000Z"
      },
      {
        "id": "fifty_workouts",
        "icon": "👑",
        "nombre": "Guerrero",
        "descripcion": "50 rutinas completadas",
        "condition": false,
        "unlocked": false,
        "unlockedAt": null
      },
      {
        "id": "month_streak",
        "icon": "🌟",
        "nombre": "Leyenda",
        "descripcion": "Racha de 30 días",
        "condition": false,
        "unlocked": false,
        "unlockedAt": null
      },
      {
        "id": "hundred_exercises",
        "icon": "🏆",
        "nombre": "Incansable",
        "descripcion": "100 ejercicios completados",
        "condition": false,
        "unlocked": false,
        "unlockedAt": null
      },
      {
        "id": "consistency",
        "icon": "📅",
        "nombre": "Consistente",
        "descripcion": "4 semanas seguidas entrenando",
        "condition": false,
        "unlocked": false,
        "unlockedAt": null
      }
    ],
    "totalUnlocked": 3,
    "totalPossible": 7
  }
}

Achievement Logic

Achievements are evaluated based on the user’s fitnessStats field:
Condition: user.fitnessStats.totalWorkouts >= 1Unlocked automatically after completing the first workout session.
Condition: user.fitnessStats.currentStreak >= 7Requires training for 7 consecutive days. The streak breaks if a day is missed.
Condition: user.fitnessStats.totalWorkouts >= 10Unlocked after completing 10 total workout sessions (not necessarily consecutive).
Condition: user.fitnessStats.totalWorkouts >= 50Major milestone requiring 50 completed workouts.
Condition: user.fitnessStats.currentStreak >= 30Requires maintaining a 30-day consecutive training streak.
Condition: user.fitnessStats.totalExercises >= 100Unlocked after completing 100 individual exercises across all workouts.
Condition: user.fitnessStats.maxStreak >= 28Based on the user’s all-time maximum streak. Must have achieved at least a 28-day streak at some point.

Integration with Notifications

When an achievement is unlocked, the system automatically sends a push notification to the user if they have notifications enabled.
Achievements are checked and unlocked automatically when workouts are completed via the /api/entrenamientos/registrar endpoint.

Error Responses

404
error
User not found
{
  "success": false,
  "message": "Usuario no encontrado"
}

Display Recommendations

Display locked achievements with a grayscale or dimmed style to show users what they can work towards. Show unlock progress (e.g., “15/50 workouts completed”) when applicable.

User Statistics

View the statistics that determine achievement unlocks

Register Workout

Complete workouts to unlock achievements

User Profile

Get complete user profile with achievements

Build docs developers (and LLMs) love