> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simplepay.mx/llms.txt
> Use this file to discover all available pages before exploring further.

# Disponibilidad

> Como modelar schedules, rules, overrides, blackouts y consultas de slots en Bookable Payments.

La disponibilidad en Bookable Payments se calcula con schedules activos, rules recurrentes, overrides, blackouts, holds y bookings existentes.

## Crear schedule

```bash terminal theme={"theme":{"light":"github-light","dark":"github-dark"}}
SCHEDULE_ID="$(
  curl -sS -X POST "https://api.simplepay.mx/v1/bookable-payments/availability_schedules" \
    -H "Authorization: Bearer $SIMPLEPAY_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: schedule_operating_hours_v1" \
    -d '{
      "name": "Operating hours",
      "time_zone": "America/Cancun"
    }' | jq -r '.id'
)"
```

## Agregar reglas semanales

`weekday` usa `0` para domingo y `6` para sabado.

```bash terminal theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -sS -X POST "https://api.simplepay.mx/v1/bookable-payments/availability_schedules/$SCHEDULE_ID/rules" \
  -H "Authorization: Bearer $SIMPLEPAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: schedule_operating_hours_monday_v1" \
  -d '{
    "weekday": 1,
    "start_time": "09:00",
    "end_time": "17:00",
    "capacity": 100
  }'
```

## Overrides

Usa overrides para abrir, cerrar o cambiar capacidad en fechas concretas.

```bash terminal theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -sS -X POST "https://api.simplepay.mx/v1/bookable-payments/availability_schedules/$SCHEDULE_ID/overrides" \
  -H "Authorization: Bearer $SIMPLEPAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: schedule_override_holiday_20260710_v1" \
  -d '{
    "starts_at": "2026-07-10T00:00:00.000-05:00",
    "ends_at": "2026-07-11T00:00:00.000-05:00",
    "capacity": 0,
    "reason": "holiday"
  }'
```

## Blackouts

Un blackout bloquea disponibilidad por rango y puede apuntar a producto, event type, recurso o schedule.

```bash terminal theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -sS -X POST "https://api.simplepay.mx/v1/bookable-payments/blackouts" \
  -H "Authorization: Bearer $SIMPLEPAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: blackout_resource_maintenance_v1" \
  -d '{
    "starts_at": "2026-07-20T13:00:00.000Z",
    "ends_at": "2026-07-20T18:00:00.000Z",
    "resource_id": "00000000-0000-4000-8000-000000000002",
    "reason": "maintenance"
  }'
```

## Consultar slots

Por event type:

```bash terminal theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -sS \
  "https://api.simplepay.mx/v1/bookable-payments/event_types/experiencia-isla/slots?start=2026-07-10T14:00:00.000Z&end=2026-07-11T00:00:00.000Z&time_zone=America/Cancun&quantity=2&view=bookable&group_by=date" \
  -H "Authorization: Bearer $SIMPLEPAY_API_KEY"
```

Por product:

```bash terminal theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -sS \
  "https://api.simplepay.mx/v1/products/00000000-0000-4000-8000-000000000001/slots?start=2026-07-10T14:00:00.000Z&end=2026-07-11T00:00:00.000Z&time_zone=America/Cancun&quantity=2&view=bookable&group_by=date" \
  -H "Authorization: Bearer $SIMPLEPAY_API_KEY"
```

Parametros utiles:

| Parametro                | Uso                                            |
| ------------------------ | ---------------------------------------------- |
| `start`, `end`           | Rango ISO date-time.                           |
| `start_date`, `end_date` | Rango por fecha para date range flows.         |
| `time_zone`              | IANA time zone para interpretar UI.            |
| `quantity`               | Cupo requerido por el cliente.                 |
| `duration_minutes`       | Duracion variable si tu event type lo permite. |
| `resource_id`            | Filtra por recurso especifico.                 |
| `view=bookable`          | Devuelve shape listo para UI.                  |
| `group_by=date`          | Agrupa por fecha local.                        |

## Orden de evaluacion

<Steps>
  <Step title="Schedules y rules">Define ventanas base de disponibilidad.</Step>

  <Step title="Overrides">
    Ajustan una fecha o rango concreto antes de publicar slots.
  </Step>

  <Step title="Blackouts">
    Bloquean rangos por mantenimiento, vacaciones, cierres o capacidad cero.
  </Step>

  <Step title="Holds">Reservan temporalmente mientras un cliente paga.</Step>

  <Step title="Bookings">
    Consumen capacidad confirmada o pendiente segun el estado.
  </Step>
</Steps>

<Warning>
  Muestra slots desde la API justo antes de crear el hold. No confies en
  disponibilidad cacheada por muchos minutos.
</Warning>
