Skip to main content
GET
/
api
/
historial
List Medical History
curl --request GET \
  --url https://api.example.com/api/historial
{
  "historial": [
    {
      "id": 123,
      "cita_id": 123,
      "notas": "<string>",
      "created_at": "<string>",
      "cita": {
        "cita.id": 123,
        "cita.fecha_solicitada": "<string>",
        "cita.hora_solicitada": "<string>",
        "cita.estado": "<string>",
        "cita.sintomas": "<string>",
        "cita.cliente": {
          "cliente.id": 123,
          "cliente.nombres": "<string>",
          "cliente.apellidos": "<string>",
          "cliente.telefono": "<string>",
          "cliente.email": "<string>"
        },
        "cita.medico": {
          "medico.id": 123,
          "medico.persona": {
            "persona.nombres": "<string>",
            "persona.apellidos": "<string>"
          }
        }
      }
    }
  ],
  "401 Unauthorized": {},
  "403 Forbidden": {},
  "500 Internal Server Error": {}
}
This endpoint retrieves all medical history records in the system, including detailed information about the associated appointment, client, and assigned doctor. Records are ordered by creation date (newest first).

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

historial
array
Array of medical history record objects
id
number
History record ID
cita_id
number
Associated appointment ID
notas
string
Medical notes or observations
created_at
string
Record creation timestamp
cita
object
Associated appointment information
cita.id
number
Appointment ID
cita.fecha_solicitada
string
Requested appointment date
cita.hora_solicitada
string
Requested appointment time
cita.estado
string
Appointment status (pendiente, confirmada, atendida, cancelada)
cita.sintomas
string
Patient symptoms or reason for visit
cita.cliente
object
Patient/client 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
cita.medico
object
Assigned doctor information (if assigned)
medico.id
number
Doctor ID
medico.persona
object
Doctor’s personal information
persona.nombres
string
Doctor’s first name(s)
persona.apellidos
string
Doctor’s last name(s)

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 al listar historial"
}

Example Request

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

Example Response

[
  {
    "id": 56,
    "cita_id": 123,
    "notas": "Paciente presenta mejoría después del tratamiento. Se recomienda seguimiento en 2 semanas.",
    "created_at": "2026-03-05T16:30:00.000Z",
    "cita": {
      "id": 123,
      "fecha_solicitada": "2026-03-15T00:00:00.000Z",
      "hora_solicitada": "1970-01-01T10:30:00.000Z",
      "estado": "atendida",
      "sintomas": "Dolor de cabeza persistente",
      "cliente": {
        "id": 45,
        "nombres": "Juan",
        "apellidos": "Pérez",
        "telefono": "+502 5555-1234",
        "email": "[email protected]"
      },
      "medico": {
        "id": 10,
        "persona": {
          "nombres": "Dr. Carlos",
          "apellidos": "Ramírez"
        }
      }
    }
  }
]

Notes

  • Records are ordered by created_at in descending order (newest first)
  • The response includes complete appointment details with nested client and doctor information
  • This endpoint is useful for reviewing patient medical history and appointment outcomes

Build docs developers (and LLMs) love