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

# Queues API

> Every Queues endpoint under /api/v1/queues, with request and reply shapes.

> [!TIP]
>
> **Live.** This area is documented as current, user-reliable behavior.

## Goal

Manage queues, consumers, messages, dead letters, tokens and sources from your own code.

## Prerequisites

* An API key. A pull token works only for pull and ack on its queue.

## Workflow

**Step 1**

Authenticate with Authorization: Bearer and your API key.

**Step 2**

Pass \{queue} as the queue name, or as its id or \<project\_id>:\<name> when the name exists in more than one of your projects (otherwise 409 queue\_name\_ambiguous).

**Step 3**

Send and read JSON. Times are RFC 3339 in UTC.

## Queues

* GET /queues?project\_id= lists queues.
* POST /queues creates one: project\_id, name, retention\_seconds, default\_delay\_seconds, accepts, consumer, dead\_letter \{mode: new | existing | none, queue\_id}.
* GET /queues/\{queue}; PATCH /queues/\{queue} with retention\_seconds, default\_delay\_seconds, accepts; DELETE /queues/\{queue} with confirm\_name.
* POST /queues/\{queue}/pause and /resume; POST /queues/\{queue}/purge with confirm\_name returns purged\_count.
* A queue has id, project\_id, project\_name, name, role (queue or dead\_letter), dead\_letter\_for, state (active, paused or no\_consumer), paused\_at, paused\_by, retention\_seconds, default\_delay\_seconds, accepts, backlog\_count, backlog\_bytes, oldest\_age\_seconds, in\_per\_minute, out\_per\_minute, failed\_24h, operations\_month, consumer and created\_at.

## Consumer

* PUT /queues/\{queue}/consumer with kind, function\_path, function\_project\_id, url, batch\_size, batch\_wait\_ms, max\_retries, retry\_delay\_seconds, max\_concurrency (0 = auto) and dead\_letter \{mode: new|existing|none, queue\_id}.
* DELETE /queues/\{queue}/consumer removes it.
* The consumer also reports running\_batches, last\_error and last\_error\_at.

## Messages

* POST /queues/\{queue}/messages with body, content\_type, delay\_seconds, idempotency\_key returns id, sent\_at, visible\_at.
* POST /queues/\{queue}/messages/batch with messages (up to 100, 256 KB) returns their ids.
* POST /queues/\{queue}/messages/pull with batch\_size and visibility\_timeout\_ms; POST /queues/\{queue}/messages/ack with acks and retries.
* GET /queues/\{queue}/messages?state=ready|delayed|leased\&q=\&limit=\&cursor= lists messages oldest first with counts per state. Reading never leases.
* GET /queues/\{queue}/messages/\{id} returns one message with its body and its last retry.
* DELETE /queues/\{queue}/messages with message\_ids deletes them.

## Health and failures

* GET /queues/\{queue}/metrics?range=1h|24h|7d|14d returns points with waiting, in, out, acked, retried, dead\_lettered and oldest\_age\_seconds.
* GET /queues/\{queue}/failures?limit=20 lists dead-lettered messages and retried batches with their error.
* GET /queues/\{queue}/dead-letters/groups and POST /queues/\{queue}/redrive on a dead-letter queue.

## Tokens, sources and usage

* GET, POST /queues/\{queue}/tokens and DELETE /queues/\{queue}/tokens/\{id}. POST takes a name and returns the token once.
* GET, POST /queues/\{queue}/sources and DELETE /queues/\{queue}/sources/\{id}. POST takes events and optional project\_ids.
* GET /queues/usage?month=YYYY-MM.

## SDKs and CLI

* JavaScript and Python: client.queues on the StackShift client. Go: client.Queues. PHP: new \StackShift\QueuesClient(\$token). Ruby: StackShift::QueuesClient.new(api\_key:), or client.queues on AssetsClient and ComputersClient, with send\_message and send\_batch.
* CLI: stackshift queues create, list, get, delete, send, pull, ack, retry, tail, pause, resume, purge, redrive, and consumer set and consumer remove.

## Expected result

> [!TIP]
>
> Your code can do everything the Queues dashboard does.

## Related guides

> [card] [Create a queue](https://docs.stackshift.cloud/queues/create-a-queue.md)
>
> Create a queue from the dashboard, the CLI or the API, with its retention, default delay, accepted content types, consumer and dead-letter queue.

> [card] [Send messages](https://docs.stackshift.cloud/queues/send-messages.md)
>
> Send one message or a batch of up to 100 from the SDKs, the CLI or the API, as JSON, text or bytes, with an optional delay and idempotency key.

> [card] [Pull consumers](https://docs.stackshift.cloud/queues/pull-consumers.md)
>
> A worker anywhere pulls a batch over HTTP, leases the messages for a visibility timeout, then acks or retries each one by lease id.


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