Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/shadownrx/apisquare/llms.txt

Use this file to discover all available pages before exploring further.

The /api/admin/reservations endpoint provides full administrative access to the reservation store. Both methods require a valid admin_session cookie obtained from POST /api/admin/login. In production the reservation data is persisted in Vercel KV; locally, an in-memory global array is used as a fallback.

GET /api/admin/reservations

Fetches every reservation in the system, sorted ascending by date and time.

Request

curl https://your-app.vercel.app/api/admin/reservations \
  -b cookies.txt

Response

HTTP 200
{
  "reservations": [
    {
      "id": "lrd4k2abc123",
      "profesional": "Francisco Chibilisco",
      "servicio": "Masaje Relajante",
      "nombre": "Juan Pérez",
      "fecha": "2024-01-20",
      "hora": "11:00",
      "chatId": 987654321
    }
  ]
}
Reservations are scanned from all reserva:id:* keys in Vercel KV, then sorted ascending by the combined "YYYY-MM-DD HH:MM" string ("${fecha} ${hora}"). The array is empty ([]) when no reservations exist.
reservations
Reservation[]
Array of all reservations in the system.

Error responses

StatusBodyReason
401{ "error": "No autorizado" }Missing or invalid session cookie
500{ "error": "Internal Server Error" }Unexpected server error

DELETE /api/admin/reservations

Removes a single reservation from the system by its ID. The operation deletes all related KV keys and updates the owning user’s reservation list.

Request

curl -X DELETE https://your-app.vercel.app/api/admin/reservations \
  -b cookies.txt \
  -H "Content-Type: application/json" \
  -d '{"id": "lrd4k2abc123"}'

Request body

id
string
required
The unique ID of the reservation to delete. Must correspond to an existing reserva:id:{id} key in Vercel KV.

Success response

HTTP 200
{ "success": true }
success
boolean
Always true when the reservation was found and successfully deleted.

Error responses

StatusBodyReason
400{ "error": "ID is required" }id field missing from request body
401{ "error": "No autorizado" }Missing or invalid session cookie
404{ "error": "Reservation not found" }No reservation exists with that ID
500{ "error": "Internal Server Error" }Unexpected server error

What DELETE does

The following KV operations are performed in sequence:
  1. Fetches the reservation object from reserva:id:{id} to retrieve the professional name, date, and time.
  2. Deletes the slot lock key reserva:{profesional}:{fecha}:{hora}, freeing the time slot for new bookings.
  3. Deletes the ID index key reserva:id:{id}.
  4. Reads user:{chatId}:reservas, filters out the entry whose id matches, and writes the updated array back to KV.

Build docs developers (and LLMs) love