EndpointsDashboard

Dashboard

Function-calling namespace: dashboard

  • Base URL: https://api.aivida.in
  • Engine endpoint: POST /api
  • Auth: Stack token middleware enabled in optional mode.
  • Send token in header: x-stack-access-token: <access_token> (or Authorization: Bearer <access_token>).
  • In optional mode: no token is allowed; invalid token is rejected with 401.

getHomeDashboard

Source: backend/endpoints/dashboard/get-home-dashboard

Input Fields

FieldTypeRequiredConstraints
patientIdstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "dashboard",
  "apiName": "getHomeDashboard",
  "data": {
    "patientId": "patient_123"
  }
}'

Example Response

{
  "status": "ok",
  "data": {
    "profile": {
      "name": "John"
    },
    "todayNutrition": {
      "consumedCalories": 640,
      "goalCalories": 2150,
      "consumedProtein": 103,
      "goalProtein": 150,
      "consumedCarbs": 90,
      "goalCarbs": 115,
      "consumedFat": 22,
      "goalFat": 90
    },
    "todayMeals": [
      {
        "mealType": "BREAKFAST",
        "calories": 75.9,
        "items": 2
      },
      {
        "mealType": "LUNCH",
        "calories": 420,
        "items": 3
      }
    ],
    "trackers": {
      "water": {
        "consumed": 1200,
        "goal": 2500
      },
      "sleep": {
        "sleptHours": 7.5,
        "goalHours": 8
      },
      "weight": {
        "currentWeight": 89.3,
        "trend": "LOSS"
      },
      "medication": {
        "taken": 3,
        "total": 5
      }
    }
  }
}

getWeeklyDashboard

Source: backend/endpoints/dashboard/get-weekly-dashboard

Input Fields

FieldTypeRequiredConstraints
patientIdstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "dashboard",
  "apiName": "getWeeklyDashboard",
  "data": {
    "patientId": "patient_123"
  }
}'

Example Response

{
  "status": "ok",
  "data": {
    "weeklyAverageCalories": 1847,
    "nutrition": {
      "protein": {
        "consumed": 560,
        "goal": 700
      },
      "carbs": {
        "consumed": 1120,
        "goal": 1575
      },
      "fat": {
        "consumed": 245,
        "goal": 350
      }
    },
    "weeklyStats": {
      "caloriesBurned": 0,
      "activeDays": 5,
      "averageSleepHours": 7.2
    },
    "dailyBreakdown": [
      {
        "date": "2026-06-16",
        "calories": 1800
      },
      {
        "date": "2026-06-17",
        "calories": 2100
      }
    ],
    "weeklyChart": [
      {
        "date": "2026-06-16",
        "value": 1800
      },
      {
        "date": "2026-06-17",
        "value": 2100
      }
    ]
  }
}