Skip to main content
GET
/
api
/
dashboard
/
stats
Get Dashboard Statistics
curl --request GET \
  --url https://api.example.com/api/dashboard/stats
{
  "citasHoy": 123,
  "pendientes": 123,
  "confirmadas": 123,
  "atendidas": 123,
  "canceladas": 123,
  "401 Unauthorized": {},
  "403 Forbidden": {},
  "500 Internal Server Error": {}
}
This endpoint provides an overview of key metrics for the medical center dashboard, including the number of appointments today and counts by status.

Authentication

This endpoint requires authentication with a Bearer token.Only users with role admin or asistente can access this endpoint.

Request Headers

Authorization: Bearer <token>

Response

citasHoy
number
Number of appointments scheduled for today
pendientes
number
Total number of pending appointments
confirmadas
number
Total number of confirmed appointments
atendidas
number
Total number of completed appointments
canceladas
number
Total number of cancelled appointments

Error Responses

401 Unauthorized
object
Returned when no valid authentication token is provided
{
  "message": "Token requerido"
}
403 Forbidden
object
Returned when the user’s role is not authorized
{
  "message": "Acceso denegado"
}
500 Internal Server Error
object
Returned when a server error occurs
{
  "message": "Error dashboard stats"
}

Example Request

curl -X GET https://api.example.com/api/dashboard/stats \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>"

Example Response

{
  "citasHoy": 12,
  "pendientes": 8,
  "confirmadas": 15,
  "atendidas": 143,
  "canceladas": 7
}

Notes

  • “Today” is calculated based on the server’s timezone, from 00:00:00 to 23:59:59
  • All status counts are cumulative across all time periods, not just today
  • This endpoint is optimized with parallel database queries for better performance

Build docs developers (and LLMs) love