> For the complete documentation index, see [llms.txt](https://docs.sprinthub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sprinthub.com/en/topics/integrations/integrations-z-api/z-api-queue-system.md).

# Z-API - Queue System

Z-API has a queue system responsible for organizing and controlling the sending of messages made through the API. This mechanism ensures that messages are processed in an orderly manner and helps maintain sending stability, especially in scenarios where the device linked to WhatsApp has an unstable connection.

***

### How does the queue work?

Whenever a message is sent to Z-API, it is not forwarded immediately to WhatsApp. First, it is added to a processing queue, where it waits its turn to be sent.

In simplified terms, the flow works as follows:

1. The system sends the message to Z-API.
2. Z-API adds the message to the queue.
3. The instance processes the queue and sends it to WhatsApp.
4. The webhooks report the status of the message processing and delivery.

### Operation during instability

The queue system also acts as a protection layer when the phone connected to the instance becomes temporarily unavailable, whether due to lack of internet, the device being turned off, or other instabilities.

In these cases, messages remain stored in the queue and, as soon as the connection is restored, pending sends will be processed automatically.

***

### How to disable the queue

If you do not want to use the queue system, you need to disable this feature directly in the settings of the **Z-API Web Instance**.

{% hint style="danger" %}
**Important:** when the queue is disabled, messages will not be stored if the instance is disconnected. In this way, any send attempt made during a period of unavailability may fail and will not be resent automatically after reconnection.
{% endhint %}

It is recommended to carefully evaluate this setting before disabling it.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2Ftcg2dh5eaGJ315tXqc1O%2FWhatsApp%20Image%202026-06-23%20at%2016.24.32.jpeg?alt=media&amp;token=50b7ad7d-671a-4c75-b4ee-00b9d76f891e" alt=""><figcaption></figcaption></figure>

### Important recommendation

Before reconnecting an instance, Z-API recommends checking whether there are any pending messages in the queue.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FTJSTjOwyWhxgCvJqVzvY%2Fimage.png?alt=media&amp;token=40ab0f93-2c63-4688-a473-8138e391fa0d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FsjYfOOv7r6N5WAoak5RF%2Fimage.png?alt=media&amp;token=db8367db-557e-4369-a178-1682071edb72" alt=""><figcaption></figcaption></figure>

This is important because, when the instance reconnects, the queue will run automatically and all pending messages will be sent. Depending on the context, these messages may no longer make sense for the recipient.

For this reason, it is recommended that the user be informed about the existence of these messages and decide whether to keep them or discard them before reconnection.

### Queue limit

Z-API allows storing up to **1,000 messages** in the queue while the phone is disconnected. After reaching this limit, new messages will begin to be rejected until there is space available in the queue.

***

### Official reference

For more information, see the official Z-API documentation:

<https://developer.z-api.io/queue/introduction>
