Skip to main content
GET
/
api
/
dashboard
/
citas-por-estado
Get Appointments by Status
curl --request GET \
  --url https://api.example.com/api/dashboard/citas-por-estado
{
  "data": [
    {
      "estado": "<string>",
      "total": 123
    }
  ],
  "401 Unauthorized": {},
  "403 Forbidden": {},
  "500 Internal Server Error": {}
}
This endpoint returns aggregated appointment counts grouped by their status. Useful for generating charts and visualizations.

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

data
array
Array of status count objects
estado
string
Appointment status (pendiente, confirmada, atendida, cancelada)
total
number
Number of appointments with this status

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 citas por estado"
}

Example Request

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

Example Response

[
  {
    "estado": "pendiente",
    "total": 8
  },
  {
    "estado": "confirmada",
    "total": 15
  },
  {
    "estado": "atendida",
    "total": 143
  },
  {
    "estado": "cancelada",
    "total": 7
  }
]

Notes

  • The response only includes status values that have at least one appointment
  • Perfect for pie charts or bar graphs showing appointment distribution
  • Status values are: pendiente, confirmada, atendida, cancelada

Build docs developers (and LLMs) love