Get User Profile
Retrieve the authenticated user’s profile information.
Authentication
Bearer JWT token obtained from login
Response
Indicates if the request was successful
User profile object
Fitness questionnaire data
User’s gender (hombre/mujer)
Fitness level (principiante/intermedio/avanzado)
Main fitness goal (tonificar/ganar masa muscular/bajar de peso)
Training location (casa/gym)
Number of training days per week (1-7)
Workout statistics and achievements
Total number of completed workouts
Total number of exercises completed
Total training time in minutes
Current consecutive training days
Maximum streak ever achieved
Array of unlocked achievements
Account creation timestamp
Example Request
curl -X GET 'https://api.fitaiid.com/api/users/profile' \
-H 'Authorization: Bearer YOUR_JWT_TOKEN'
Example Response
{
"success": true,
"user": {
"_id": "507f1f77bcf86cd799439011",
"firstName": "Juan",
"lastName": "Pérez",
"email": "[email protected]",
"fotoPerfil": "/uploads/profile-1234567890.jpg",
"fitnessProfile": {
"gender": "hombre",
"age": 28,
"height": 175,
"weight": 75,
"fitnessLevel": "intermedio",
"mainGoal": "ganar masa muscular",
"trainingLocation": "gym",
"trainingDaysPerWeek": 4
},
"fitnessStats": {
"totalWorkouts": 45,
"totalExercises": 340,
"totalMinutes": 2250,
"currentStreak": 12,
"maxStreak": 18,
"achievements": [
{
"achievementId": "first_workout",
"unlockedAt": "2024-01-15T10:30:00.000Z"
},
{
"achievementId": "week_streak",
"unlockedAt": "2024-02-01T18:45:00.000Z"
}
]
},
"createdAt": "2024-01-15T08:00:00.000Z"
}
}
Update Profile Photo
Upload a new profile photo for the authenticated user.
Authentication
Bearer JWT token obtained from login
Request Body
Image file (JPEG, PNG, GIF). Uploaded as multipart/form-data.
Response
Indicates if the upload was successful
Updated user object with new photo URL
Example Request
const formData = new FormData();
formData.append('fotoPerfil', fileInput.files[0]);
const response = await fetch('https://api.fitaiid.com/api/users/profile/photo', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`
},
body: formData
});
const data = await response.json();
Example Response
{
"success": true,
"message": "Foto de perfil actualizada correctamente",
"user": {
"_id": "507f1f77bcf86cd799439011",
"firstName": "Juan",
"lastName": "Pérez",
"fotoPerfil": "/uploads/profile-1710345678.jpg",
"email": "[email protected]"
}
}
Error Responses
No image file uploaded{
"success": false,
"message": "No se subió ninguna imagen"
}
Invalid or missing JWT token{
"success": false,
"message": "No autorizado"
}
User not found{
"success": false,
"message": "Usuario no encontrado"
}
Update Profile
Update user profile information
User Statistics
Get detailed workout statistics
Achievements
View unlocked achievements