Skip to main content

Get Today's Summary (v1)

Method & Path

GET /api/v1/nutrition/portal/:slug/today

Description

Retrieves a comprehensive summary of the client's current day, including their active plan meals, food diary, and calorie/macro progress.

Authentication

Required: Portal token (Bearer authentication)

Headers

HeaderRequiredDescription
AuthorizationYesBearer <portal_token>

Path Parameters

ParameterTypeRequiredDescription
slugstringYesSpecialist's portal slug

Query Parameters

ParameterTypeRequiredDescription
datestringNoDate in YYYY-MM-DD format (default: today)

Response 200 OK

{
"date": "2024-01-15",
"plan": {
"id": "507f1f77bcf86cd799439013",
"name": "خطة إنقاص الوزن",
"dailyCalories": 1800,
"macros": {
"protein": 120,
"carbs": 180,
"fats": 60
},
"todaysMeals": [
{
"id": "meal-1",
"name": "الفطور",
"time": "08:00",
"calories": 400,
"items": [
{ "name": "بيض مسلوق", "quantity": "2 حبة", "calories": 140 },
{ "name": "خبز أسمر", "quantity": "شريحة", "calories": 80 }
]
},
{
"id": "meal-2",
"name": "الغداء",
"time": "13:00",
"calories": 600,
"items": [...]
}
]
},
"diary": {
"id": "507f1f77bcf86cd799439014",
"date": "2024-01-15",
"meals": [...],
"totalCalories": 850,
"totalProtein": 60,
"totalCarbs": 80,
"totalFats": 30,
"waterIntake": 1500,
"mood": "good"
},
"targets": {
"dailyCalories": 1800,
"macros": {
"protein": 120,
"carbs": 180,
"fats": 60
}
},
"consumed": {
"calories": 850,
"protein": 60,
"carbs": 80,
"fats": 30
}
}

Response Fields

FieldTypeDescription
datestringThe date in YYYY-MM-DD format
planobjectActive plan with today's meals (null if no plan)
diaryobjectFood diary for the day (null if no entries)
targetsobjectDaily targets from plan or estimated
consumedobjectTotal consumed today

Calorie Calculation

If no active plan exists, the API estimates daily calorie needs using the Mifflin-St Jeor equation based on the client's profile (weight, height, age, gender) with a moderate activity multiplier.

Common Errors

  • 401 Unauthorized: Missing or invalid token
  • 403 Forbidden: Password change required
  • 404 Not Found: Invalid portal slug