Skip to main content
PUT
/
api
/
citas
/
:id
/
cancelar
Cancel Appointment
curl --request PUT \
  --url https://api.example.com/api/citas/:id/cancelar
{
  "message": "<string>",
  "cita": {
    "id": 123,
    "cliente_id": 123,
    "medico_id": null,
    "fecha_solicitada": "<string>",
    "hora_solicitada": "<string>",
    "fecha_confirmada": {},
    "hora_confirmada": {},
    "sintomas": {},
    "estado": "<string>",
    "created_at": "<string>"
  }
}

Authentication

This endpoint requires authentication and authorization. Required roles: admin or asistente Header:
Authorization: Bearer <token>

Path Parameters

id
number
required
The appointment ID to cancel

Response

Returns a success message and the updated appointment object.
message
string
Success message
cita
object
Updated appointment object
id
number
Appointment ID
cliente_id
number
Public client ID
medico_id
null
Doctor assignment removed (set to null)
fecha_solicitada
string
Requested date (ISO 8601)
hora_solicitada
string
Requested time (ISO 8601)
fecha_confirmada
string | null
Confirmed date (ISO 8601)
hora_confirmada
string | null
Confirmed time (ISO 8601)
sintomas
string | null
Patient symptoms description
estado
string
Appointment status - updated to cancelada
created_at
string
Creation timestamp

Example Request

curl -X PUT https://api.example.com/api/citas/1/cancelar \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json"

Example Response

{
  "message": "Cita cancelada",
  "cita": {
    "id": 1,
    "cliente_id": 5,
    "medico_id": null,
    "fecha_solicitada": "2026-03-15T00:00:00.000Z",
    "hora_solicitada": "1970-01-01T14:30:00.000Z",
    "fecha_confirmada": "2026-03-15T00:00:00.000Z",
    "hora_confirmada": "2026-03-05T18:20:00.000Z",
    "sintomas": "Dolor de cabeza constante",
    "estado": "cancelada",
    "created_at": "2026-03-05T10:00:00.000Z"
  }
}

Error Responses

401 Unauthorized
Missing or invalid authentication token
{
  "message": "Token no proporcionado"
}
403 Forbidden
User doesn’t have required role
{
  "message": "Acceso denegado: requiere rol admin o asistente"
}
500 Internal Server Error
Server error while canceling appointment
{
  "message": "Error al cancelar cita"
}

Notes

  • Canceling an appointment updates its status to cancelada
  • The medico_id field is set to null, removing any doctor assignment
  • This operation can be performed on appointments in any status
  • No request body is required for this operation
  • The confirmed date and time are preserved for record-keeping

Build docs developers (and LLMs) love