Skip to main content
POST
/
api
/
historial
Create Medical History Record
curl --request POST \
  --url https://api.example.com/api/historial \
  --header 'Content-Type: application/json' \
  --data '
{
  "cita_id": 123,
  "notas": "<string>"
}
'
{
  "historial": {
    "historial.id": 123,
    "historial.cita_id": 123,
    "historial.notas": "<string>",
    "historial.created_at": "<string>"
  },
  "400 Bad Request": {},
  "401 Unauthorized": {},
  "403 Forbidden": {},
  "500 Internal Server Error": {}
}
This endpoint creates a medical history record associated with an appointment. It requires authentication and can only be accessed by administrators and assistants.

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>

Request Body

cita_id
number
required
ID of the appointment to associate with this history record
notas
string
Medical notes or observations for the appointment

Response

historial
object
The created medical history record
historial.id
number
History record ID
historial.cita_id
number
Associated appointment ID
historial.notas
string
Medical notes (or null if not provided)
historial.created_at
string
Creation timestamp

Error Responses

400 Bad Request
object
Returned when cita_id is missing
{
  "message": "cita_id es obligatorio"
}
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 crear historial"
}

Example Request

curl -X POST https://api.example.com/api/historial \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>" \
  -d '{
    "cita_id": 123,
    "notas": "Paciente presenta mejoría después del tratamiento. Se recomienda seguimiento en 2 semanas."
  }'

Example Response

{
  "historial": {
    "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"
  }
}

Notes

  • The cita_id should reference an existing appointment in the system
  • The notas field is optional and can be null
  • Records are automatically timestamped on creation

Build docs developers (and LLMs) love