Skip to main content
GET
/
api
/
dashboard
/
proximas-citas
Get Upcoming Appointments
curl --request GET \
  --url https://api.example.com/api/dashboard/proximas-citas
{
  "citas": [
    {
      "id": 123,
      "cliente_id": 123,
      "medico_id": 123,
      "fecha_solicitada": "<string>",
      "hora_solicitada": "<string>",
      "fecha_confirmada": "<string>",
      "hora_confirmada": "<string>",
      "sintomas": "<string>",
      "estado": "<string>",
      "created_at": "<string>",
      "cliente": {
        "cliente.id": 123,
        "cliente.nombres": "<string>",
        "cliente.apellidos": "<string>",
        "cliente.telefono": "<string>",
        "cliente.email": "<string>"
      },
      "medico": {
        "medico.id": 123,
        "medico.especialidad_id": 123,
        "medico.especialidad": {
          "especialidad.id": 123,
          "especialidad.nombre": "<string>"
        }
      }
    }
  ],
  "401 Unauthorized": {},
  "403 Forbidden": {},
  "500 Internal Server Error": {}
}
This endpoint returns the next 5 upcoming appointments with status pendiente or confirmada, ordered by date and time. Includes complete client and doctor information.

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

citas
array
Array of upcoming appointment objects (maximum 5)
id
number
Appointment ID
cliente_id
number
Client ID
medico_id
number
Doctor ID (may be null if not assigned)
fecha_solicitada
string
Requested appointment date
hora_solicitada
string
Requested appointment time
fecha_confirmada
string
Confirmed appointment date (if status is confirmada)
hora_confirmada
string
Confirmed appointment time (if status is confirmada)
sintomas
string
Patient symptoms or reason for visit
estado
string
Appointment status (pendiente or confirmada)
created_at
string
Appointment creation timestamp
cliente
object
Client/patient information
cliente.id
number
Client ID
cliente.nombres
string
Client’s first name(s)
cliente.apellidos
string
Client’s last name(s)
cliente.telefono
string
Client’s phone number
cliente.email
string
Client’s email address
medico
object
Doctor information (if assigned)
medico.id
number
Doctor ID
medico.especialidad_id
number
Medical specialty ID
medico.especialidad
object
Specialty information
especialidad.id
number
Specialty ID
especialidad.nombre
string
Specialty name

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 próximas citas"
}

Example Request

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

Example Response

[
  {
    "id": 125,
    "cliente_id": 45,
    "medico_id": 10,
    "fecha_solicitada": "2026-03-06T00:00:00.000Z",
    "hora_solicitada": "1970-01-01T09:00:00.000Z",
    "fecha_confirmada": "2026-03-06T00:00:00.000Z",
    "hora_confirmada": "1970-01-01T09:00:00.000Z",
    "sintomas": "Control de presión arterial",
    "estado": "confirmada",
    "created_at": "2026-03-01T10:00:00.000Z",
    "cliente": {
      "id": 45,
      "nombres": "Juan",
      "apellidos": "Pérez",
      "telefono": "+502 5555-1234",
      "email": "[email protected]"
    },
    "medico": {
      "id": 10,
      "especialidad_id": 3,
      "especialidad": {
        "id": 3,
        "nombre": "Cardiología"
      }
    }
  },
  {
    "id": 126,
    "cliente_id": 47,
    "medico_id": null,
    "fecha_solicitada": "2026-03-07T00:00:00.000Z",
    "hora_solicitada": "1970-01-01T14:30:00.000Z",
    "fecha_confirmada": null,
    "hora_confirmada": null,
    "sintomas": "Dolor de espalda",
    "estado": "pendiente",
    "created_at": "2026-03-02T08:15:00.000Z",
    "cliente": {
      "id": 47,
      "nombres": "María",
      "apellidos": "López",
      "telefono": "+502 5555-5678",
      "email": "[email protected]"
    },
    "medico": null
  }
]

Notes

  • Only returns appointments with status pendiente or confirmada
  • Maximum of 5 appointments are returned
  • Results are ordered by fecha_solicitada and hora_solicitada (earliest first)
  • Includes complete client and doctor information with specialty details
  • Useful for dashboard “next appointments” widgets

Build docs developers (and LLMs) love