Skip to main content
PUT
/
api
/
citas
/
:id
/
confirmar
Confirm Appointment
curl --request PUT \
  --url https://api.example.com/api/citas/:id/confirmar \
  --header 'Content-Type: application/json' \
  --data '
{
  "medico_id": 123
}
'
{
  "message": "<string>",
  "cita": {
    "id": 123,
    "cliente_id": 123,
    "medico_id": 123,
    "fecha_solicitada": "<string>",
    "hora_solicitada": "<string>",
    "fecha_confirmada": "<string>",
    "hora_confirmada": "<string>",
    "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 confirm

Request Body

medico_id
number
required
The doctor ID to assign to this appointment

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
number
Assigned doctor ID
fecha_solicitada
string
Requested date (ISO 8601)
hora_solicitada
string
Requested time (ISO 8601)
fecha_confirmada
string
Confirmed date (ISO 8601) - set to current date
hora_confirmada
string
Confirmed time (ISO 8601) - set to current timestamp
sintomas
string | null
Patient symptoms description
estado
string
Appointment status - updated to confirmada
created_at
string
Creation timestamp

Example Request

curl -X PUT https://api.example.com/api/citas/1/confirmar \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "medico_id": 2
  }'

Example Response

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

Error Responses

400 Bad Request
Missing required field
{
  "message": "medico_id es obligatorio"
}
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 confirming appointment
{
  "message": "Error al confirmar cita"
}

Notes

  • Confirming an appointment updates its status from pendiente to confirmada
  • The fecha_confirmada is set to the current date
  • The hora_confirmada is set to the current timestamp
  • The assigned doctor must exist in the database

Build docs developers (and LLMs) love