Bookings

Endpoints to create and manage bookings.

POST /api/v1/reservas/crear/

Creates a new booking.

Authentication

This endpoint can be used without JWT for guest bookings, or with JWT for authenticated customers.

Body parameters

Parameter Type Required Description
servicio_ids array Yes Array of service IDs
peluquero_id integer Yes Professional ID
fecha string Yes Date (YYYY-MM-DD)
hora_inicio string Yes Start time (HH:MM)
nombre string Yes* Customer name (*if no JWT)
email string Yes* Customer email (*if no JWT)
telefono string Yes* Phone (*if configured as required)
notas string No Additional notes
usar_puntos boolean No Pay with loyalty points

Request example

cURL
curl -X POST "https://app.salonbookit.com/api/v1/reservas/crear/" \
  -H "X-API-Key: hh_pub_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "servicio_ids": [15],
    "peluquero_id": 5,
    "fecha": "2024-01-20",
    "hora_inicio": "10:30",
    "nombre": "Juan Pérez",
    "email": "juan@email.com",
    "telefono": "+34612345678",
    "notas": "Primera visita"
  }'

Response (201 Created)

JSON
{
    "success": true,
    "data": {
        "id": 12345,
        "codigo": "ABC123XY",
        "fecha": "2024-01-20",
        "hora_inicio": "10:30",
        "hora_fin": "11:00",
        "servicios": [
            {
                "id": 15,
                "nombre": "Corte Clásico",
                "precio": 25.00,
                "duracion_minutos": 30
            }
        ],
        "profesional": {
            "id": 5,
            "nombre": "Carlos García"
        },
        "cliente": {
            "id": 456,
            "nombre": "Juan Pérez",
            "email": "juan@email.com",
            "telefono": "+34612345678"
        },
        "subtotal": 25.00,
        "descuento": 0.00,
        "total": 25.00,
        "moneda": "EUR",
        "estado": "confirmada",
        "pago_requerido": false,
        "pago_pendiente": true,
        "puntos_ganados": 25,
        "created_at": "2024-01-15T14:30:00Z"
    }
}
GET /api/v1/cliente/reservas/

Lists the authenticated customer's bookings.

Requires JWT

Query parameters

Parameter Type Description
estado string Filter: pending, confirmed, completed, cancelled
desde string Start date (YYYY-MM-DD)
hasta string End date (YYYY-MM-DD)

Response (200 OK)

JSON
{
    "success": true,
    "data": {
        "reservas": [
            {
                "id": 12345,
                "codigo": "ABC123XY",
                "fecha": "2024-01-20",
                "hora_inicio": "10:30",
                "hora_fin": "11:00",
                "servicios": [...],
                "profesional": {...},
                "total": 25.00,
                "estado": "confirmada",
                "puede_cancelar": true
            }
        ],
        "proxima_reserva": {
            "id": 12345,
            "fecha": "2024-01-20",
            "hora_inicio": "10:30"
        },
        "total": 15
    }
}
GET /api/v1/reservas/{id}/

Gets booking details.

Path parameters

Parameter Type Description
id integer Booking ID
Query by code

You can also query using the code: /reservas/codigo/{codigo}/

POST /api/v1/reservas/{id}/cancelar/

Cancels an existing booking.

Body parameters

Parameter Type Required Description
motivo string No Cancellation reason

Request example

cURL
curl -X POST "https://app.salonbookit.com/api/v1/reservas/12345/cancelar/" \
  -H "X-API-Key: hh_pub_live_abc123..." \
  -H "Authorization: Bearer eyJhbG..." \
  -H "Content-Type: application/json" \
  -d '{"motivo": "Cambio de planes"}'

Response (200 OK)

JSON
{
    "success": true,
    "data": {
        "id": 12345,
        "estado": "cancelada",
        "cancelada_en": "2024-01-15T16:00:00Z",
        "reembolso": {
            "aplica": true,
            "monto": 25.00,
            "estado": "pendiente"
        }
    }
}

Errors

Code HTTP Description
BOOKING_NOT_FOUND 404 Booking not found
CANNOT_CANCEL 400 Booking cannot be cancelled (already passed or already cancelled)
CANCELLATION_DEADLINE_PASSED 400 Cancellation deadline passed (e.g., 24h before)

Booking statuses

Status Description
pendiente Booking created, pending confirmation
confirmada Booking confirmed by business
completada Service performed
cancelada Cancelled by customer or business
no_show Customer did not show up