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

# Message order (FIFO) and Send now

> Tuco delivers messages to a contact from one line in the order you create them. When a message waits, how to see it, and how to skip the queue.

## The rule

Messages from **one line** to **one contact** are delivered **in the order you created them**. While an
earlier message to that contact is still on its way (`pending`, `queued`, `sending` or `scheduled`), a
later message waits behind it. When the earlier one is delivered, or fails for good, the next one goes.

This keeps conversations readable: your follow-up never lands before your intro, and a link never lands
before the message that explains it.

It is **not** a global queue:

* Different contacts on the same line are not affected.
* The same contact on a different line is not affected.

## What does not hold the queue

Once a contact has received at least one message on this line, two kinds of earlier message no longer
hold later ones back:

| Earlier message | Why it does not block |
| - | - |
| **Planned for later**: created with a `scheduledDate` more than 2 minutes after it was made, never held by Tuco, never tried | Its own time is later than your new message, so there is nothing to keep in order. |
| **Abandoned**: Tuco has given up on it and nothing will move it again | It would block the chat forever. |

A **first message** (nothing delivered to this contact on this line yet) keeps the strict rule: nothing
overtakes the earliest message.

## How to tell a message is waiting

A message held by the queue has:

* `status: "scheduled"`
* `rescheduleReason: "fifo:serial_lock_blocked"`
* `fifoBlockedBy`: the id of the earlier message it waits behind
* `fifoBlockerAt`: when that earlier message is due, if it is planned for a set time

You see these fields on [`GET /api/messages`](https://docs.tuco.ai/api-reference/endpoint/get-messages). The Tuco Unibox and
mobile app show the message in its thread as waiting, with the reason.

Tuco re-checks a waiting message on its own (after about 10 s, 30 s, then every 90 s), so it goes soon after
the one in front of it is delivered. You don't need to do anything.

## Send now, and skip the queue

Sometimes the message in front is not urgent, for example a reminder planned for tonight, and you want
the new one out now. Ask for that **per message**, either when you send it:

```bash theme={null}
curl -X POST "https://app.tuco.ai/api/messages" \
  -H "Authorization: Bearer tuco_xxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{ "message": "Running 5 min late", "recipientPhone": "+12025551234", "passFifo": true }'
```

or later, for a message that is already waiting:

```bash theme={null}
curl -X POST "https://app.tuco.ai/api/unibox/held-reply" \
  -H "Authorization: Bearer tuco_xxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{ "messageId": "6b02fb399a3f70b73d69cf2d", "action": "send_now", "passFifo": true }'
```

* `passFifo: true` lets **this one message** go ahead of the earlier ones. It never changes the order of anything else.
* It is **refused on a first message**. If nothing has been delivered to this contact on this line yet, the answer
  says `fifo.passFifoRefused: "first_message"` and the message keeps waiting.
* It works on a message that is waiting in the queue, and on a reply still in its Undo window.
* It never happens by default. Without `passFifo`, every message keeps its place.

Full request and response: [Undo or send a held message now](https://docs.tuco.ai/api-reference/endpoint/held-reply.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.