TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Nyverie/reservafacil/llms.txt
Use this file to discover all available pages before exploring further.
/api/reservas/[id] endpoints provide single-record access to reservations. All three methods require authentication, and each enforces strict role-based rules: regular users can only view and cancel their own reservations, while admins and superadmins have full read, update, and delete privileges over any record.
GET /api/reservas/[id]
Retrieves a single reservation by its CUID. The response always includes the nestedcancha and usuario objects regardless of caller role.
Requires authentication.
Path parameter
The CUID of the reservation to retrieve (e.g.
clx1abc2def3ghi).Access rules
USUARIO: can only retrieve a reservation wherereserva.usuarioId === session.id. Attempting to fetch another user’s reservation returns403.ADMIN/SUPERADMIN: can retrieve any reservation.
Response 200
The full reservation object, always including nested
cancha and usuario.CUID identifier for the reservation.
ID of the user who owns the reservation.
ID of the reserved court.
Date of the reservation as a UTC timestamp.
Start time in
HH:MM 24-hour format.End time in
HH:MM 24-hour format.One of:
PENDIENTE, CONFIRMADA, CANCELADA, COMPLETADA.Total cost of the booking.
Optional notes attached to the reservation.
Timestamp of when the record was created.
Nested Cancha (court) object.
Nested Usuario object. Present for all roles on this endpoint (unlike the list endpoint, where it is omitted for
USUARIO callers).Error responses
| Status | Body | Description |
|---|---|---|
401 | { "error": "No autenticado" } | No valid session. |
403 | { "error": "Sin permisos" } | Caller is USUARIO and the reservation belongs to a different user. |
404 | { "error": "No encontrada" } | No reservation found with the given id. |
PATCH /api/reservas/[id]
Partially updates a reservation. Accepts any subset of Reserva fields in the request body and merges them into the existing record. Requires authentication.Path parameter
The CUID of the reservation to update.
Request body
New status for the reservation. One of:
PENDIENTE, CONFIRMADA, CANCELADA, COMPLETADA. USUARIO callers may only supply "CANCELADA".Updated notes for the reservation. Available to
ADMIN and SUPERADMIN only.Updated start time in
HH:MM format. Available to ADMIN and SUPERADMIN only.Updated end time in
HH:MM format. Available to ADMIN and SUPERADMIN only.Updated total cost. Available to
ADMIN and SUPERADMIN only.Response 200
Always
true on success.The updated reservation including nested
cancha and usuario.Error responses
| Status | Body | Description |
|---|---|---|
401 | { "error": "No autenticado" } | No valid session. |
403 | { "error": "Sin permisos" } | USUARIO attempting to patch a reservation that does not belong to them. |
403 | { "error": "Solo puedes cancelar tu reserva" } | USUARIO attempting to set estado to any value other than "CANCELADA". |
404 | { "error": "No encontrada" } | No reservation found with the given id. |
DELETE /api/reservas/[id]
Permanently deletes a reservation. This action is irreversible. RequiresADMIN or SUPERADMIN role. Any request from a USUARIO session — or an unauthenticated request — is rejected with 403. There is no soft-delete; the record is removed from the database entirely.
Path parameter
The CUID of the reservation to delete.
Response 200
Always
true on success.Error responses
| Status | Body | Description |
|---|---|---|
403 | { "error": "Sin permisos" } | Caller is not authenticated, or has USUARIO role. |