The Courts API lets you retrieve every registered court on the platform and, if you hold an administrative role, create new ones. Courts are the central resource in ReservaFácil — each court (Documentation 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.
Cancha) has a type, pricing, capacity, and an active flag that controls availability for booking.
GET /api/canchas
Returns all courts stored in the database, sorted alphabetically by name. This endpoint is public — no authentication or session cookie is required.The response always includes every court regardless of its
activa status. Client-side code should filter on activa: true when displaying bookable courts to end users.Response — 200 OK
Response fields
Array of all court objects ordered by
nombre ascending.Examples
POST /api/canchas
Creates a new court record. The authenticated user must have the ADMIN or SUPERADMIN role. The session is read from the HTTP-onlytoken cookie, which is sent automatically on same-origin requests.
The
token cookie is set at login and is HTTP-only, meaning it cannot be read from JavaScript. It is forwarded automatically by the browser on every same-origin fetch or XMLHttpRequest.Request body
Display name for the court. Must be a non-empty string, e.g.
"Cancha Tenis Sur".Sport category for this court. Must be exactly one of the four
TipoCancha enum values:| Value | Sport |
|---|---|
FUTBOL | Football |
TENIS | Tennis |
BASQUET | Basketball |
VOLLEYBALL | Volleyball |
Optional description of the court’s facilities or specific rules. Stored as
null if omitted.Hourly rental price. Accepts a number or numeric string — the API calls
parseFloat() internally. Example: 35000 or "35000.50".Maximum player capacity. Accepts a number or numeric string — the API calls
parseInt() internally. Example: 14 or "14".Response — 201 Created
Always
true on a successful creation response.The newly created court object. See the Cancha fields listed under
GET /api/canchas above for the full field descriptions.Error responses
| Status | Body | Cause |
|---|---|---|
400 | { "error": "Faltan campos requeridos" } | One or more of nombre, tipo, precioPorHora, or capacidad is missing from the request body. |
403 | { "error": "Sin permisos" } | No active session, or the authenticated user’s role is neither ADMIN nor SUPERADMIN. |
500 | { "error": "Error interno" } | Unexpected server-side error (e.g. database failure). |