# Posting queues

Give each tiktornado account weekly posting times and add posts to the queue: wall-clock times in a time zone, daylight saving, and how a time is picked.

Each account can have weekly posting times, such as Monday, Wednesday and Friday at 9:00 in New York. A post sent with `queue: true` takes the account's next free one. From then on it is an ordinary scheduled post: edit, move or cancel it like any other.

## Set the times [#set-the-times]

`PUT /accounts/{accountId}/queue` replaces all of the account's times. It needs the `posts:write` scope and an `Idempotency-Key`.

```bash operation="PUT /accounts/{accountId}/queue" kind="request"
curl -X PUT https://api.tiktornado.com/api/v1/accounts/j971x2c4ajrq0w8sd5e8fxz3a57v2k8m/queue \
  -H "Authorization: Bearer $TIKTORNADO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 9a41c7e2-3f5b-4d80-b6e1-7c2f9d0a8e53" \
  -d '{"timeZone": "America/New_York", "slots": [{"day": 0, "minute": 540}, {"day": 2, "minute": 540}, {"day": 4, "minute": 1080}]}'
```

The answer is the new set, sorted by day, then time:

```json operation="PUT /accounts/{accountId}/queue" kind="response" status="200"
{
  "timeZone": "America/New_York",
  "slots": [
    { "day": 0, "minute": 540 },
    { "day": 2, "minute": 540 },
    { "day": 4, "minute": 1080 }
  ]
}
```

- `timeZone` is an IANA name, such as `America/New_York` or `Europe/London`. Any letter case is taken, and the answer gives the zone's own spelling: `america/new_york` comes back as `America/New_York`. Offsets such as `+05:00` are refused.
- `day` is 0 for Monday through 6 for Sunday.
- `minute` is minutes after midnight, 0 to 1439: 540 is 9:00 and 1080 is 18:00.
- No time twice, and at most 15 on one day. Anything else is `invalid_queue`.
- `"slots": []` clears every time. `timeZone` must still be a valid zone.
- Posts already scheduled keep their times.
- The account must be able to post.

`GET /accounts/{accountId}/queue` answers the same shape. An account with no times answers:

```json operation="GET /accounts/{accountId}/queue" kind="response" status="200"
{ "timeZone": null, "slots": [] }
```

## Times are wall-clock times [#times-are-wall-clock-times]

A slot is a weekday and a time of day in the queue's zone, not a moment in UTC. So 9:00 stays 9:00 when the clocks change: Monday 9:00 in `America/New_York` is 14:00 UTC in winter and 13:00 UTC in summer.

On the nights the clocks change:

- **A time the clock skips doesn't happen that day.** In New York, 2:30 doesn't exist on 8 March 2026, so a Sunday 2:30 slot is skipped that Sunday. It isn't moved to 3:30, where it could land on another slot.
- **A time the clock passes twice is used once, the first time.** On 1 November 2026, a Sunday 1:30 slot in New York is 1:30 daylight time (05:30 UTC) only.

## Add a post to the queue [#add-a-post-to-the-queue]

Send `queue: true` instead of `scheduledFor`:

```json operation="POST /posts" kind="request"
{
  "accountId": "j971x2c4ajrq0w8sd5e8fxz3a57v2k8m",
  "kind": "video",
  "caption": "Tuesday tips",
  "mediaRefs": ["https://media.example.com/uploads/5ac3e8/tips.mp4"],
  "queue": true
}
```

The time is picked when the post is saved, and the answer's `scheduledFor` says which one it got:

```json operation="POST /posts" kind="response" status="201"
{
  "id": "k174wq9nrm6t2f0bd3xh8pz5a87v1c2e",
  "status": "scheduling",
  "scheduledFor": "2026-12-02T14:00:00.000Z"
}
```

`queue: true` works with `toDrafts: true`. With no posting times the answer is `queue_empty`, and with nothing free in the next 4 weeks `queue_full`.

## How the next free time is picked [#how-the-next-free-time-is-picked]

The post gets the first slot from now that is:

1. **Free.** No live post of the account, of either kind, is anywhere in that minute. That includes a post you scheduled by hand at that time. Live means scheduled, publishing, published, paused or in drafts: a cancelled, failed or missed post frees its slot.
2. **More than 10 minutes away,** the same lead as any scheduled post.
3. **Not after the account ends.**
4. **Within the daily limit for the post's kind.** A slot is skipped for videos when one more video there would put more than 15 videos in some 24 hours, and the same for photos. A slot skipped for videos can still take a photo post.

Only the next 4 weeks are searched.

## Preview the next free time [#preview-the-next-free-time]

`GET /accounts/{accountId}/queue/next?kind=video` answers the time a post of that kind would get right now:

```json operation="GET /accounts/{accountId}/queue/next" kind="response" status="200"
{ "scheduledFor": "2026-12-02T14:00:00.000Z" }
```

Nothing is held. The time is picked again when the post is saved, so it can differ if other posts were saved in between. It answers `queue_empty` or `queue_full` the same way a queued post would.

Queued posts to one account are best sent one after another. Two sent at the same moment still get different slots, but they slow each other down. See [Several requests at once](/getting-started/rate-limits#several-requests-at-once).