Skip to main content
GET
/
api
/
users
/
{userId}
/
reservations
List Reservations
curl --request GET \
  --url https://api.example.com/api/users/{userId}/reservations
{
  "id": 123,
  "date": "<string>",
  "timeBlockId": 123,
  "patientId": 123,
  "doctorId": 123,
  "status": "<string>",
  "reason": "<string>",
  "notes": "<string>",
  "patient": {},
  "doctor": {},
  "timeBlock": {},
  "createdAt": "<string>",
  "updatedAt": "<string>"
}

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header:
Authorization: Bearer <token>

Path Parameters

userId
integer
required
The ID of the user whose reservations you want to retrieve. This must match the authenticated user’s ID.

Description

This endpoint retrieves all reservations for a specific user. The reservations returned depend on the authenticated user’s role and the userId parameter.

Response

The response structure depends on the implementation. Typically returns reservation details including:
id
integer
The unique identifier for the appointment
date
string
The appointment date and time (ISO 8601 format)
timeBlockId
integer
The ID of the associated time block
patientId
integer
The ID of the patient
doctorId
integer
The ID of the doctor
status
string
The appointment status: PENDING, CONFIRMED, CANCELLED, or COMPLETED
reason
string
The reason for the appointment
notes
string
Additional notes for the appointment
patient
object
Detailed information about the patient (if included)
doctor
object
Detailed information about the doctor (if included)
timeBlock
object
Detailed information about the time block (if included)
createdAt
string
Timestamp when the appointment was created (ISO 8601 format)
updatedAt
string
Timestamp when the appointment was last updated (ISO 8601 format)

Error Responses

401 Unauthorized

Returned when the JWT token is missing or invalid:
{
  "error": "Unauthorized"
}

500 Internal Server Error

Returned when an unexpected server error occurs:
{
  "error": "Error message details"
}

Example Request

curl -X GET https://api.example.com/api/users/42/reservations \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Example Response

[
  {
    "id": 89,
    "date": "2026-03-15T10:00:00.000Z",
    "timeBlockId": 42,
    "patientId": 12,
    "doctorId": 5,
    "status": "PENDING",
    "reason": "Consulta general",
    "notes": "Paciente presenta síntomas de gripe",
    "createdAt": "2026-03-03T14:30:00.000Z",
    "updatedAt": "2026-03-03T14:30:00.000Z"
  },
  {
    "id": 90,
    "date": "2026-03-16T14:30:00.000Z",
    "timeBlockId": 45,
    "patientId": 12,
    "doctorId": 7,
    "status": "CONFIRMED",
    "reason": "Seguimiento",
    "notes": null,
    "createdAt": "2026-03-03T15:00:00.000Z",
    "updatedAt": "2026-03-03T16:00:00.000Z"
  }
]

Build docs developers (and LLMs) love