Skip to main content

Endpoint

GET /api/reservations/user/:client_id

Description

Retrieves all reservations associated with a specific user by their client ID. See implementation in server/src/modules/reservations/reservations.controller.ts:89-107.

Authentication

This endpoint requires Bearer token authentication. Include your access token in the Authorization header.

Path Parameters

client_id
string
required
The unique identifier of the client whose reservations you want to retrieveExample: abc123

Response

status
number
HTTP status code (200 for success)
message
string
Success message including the client ID
data
array
Array of reservation objects for the specified user

Example Request

curl -X GET https://your-domain.com/api/reservations/user/abc123 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json"

Example Response

{
  "status": 200,
  "message": "SOLICITASTE TODAS LAS RESERVAS DEL USUARIO CON EL ID: abc123 EXITOSAMENTE",
  "data": [
    {
      "id": "res789",
      "client_id": "abc123",
      "professional_id": "prof456",
      "start_time": "2026-03-15T10:00:00Z",
      "end_time": "2026-03-15T11:00:00Z",
      "status": "CONFIRMED",
      "session_modality": "Virtual",
      "created_at": "2026-03-10T08:30:00Z"
    },
    {
      "id": "res791",
      "client_id": "abc123",
      "professional_id": "prof789",
      "start_time": "2026-03-20T15:00:00Z",
      "end_time": "2026-03-20T16:00:00Z",
      "status": "PENDING",
      "session_modality": "Presencial",
      "created_at": "2026-03-12T10:20:00Z"
    }
  ]
}

Error Responses

Bad Request

{
  "statusCode": 400,
  "message": "Error al obtener las reservas del usuario",
  "error": "Bad Request"
}

Unauthorized

{
  "statusCode": 401,
  "message": "Token inválido o expirado",
  "error": "Unauthorized"
}

Use Cases

  • Display a user’s upcoming appointments
  • Show reservation history
  • Allow users to manage their bookings
  • Build a user dashboard with reservation information

Notes

  • Returns an empty array if the user has no reservations
  • All reservations for the user are returned regardless of status
  • To get reservations for a professional, use Get By Professional

Build docs developers (and LLMs) love