# Queue

Set your weekly slots once and send posts with `"queue": true` instead of `scheduled_at`: Wyro schedules each one at the next free slot and returns the chosen time in `scheduled_at` (and `"queued": true`).

## Set it up

```
curl -X PUT https://wyroapi.com/v1/queue -H "Authorization: Bearer $WYRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "timezone": "America/Argentina/Buenos_Aires",
    "slots": [
      {"days": ["mon", "tue", "wed", "thu", "fri"], "times": ["10:00", "19:00"]},
      {"day": "sat", "time": "11:30"}
    ]
  }'
```

- `timezone`: IANA name (default `America/Argentina/Buenos_Aires`). Daylight saving time is handled: 10:00 stays 10:00 local all year.
- `slots`: `{"day": "mon", "time": "10:00"}` items, or `{"days": [...], "times": [...]}` for every day × every time. Days: `mon` to `sun`; times in 24 h. Up to 100 slots.
- Until you save one, the queue is Monday to Friday at 10:00 and 19:00 (`"configured": false`).

`GET https://wyroapi.com/v1/queue` returns it with the next 5 free slots. `GET https://wyroapi.com/v1/queue/next?count=5` returns up to 50: `[{"scheduled_at": "2026-11-20T13:00:00.000Z", "local": "2026-11-20T10:00:00-03:00"}]`.

## Publish to the queue

```
curl -X POST https://wyroapi.com/v1/posts -H "Authorization: Bearer $WYRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "…", "platforms": ["linkedin"], "queue": true}'
```

A slot is **taken** when a scheduled post of the workspace is already at that exact time; the queue skips it. Slots less than a minute away are skipped too. If no slot is free in the next year (or none are set), the answer is `409 queue_empty`. In a [CSV](https://wyroapi.com/en/docs/csv-import), write `queue` in `scheduled_at`.

A slot that falls in the hour skipped when daylight saving starts moves forward by that hour; one in the hour repeated when it ends takes the first.

## MCP and panel

`wyro_publicar` takes `a_la_cola: true`; `wyro_cuentas` with `ver_cola: true` also returns the next free slots. In the panel, the **Queue** card on Publicaciones edits the slots.
