# Queues API reference

> pushq Queues API reference: create, upsert, get, list, patch, pause, resume, purge and delete queues and read queue stats, with SDK and curl examples.

Source: https://pushqueue.dev/docs/reference/rest/queues/

The Queues API creates and manages pushq queues. A queue holds tasks and decides how they are delivered: how fast (`rate_limits`), how failures are retried (`retry`), where relative task paths point and which headers are forced (`target`), and where permanently failed tasks go (`dead_letter_queue`). To put work on a queue, see the [Tasks API reference](https://pushqueue.dev/docs/reference/rest/tasks/).

All examples use the hosted API at `https://api.pushqueue.dev` and an API key in `$PUSHQ_API_KEY`. Self-hosted servers expose the same endpoints at their own URL.

:::note[Queue names in paths]
Queue names may contain `/` to group queues into folders (`user/instagram`). In a URL path the whole name is **one** segment, so encode the slash: `/v1/queues/user%2Finstagram`. An unencoded slash is read as a different route and returns `404 not_found` with a hint to encode it. The SDKs encode queue names for you.
:::

## Create an SDK client

Every example on this page is shown in TypeScript, Python, Go, Java and .NET, plus the raw `curl` request. The SDK snippets assume a client named `pq`, created like this (see [install and configure an SDK](https://pushqueue.dev/docs/getting-started/sdks/) for self-hosted URLs, timeouts and other options):


**TypeScript**

```ts

const pq = new Pushq({ apiKey: process.env.PUSHQ_API_KEY });
```

**Python**

```python
import os
from pushq import Pushq, RateLimits, Retry, Target

pq = Pushq(api_key=os.environ["PUSHQ_API_KEY"])
```

**Go**

```go
import (
	"context"
	"os"

	pushq "github.com/blissfulrays/pushq/sdks/go"
)

pq := pushq.New("", os.Getenv("PUSHQ_API_KEY")) // "" = https://api.pushqueue.dev
ctx := context.Background()
```

**Java**

```java
import io.pushq.*;

Pushq pq = Pushq.builder().apiKey(System.getenv("PUSHQ_API_KEY")).build();
```

**.NET**

```csharp
using Pushq;

using var pq = new PushqClient(apiKey: Environment.GetEnvironmentVariable("PUSHQ_API_KEY"));
```

Parameter tables on this page use the JSON field names (`rate_limits.max_dispatches_per_second`). The SDKs use their language's casing for the same fields: camelCase in TypeScript and Java (`maxDispatchesPerSecond`), snake_case in Python, PascalCase in Go and .NET (`MaxDispatchesPerSecond`).

## Queue API permissions

| Endpoint | Writer API key | Admin API key | Dashboard roles |
|---|---|---|---|
| Create, upsert, patch, pause, resume, purge | yes | yes | member, admin |
| Get a queue, get stats | yes | yes | viewer, member, admin |
| List queues | no | yes | viewer, member, admin |
| Delete a queue | no | yes | member, admin |

A request without valid credentials gets `401 unauthenticated`; a key or role that lacks the permission gets `403 permission_denied`. On the hosted service each team has its own queue namespace: two teams can both have a queue called `emails` and never see each other's.

## Queue names and folders

A queue name is 1–200 characters made of `/`-separated segments. Each segment starts with a lowercase letter or digit and contains only `a-z`, `0-9` and `-` (regex `^[a-z0-9][a-z0-9-]*(/[a-z0-9][a-z0-9-]*)*$`). Folders have no configuration of their own; they exist as long as some queue name uses them.

Pass folder names to the SDKs as-is; they URL-encode the name as one path segment for you:


**TypeScript**

```ts
await pq.upsertQueue("user/instagram", { target: { baseUrl: "https://api.example.com" } });
await pq.createTask("user/instagram", { path: "/sync", jsonBody: { user_id: 42 } });
```

**Python**

```python
pq.upsert_queue("user/instagram", target=Target(base_url="https://api.example.com"))
pq.create_task("user/instagram", path="/sync", json_body={"user_id": 42})
```

**Go**

```go
_, err := pq.UpsertQueue(ctx, "user/instagram", pushq.QueueConfig{
	Target: &pushq.Target{BaseURL: "https://api.example.com"},
})
_, err = pq.CreateTask(ctx, "user/instagram", pushq.TaskCreate{
	Path:     "/sync",
	JSONBody: map[string]any{"user_id": 42},
})
```

**Java**

```java
pq.upsertQueue("user/instagram", QueueConfig.builder()
    .target(Target.builder().baseUrl("https://api.example.com").build())
    .build());
pq.createTask("user/instagram", TaskCreate.builder()
    .path("/sync")
    .jsonBody(Map.of("user_id", 42))
    .build());
```

**.NET**

```csharp
await pq.UpsertQueueAsync("user/instagram", new QueueConfig
{
    Target = new Target { BaseUrl = "https://api.example.com" },
});
await pq.CreateTaskAsync("user/instagram", new TaskCreate { Path = "/sync", JsonBody = new { user_id = 42 } });
```

**curl**

```bash
curl -X PUT https://api.pushqueue.dev/v1/queues/user%2Finstagram \
  -H "Authorization: Bearer $PUSHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target":{"base_url":"https://api.example.com"}}'

curl -X POST https://api.pushqueue.dev/v1/queues/user%2Finstagram/tasks \
  -H "Authorization: Bearer $PUSHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"path":"/sync","json_body":{"user_id":42}}'
```

List one folder with `name_prefix=user/` on [list queues](#list-queues). For a full walkthrough, see [per-tenant queues](https://pushqueue.dev/docs/patterns/per-tenant-queues/).

## The queue object

Every endpoint on this page except delete and stats returns a queue object.

```json
{
  "name": "emails",
  "state": "running",
  "rate_limits": {
    "max_dispatches_per_second": 50,
    "max_burst_size": 50,
    "max_concurrent_dispatches": 20
  },
  "retry": {
    "max_attempts": 10,
    "max_retry_duration_seconds": 3600,
    "min_backoff_seconds": 1,
    "max_backoff_seconds": 300,
    "max_doublings": 5
  },
  "target": {
    "base_url": "https://app.example.com",
    "method": "POST",
    "headers": { "X-Source": "pushq" },
    "has_signing_secret": true
  },
  "dead_letter_queue": "emails-dead",
  "purged_at": "2026-11-27T09:00:00Z",
  "created_at": "2026-11-20T14:02:11.512Z",
  "updated_at": "2026-11-28T10:15:00.12Z"
}
```

| Field | Type | Description |
|---|---|---|
| `name` | string | The queue name. |
| `state` | string | `running` (dispatching), `paused` (accepting tasks, not dispatching) or `disabled` (rejects new tasks and force-runs). |
| `rate_limits.max_dispatches_per_second` | number | Maximum rate at which tasks are started. |
| `rate_limits.max_burst_size` | integer | Effective token-bucket size. If you configured `0` (auto), this is the resolved value: `ceil(max_dispatches_per_second)` clamped to 1–500. |
| `rate_limits.max_concurrent_dispatches` | integer | Maximum requests in flight at once for this queue. |
| `retry.max_attempts` | integer | Total attempts including the first. `-1` means unlimited. |
| `retry.max_retry_duration_seconds` | number | Time limit for retrying, measured from the first attempt. `0` means unlimited. |
| `retry.min_backoff_seconds` | number | Delay before the first retry. |
| `retry.max_backoff_seconds` | number | Upper bound on any retry delay. |
| `retry.max_doublings` | integer | How many times the backoff doubles before it grows linearly. |
| `target.base_url` | string | Base URL that relative task `path`s are resolved against. Omitted when not set. |
| `target.method` | string | HTTP method that overrides every task's method at dispatch. Omitted when not set. |
| `target.headers` | object | Headers set on every dispatch; they win over task headers with the same name. Omitted when empty. |
| `target.has_signing_secret` | boolean | Whether deliveries are signed. The secret itself is never returned. |
| `dead_letter_queue` | string | Queue that receives a copy of each permanently failed task. Omitted when not set. |
| `purged_at` | string (RFC 3339) | Time of the last purge. Omitted if the queue was never purged. |
| `created_at` | string (RFC 3339) | When the queue was created. |
| `updated_at` | string (RFC 3339) | When its configuration or state last changed. |

For how these settings behave, see [how queues work](https://pushqueue.dev/docs/concepts/queues/), [rate limiting with queues](https://pushqueue.dev/docs/guides/rate-limits/), [retry backoff and max attempts](https://pushqueue.dev/docs/concepts/retries/) and [dead-letter queues](https://pushqueue.dev/docs/concepts/dead-letter-queues/).

## Queue configuration fields (rate limits, retry, target)

The create, upsert and patch endpoints accept the same configuration fields. Ranges are enforced on the final configuration; an out-of-range value returns `400 invalid_argument` naming the field.

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `rate_limits.max_dispatches_per_second` | number | no | `500` | Must be greater than 0 and at most 10000. |
| `rate_limits.max_burst_size` | integer | no | `0` (auto) | 0–10000. `0` derives the burst from the rate: `ceil(rate)` clamped to 1–500. |
| `rate_limits.max_concurrent_dispatches` | integer | no | `1000` | 1–10000. |
| `retry.max_attempts` | integer | no | `100` | `-1` (unlimited) or at least 1. Includes the first attempt. |
| `retry.max_retry_duration_seconds` | number | no | `0` (unlimited) | At least 0. Measured from the first attempt. |
| `retry.min_backoff_seconds` | number | no | `0.1` | At least 0. |
| `retry.max_backoff_seconds` | number | no | `3600` | Must be at least `min_backoff_seconds`. |
| `retry.max_doublings` | integer | no | `16` | 0–31. |
| `target.base_url` | string | no | none | Absolute `http` or `https` URL. Lets tasks use a relative `path` instead of a full `url`. |
| `target.method` | string | no | none | One of `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD`, `OPTIONS` (case-insensitive; stored uppercase). Overrides each task's method; with `GET`, `HEAD`, `DELETE` or `OPTIONS` the task body is not sent. |
| `target.headers` | object (string → string) | no | none | Headers added to every dispatch, overriding task headers of the same name. Names and values must be valid HTTP; `Host`, `Content-Length`, `Transfer-Encoding`, `Connection`, `Keep-Alive`, `Upgrade`, `TE` and `Trailer` are reserved. Total size of names and values at most 16 KiB. |
| `target.signing_secret` | string | no | none | Secret used to sign deliveries with [Standard Webhooks](https://www.standardwebhooks.com/) headers (`webhook-id`, `webhook-timestamp`, `webhook-signature`). A `whsec_`-prefixed secret is base64-decoded; any other string is used as raw bytes. Write-only: responses show `has_signing_secret` instead. `""` removes it. |
| `dead_letter_queue` | string | no | none | Name of another queue that receives a copy of each task that fails permanently. Must follow the queue name rules and cannot be the queue itself. It does not have to exist when you set it, but it must exist when a task fails, or the copy is dropped. `""` removes it. |

## Create a queue

`POST /v1/queues`

Creates a new queue and fails if the name is already taken. Use this when creating a queue should be a one-time, deliberate step (for example in a provisioning script that must notice name collisions). If you want "create it if missing, otherwise make it match this config", use [create or update a queue (upsert)](#create-or-update-a-queue-upsert) instead. A new queue always starts in the `running` state.

**Who can call it:** writer or admin API key; dashboard member or admin.

**Request body**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `name` | string | yes | — | The queue name; see [Queue name rules](#queue-names-and-folders). |
| `rate_limits` | object | no | defaults below | Rate limits; see [Queue configuration fields](#queue-configuration-fields-rate-limits-retry-target). |
| `rate_limits.max_dispatches_per_second` | number | no | `500` | (0, 10000]. |
| `rate_limits.max_burst_size` | integer | no | `0` (auto) | [0, 10000]. |
| `rate_limits.max_concurrent_dispatches` | integer | no | `1000` | [1, 10000]. |
| `retry` | object | no | defaults below | Retry policy. |
| `retry.max_attempts` | integer | no | `100` | `-1` or ≥ 1. |
| `retry.max_retry_duration_seconds` | number | no | `0` | ≥ 0; `0` = unlimited. |
| `retry.min_backoff_seconds` | number | no | `0.1` | ≥ 0. |
| `retry.max_backoff_seconds` | number | no | `3600` | ≥ `min_backoff_seconds`. |
| `retry.max_doublings` | integer | no | `16` | [0, 31]. |
| `target` | object | no | none | Delivery target settings. |
| `target.base_url` | string | no | none | Absolute http(s) URL for relative task paths. |
| `target.method` | string | no | none | Method override. |
| `target.headers` | object | no | none | Header overrides. |
| `target.signing_secret` | string | no | none | Signing secret (write-only). |
| `dead_letter_queue` | string | no | none | Dead-letter queue name. |

The request body may be at most 256 KiB.

**Example**


**TypeScript**

```ts
const queue = await pq.createQueue("emails", {
  rateLimits: { maxDispatchesPerSecond: 50, maxConcurrentDispatches: 20 },
  retry: { maxAttempts: 10, minBackoffSeconds: 1, maxBackoffSeconds: 300 },
  target: {
    baseUrl: "https://app.example.com",
    headers: { "X-Source": "pushq" },
    signingSecret: process.env.PUSHQ_SIGNING_SECRET,
  },
  deadLetterQueue: "emails-dead",
});
```

**Python**

```python
queue = pq.create_queue(
    "emails",
    rate_limits=RateLimits(max_dispatches_per_second=50, max_concurrent_dispatches=20),
    retry=Retry(max_attempts=10, min_backoff_seconds=1, max_backoff_seconds=300),
    target=Target(
        base_url="https://app.example.com",
        headers={"X-Source": "pushq"},
        signing_secret=os.environ["PUSHQ_SIGNING_SECRET"],
    ),
    dead_letter_queue="emails-dead",
)
```

**Go**

```go
queue, err := pq.CreateQueue(ctx, "emails", pushq.QueueConfig{
	RateLimits: &pushq.RateLimits{
		MaxDispatchesPerSecond:  pushq.Float64(50),
		MaxConcurrentDispatches: pushq.Int(20),
	},
	Retry: &pushq.Retry{
		MaxAttempts:       pushq.Int(10),
		MinBackoffSeconds: pushq.Float64(1),
		MaxBackoffSeconds: pushq.Float64(300),
	},
	Target: &pushq.Target{
		BaseURL:       "https://app.example.com",
		Headers:       map[string]string{"X-Source": "pushq"},
		SigningSecret: os.Getenv("PUSHQ_SIGNING_SECRET"),
	},
	DeadLetterQueue: "emails-dead",
})
```

**Java**

```java
Queue queue = pq.createQueue("emails", QueueConfig.builder()
    .rateLimits(RateLimits.builder().maxDispatchesPerSecond(50).maxConcurrentDispatches(20).build())
    .retry(RetryConfig.builder().maxAttempts(10).minBackoffSeconds(1).maxBackoffSeconds(300).build())
    .target(Target.builder()
        .baseUrl("https://app.example.com")
        .header("X-Source", "pushq")
        .signingSecret(System.getenv("PUSHQ_SIGNING_SECRET"))
        .build())
    .deadLetterQueue("emails-dead")
    .build());
```

**.NET**

```csharp
var queue = await pq.CreateQueueAsync("emails", new QueueConfig
{
    RateLimits = new RateLimits { MaxDispatchesPerSecond = 50, MaxConcurrentDispatches = 20 },
    Retry = new RetryConfig { MaxAttempts = 10, MinBackoffSeconds = 1, MaxBackoffSeconds = 300 },
    Target = new Target
    {
        BaseUrl = "https://app.example.com",
        Headers = new Dictionary<string, string> { ["X-Source"] = "pushq" },
        SigningSecret = Environment.GetEnvironmentVariable("PUSHQ_SIGNING_SECRET"),
    },
    DeadLetterQueue = "emails-dead",
});
```

**curl**

```bash
curl -X POST https://api.pushqueue.dev/v1/queues \
  -H "Authorization: Bearer $PUSHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "emails",
    "rate_limits": { "max_dispatches_per_second": 50, "max_concurrent_dispatches": 20 },
    "retry": { "max_attempts": 10, "min_backoff_seconds": 1, "max_backoff_seconds": 300 },
    "target": {
      "base_url": "https://app.example.com",
      "headers": { "X-Source": "pushq" },
      "signing_secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
    },
    "dead_letter_queue": "emails-dead"
  }'
```

In Python, `create_queue` exists only on the synchronous `Pushq` client, not on `AsyncPushq`. To handle a taken name, catch the SDK's error and check for the `already_exists` code (see [error codes](https://pushqueue.dev/docs/reference/errors/)).

**Response**

`201 Created` with the [queue object](#the-queue-object):

```json
{
  "name": "emails",
  "state": "running",
  "rate_limits": {
    "max_dispatches_per_second": 50,
    "max_burst_size": 50,
    "max_concurrent_dispatches": 20
  },
  "retry": {
    "max_attempts": 10,
    "max_retry_duration_seconds": 0,
    "min_backoff_seconds": 1,
    "max_backoff_seconds": 300,
    "max_doublings": 16
  },
  "target": {
    "base_url": "https://app.example.com",
    "headers": { "X-Source": "pushq" },
    "has_signing_secret": true
  },
  "dead_letter_queue": "emails-dead",
  "created_at": "2026-11-28T10:15:00.12Z",
  "updated_at": "2026-11-28T10:15:00.12Z"
}
```

Response fields are described in [The queue object](#the-queue-object).

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | Invalid JSON, invalid name, or a configuration value out of range. |
| 401 | `unauthenticated` | No valid API key or session. |
| 403 | `permission_denied` | The key or role can't write (for example a viewer). |
| 409 | `already_exists` | A queue with this name exists. |
| 413 | `payload_too_large` | Body over 256 KiB. |

See [API error codes](https://pushqueue.dev/docs/reference/errors/) for the error format.

## Create or update a queue (upsert)

`PUT /v1/queues/{queue}`

Makes the queue's configuration exactly match the body, creating the queue if it doesn't exist. It is idempotent, so you can call it on every deploy or even before every enqueue. PUT never changes the queue's `state`, so it can't accidentally resume a paused queue.

Use this when your code owns the queue's configuration and you want "declare it and move on" semantics. Every SDK's upsert method (`upsertQueue`, `upsert_queue`, `UpsertQueue`, `UpsertQueueAsync`) calls this endpoint.

:::caution[PUT replaces the whole configuration]
Fields you leave out are reset to their defaults, not kept: omitting `target` clears `target.base_url`, `target.method` and `target.headers`, and omitting `dead_letter_queue` removes the dead-letter queue. The one exception is `target.signing_secret`: omit it to keep the stored secret, send `""` to remove it. To change a single setting, use [update queue settings with PATCH](#update-queue-settings-patch).
:::

The response carries an `X-Pushq-Result` header: `created`, `updated` or `unchanged`.

**Who can call it:** writer or admin API key; dashboard member or admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `queue` | string | yes | — | Queue name, URL-encoded as one segment (`user%2Finstagram`). |

**Request body**

Same fields as [Create a queue](#create-a-queue) without `name` (the name comes from the path). Every field is optional; an empty body `{}` sets every setting to its default.

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `rate_limits.max_dispatches_per_second` | number | no | `500` | (0, 10000]. |
| `rate_limits.max_burst_size` | integer | no | `0` (auto) | [0, 10000]. |
| `rate_limits.max_concurrent_dispatches` | integer | no | `1000` | [1, 10000]. |
| `retry.max_attempts` | integer | no | `100` | `-1` or ≥ 1. |
| `retry.max_retry_duration_seconds` | number | no | `0` | ≥ 0; `0` = unlimited. |
| `retry.min_backoff_seconds` | number | no | `0.1` | ≥ 0. |
| `retry.max_backoff_seconds` | number | no | `3600` | ≥ `min_backoff_seconds`. |
| `retry.max_doublings` | integer | no | `16` | [0, 31]. |
| `target.base_url` | string | no | none | Absolute http(s) URL. |
| `target.method` | string | no | none | Method override. |
| `target.headers` | object | no | none | Header overrides; replaces any existing set. |
| `target.signing_secret` | string | no | keep existing | Omit to keep the stored secret; `""` to remove it; any other value replaces it. |
| `dead_letter_queue` | string | no | none | Dead-letter queue name. |

**Example**


**TypeScript**

```ts
const queue = await pq.upsertQueue("user/instagram", {
  rateLimits: { maxDispatchesPerSecond: 5, maxConcurrentDispatches: 2 },
  retry: { maxAttempts: 5 },
  target: { baseUrl: "https://worker.example.com" },
});
```

**Python**

```python
queue = pq.upsert_queue(
    "user/instagram",
    rate_limits=RateLimits(max_dispatches_per_second=5, max_concurrent_dispatches=2),
    retry=Retry(max_attempts=5),
    target=Target(base_url="https://worker.example.com"),
)
```

**Go**

```go
queue, err := pq.UpsertQueue(ctx, "user/instagram", pushq.QueueConfig{
	RateLimits: &pushq.RateLimits{
		MaxDispatchesPerSecond:  pushq.Float64(5),
		MaxConcurrentDispatches: pushq.Int(2),
	},
	Retry:  &pushq.Retry{MaxAttempts: pushq.Int(5)},
	Target: &pushq.Target{BaseURL: "https://worker.example.com"},
})
```

**Java**

```java
Queue queue = pq.upsertQueue("user/instagram", QueueConfig.builder()
    .rateLimits(RateLimits.builder().maxDispatchesPerSecond(5).maxConcurrentDispatches(2).build())
    .retry(RetryConfig.builder().maxAttempts(5).build())
    .target(Target.builder().baseUrl("https://worker.example.com").build())
    .build());
```

**.NET**

```csharp
var queue = await pq.UpsertQueueAsync("user/instagram", new QueueConfig
{
    RateLimits = new RateLimits { MaxDispatchesPerSecond = 5, MaxConcurrentDispatches = 2 },
    Retry = new RetryConfig { MaxAttempts = 5 },
    Target = new Target { BaseUrl = "https://worker.example.com" },
});
```

**curl**

```bash
curl -X PUT https://api.pushqueue.dev/v1/queues/user%2Finstagram \
  -H "Authorization: Bearer $PUSHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "rate_limits": { "max_dispatches_per_second": 5, "max_concurrent_dispatches": 2 },
    "retry": { "max_attempts": 5 },
    "target": { "base_url": "https://worker.example.com" }
  }'
```

The SDKs don't expose the `X-Pushq-Result` header; use `curl -i` or your own HTTP client if you need it. In Go, an empty `Target.SigningSecret` keeps the stored secret; set `Target.ClearSigningSecret: true` to remove it.

**Response**

`201 Created` when the queue was created, `200 OK` when it existed (whether or not anything changed). The body is the [queue object](#the-queue-object):

```json
{
  "name": "user/instagram",
  "state": "running",
  "rate_limits": {
    "max_dispatches_per_second": 5,
    "max_burst_size": 5,
    "max_concurrent_dispatches": 2
  },
  "retry": {
    "max_attempts": 5,
    "max_retry_duration_seconds": 0,
    "min_backoff_seconds": 0.1,
    "max_backoff_seconds": 3600,
    "max_doublings": 16
  },
  "target": {
    "base_url": "https://worker.example.com",
    "has_signing_secret": false
  },
  "created_at": "2026-11-28T10:15:00.12Z",
  "updated_at": "2026-11-28T10:15:00.12Z"
}
```

| Header | Description |
|---|---|
| `X-Pushq-Result` | `created`, `updated` or `unchanged`. |

Response fields are described in [The queue object](#the-queue-object).

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | Invalid JSON, invalid queue name, or a value out of range. |
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | The key or role can't write. |
| 413 | `payload_too_large` | Body over 256 KiB. |

## Get a queue

`GET /v1/queues/{queue}`

Returns one queue's current configuration and state. Use it to check how a queue is configured or whether it is paused. Writer keys can read any queue they know by name, even though they can't list queues.

**Who can call it:** writer or admin API key; dashboard viewer, member or admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `queue` | string | yes | — | Queue name, URL-encoded as one segment (`user%2Finstagram`). |

**Example**


**TypeScript**

```ts
const queue = await pq.getQueue("emails");
```

**Python**

```python
queue = pq.get_queue("emails")
```

**Go**

```go
queue, err := pq.GetQueue(ctx, "emails")
```

**Java**

```java
Queue queue = pq.getQueue("emails");
```

**.NET**

```csharp
var queue = await pq.GetQueueAsync("emails");
```

**curl**

```bash
curl https://api.pushqueue.dev/v1/queues/emails \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`200 OK` with the [queue object](#the-queue-object):

```json
{
  "name": "emails",
  "state": "paused",
  "rate_limits": {
    "max_dispatches_per_second": 50,
    "max_burst_size": 50,
    "max_concurrent_dispatches": 20
  },
  "retry": {
    "max_attempts": 10,
    "max_retry_duration_seconds": 0,
    "min_backoff_seconds": 1,
    "max_backoff_seconds": 300,
    "max_doublings": 16
  },
  "target": {
    "base_url": "https://app.example.com",
    "headers": { "X-Source": "pushq" },
    "has_signing_secret": true
  },
  "dead_letter_queue": "emails-dead",
  "created_at": "2026-11-20T14:02:11.512Z",
  "updated_at": "2026-11-28T09:40:03.004Z"
}
```

Response fields are described in [The queue object](#the-queue-object).

**Errors**

| Status | Code | When |
|---|---|---|
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | The caller has no read permission (for example a SaaS user with no team selected). |
| 404 | `not_found` | No queue with this name. |

## List queues

`GET /v1/queues`

Lists queues in name order, one page at a time. Use `name_prefix` to list one folder (`user/`). Use this for dashboards, audits or cleanup scripts. Writer keys can't list queues; use an admin key.

**Who can call it:** admin API key; dashboard viewer, member or admin.

**Query parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `name_prefix` | string | no | none | Only queues whose name starts with this. `user/` lists the `user` folder. |
| `page_size` | integer | no | `100` | Queues per page. Values above 1000 are capped at 1000; 0 or less means 100. |
| `page_token` | string | no | none | `next_page_token` from the previous response. |

**Example**


**TypeScript**

```ts
const page = await pq.listQueues({ namePrefix: "user/", pageSize: 50 });
// page.items, page.nextPageToken
```

**Python**

```python
page = pq.list_queues(name_prefix="user/", page_size=50)
# page.items, page.next_page_token
```

**Go**

```go
queues, next, err := pq.ListQueues(ctx, pushq.ListQueuesParams{NamePrefix: "user/", PageSize: 50})
```

**Java**

```java
QueuePage page = pq.listQueues(ListQueuesParams.builder().namePrefix("user/").pageSize(50).build());
// page.getQueues(), page.getNextPageToken()
```

**.NET**

```csharp
var page = await pq.ListQueuesAsync(new ListQueuesOptions { NamePrefix = "user/", PageSize = 50 });
// page.Items, page.NextPageToken
```

**curl**

```bash
curl "https://api.pushqueue.dev/v1/queues?name_prefix=user/&page_size=50" \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`200 OK`:

```json
{
  "queues": [
    {
      "name": "user/instagram",
      "state": "running",
      "rate_limits": {
        "max_dispatches_per_second": 5,
        "max_burst_size": 5,
        "max_concurrent_dispatches": 2
      },
      "retry": {
        "max_attempts": 5,
        "max_retry_duration_seconds": 0,
        "min_backoff_seconds": 0.1,
        "max_backoff_seconds": 3600,
        "max_doublings": 16
      },
      "target": {
        "base_url": "https://worker.example.com",
        "has_signing_secret": false
      },
      "created_at": "2026-11-28T10:15:00.12Z",
      "updated_at": "2026-11-28T10:15:00.12Z"
    }
  ],
  "next_page_token": "dXNlci9pbnN0YWdyYW0"
}
```

The SDKs return a page object instead of the raw JSON: `items` and `nextPageToken` in TypeScript, `items` and `next_page_token` in Python, `getQueues()` and `getNextPageToken()` in Java, `Items` and `NextPageToken` in .NET; Go returns the slice and the next token as separate values. In Python, `list_queues` exists only on the synchronous `Pushq` client.

| Field | Type | Description |
|---|---|---|
| `queues` | array of [queue objects](#the-queue-object) | This page of queues, ordered by name. Empty array when nothing matches. |
| `next_page_token` | string | Pass as `page_token` to get the next page. Omitted on the last page. |

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | `page_size` is not an integer. |
| 400 | `failed_precondition` | `page_token` is malformed. |
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | Writer API key, or a caller without list permission. |

## Update queue settings (patch)

`PATCH /v1/queues/{queue}`

Changes only the fields you send and leaves everything else as it is. Use it for targeted changes such as lowering the rate during an incident, or setting `state` to `disabled` (which pause/resume can't do). The merged result is validated before it is saved, so a patch can't leave the queue with an invalid configuration.

**Who can call it:** writer or admin API key; dashboard member or admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `queue` | string | yes | — | Queue name, URL-encoded as one segment (`user%2Finstagram`). |

**Request body**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `state` | string | no | unchanged | `running`, `paused` or `disabled`. A disabled queue rejects new tasks and force-runs. |
| `rate_limits.max_dispatches_per_second` | number | no | unchanged | (0, 10000]. |
| `rate_limits.max_burst_size` | integer | no | unchanged | [0, 10000]; `0` = auto. |
| `rate_limits.max_concurrent_dispatches` | integer | no | unchanged | [1, 10000]. |
| `retry.max_attempts` | integer | no | unchanged | `-1` or ≥ 1. |
| `retry.max_retry_duration_seconds` | number | no | unchanged | ≥ 0; `0` = unlimited. |
| `retry.min_backoff_seconds` | number | no | unchanged | ≥ 0. |
| `retry.max_backoff_seconds` | number | no | unchanged | ≥ `min_backoff_seconds` (checked against the merged config). |
| `retry.max_doublings` | integer | no | unchanged | [0, 31]. |
| `target.base_url` | string | no | unchanged | Absolute http(s) URL; `""` removes it. |
| `target.method` | string | no | unchanged | Method override; `""` removes it. |
| `target.headers` | object | no | unchanged | Replaces the whole header-override map; `{}` removes all overrides. |
| `target.signing_secret` | string | no | unchanged | New secret; `""` removes it. |
| `dead_letter_queue` | string | no | unchanged | Dead-letter queue name; `""` removes it. |

**Example**


**TypeScript**

```ts
const queue = await pq.patchQueue("emails", {
  rateLimits: { maxDispatchesPerSecond: 10 },
  retry: { maxAttempts: 20 },
});
```

**Python**

```python
queue = pq.patch_queue(
    "emails",
    rate_limits=RateLimits(max_dispatches_per_second=10),
    retry=Retry(max_attempts=20),
)
```

**Go**

```go
// The last argument is the new state ("" leaves it unchanged).
queue, err := pq.PatchQueue(ctx, "emails", pushq.QueueConfig{
	RateLimits: &pushq.RateLimits{MaxDispatchesPerSecond: pushq.Float64(10)},
	Retry:      &pushq.Retry{MaxAttempts: pushq.Int(20)},
}, "")
```

**Java**

```java
Queue queue = pq.patchQueue("emails", QueuePatch.builder()
    .rateLimits(RateLimits.builder().maxDispatchesPerSecond(10).build())
    .retry(RetryConfig.builder().maxAttempts(20).build())
    .build());
```

**.NET**

```csharp
var queue = await pq.PatchQueueAsync("emails", new QueuePatch
{
    RateLimits = new RateLimits { MaxDispatchesPerSecond = 10 },
    Retry = new RetryConfig { MaxAttempts = 20 },
});
```

**curl**

```bash
curl -X PATCH https://api.pushqueue.dev/v1/queues/emails \
  -H "Authorization: Bearer $PUSHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "rate_limits": { "max_dispatches_per_second": 10 },
    "retry": { "max_attempts": 20 }
  }'
```

In Python, `patch_queue` exists only on the synchronous `Pushq` client. In Go, the fourth argument of `PatchQueue` sets `state` (`"running"`, `"paused"`, `"disabled"`, or `""` to leave it unchanged).

:::caution[Clearing fields from the Go SDK]
The Go SDK never sends empty strings or empty maps, so `PatchQueue` can't clear `target.base_url`, `target.method`, `target.headers` or `dead_letter_queue`. Use `UpsertQueue` with the full configuration, or send the PATCH over HTTP with `""` / `{}`. `Target.ClearSigningSecret: true` does clear the signing secret.
:::

**Response**

`200 OK` with the updated [queue object](#the-queue-object):

```json
{
  "name": "emails",
  "state": "running",
  "rate_limits": {
    "max_dispatches_per_second": 10,
    "max_burst_size": 10,
    "max_concurrent_dispatches": 20
  },
  "retry": {
    "max_attempts": 20,
    "max_retry_duration_seconds": 0,
    "min_backoff_seconds": 1,
    "max_backoff_seconds": 300,
    "max_doublings": 16
  },
  "target": {
    "base_url": "https://app.example.com",
    "headers": { "X-Source": "pushq" },
    "has_signing_secret": true
  },
  "dead_letter_queue": "emails-dead",
  "created_at": "2026-11-20T14:02:11.512Z",
  "updated_at": "2026-11-28T10:20:41.88Z"
}
```

Response fields are described in [The queue object](#the-queue-object).

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | Invalid JSON, unknown `state`, or the merged configuration is out of range. |
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | The key or role can't write. |
| 404 | `not_found` | No queue with this name. |
| 413 | `payload_too_large` | Body over 256 KiB. |

## Delete a queue

`DELETE /v1/queues/{queue}`

Deletes the queue and every task in it, immediately and permanently. Use it to remove a queue you no longer need; if you only want to drop its backlog and keep the configuration, [purge](#purge-a-queue) it instead.

**Who can call it:** admin API key; dashboard member or admin. Writer keys can't delete queues.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `queue` | string | yes | — | Queue name, URL-encoded as one segment (`user%2Finstagram`). |

**Example**


**TypeScript**

```ts
await pq.deleteQueue("user/instagram");
```

**Python**

```python
pq.delete_queue("user/instagram")
```

**Go**

```go
err := pq.DeleteQueue(ctx, "user/instagram")
```

**Java**

```java
pq.deleteQueue("user/instagram");
```

**.NET**

```csharp
await pq.DeleteQueueAsync("user/instagram");
```

**curl**

```bash
curl -X DELETE https://api.pushqueue.dev/v1/queues/user%2Finstagram \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`204 No Content` with an empty body.

**Errors**

| Status | Code | When |
|---|---|---|
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | Writer key or viewer role. |
| 404 | `not_found` | No queue with this name. |

## Pause a queue

`POST /v1/queues/{queue}:pause`

Stops dispatching. The queue keeps accepting new tasks, but nothing is delivered until you resume it. Use it when the receiving service is down or being deployed and you want work to pile up instead of failing and burning retries. Pausing an already-paused queue is a no-op. You can still [force-run](https://pushqueue.dev/docs/reference/rest/tasks/#run-a-task-now) individual tasks while paused.

**Who can call it:** writer or admin API key; dashboard member or admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `queue` | string | yes | — | Queue name, URL-encoded as one segment (`user%2Finstagram`). |

No request body.

**Example**


**TypeScript**

```ts
const queue = await pq.pauseQueue("emails");
```

**Python**

```python
queue = pq.pause_queue("emails")
```

**Go**

```go
queue, err := pq.PauseQueue(ctx, "emails")
```

**Java**

```java
Queue queue = pq.pauseQueue("emails");
```

**.NET**

```csharp
var queue = await pq.PauseQueueAsync("emails");
```

**curl**

```bash
curl -X POST https://api.pushqueue.dev/v1/queues/emails:pause \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`200 OK` with the [queue object](#the-queue-object), now with `"state": "paused"`:

```json
{
  "name": "emails",
  "state": "paused",
  "rate_limits": {
    "max_dispatches_per_second": 50,
    "max_burst_size": 50,
    "max_concurrent_dispatches": 20
  },
  "retry": {
    "max_attempts": 10,
    "max_retry_duration_seconds": 0,
    "min_backoff_seconds": 1,
    "max_backoff_seconds": 300,
    "max_doublings": 16
  },
  "target": {
    "base_url": "https://app.example.com",
    "has_signing_secret": true
  },
  "created_at": "2026-11-20T14:02:11.512Z",
  "updated_at": "2026-11-28T10:22:00Z"
}
```

Response fields are described in [The queue object](#the-queue-object).

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `failed_precondition` | The queue is `disabled`; a disabled queue can't be paused. |
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | The key or role can't write. |
| 404 | `not_found` | No queue with this name. |

## Resume a queue

`POST /v1/queues/{queue}:resume`

Sets the queue back to `running` so due tasks start dispatching again. This also re-enables a `disabled` queue. Resuming a running queue is a no-op.

**Who can call it:** writer or admin API key; dashboard member or admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `queue` | string | yes | — | Queue name, URL-encoded as one segment (`user%2Finstagram`). |

No request body.

**Example**


**TypeScript**

```ts
const queue = await pq.resumeQueue("emails");
```

**Python**

```python
queue = pq.resume_queue("emails")
```

**Go**

```go
queue, err := pq.ResumeQueue(ctx, "emails")
```

**Java**

```java
Queue queue = pq.resumeQueue("emails");
```

**.NET**

```csharp
var queue = await pq.ResumeQueueAsync("emails");
```

**curl**

```bash
curl -X POST https://api.pushqueue.dev/v1/queues/emails:resume \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`200 OK` with the [queue object](#the-queue-object), now with `"state": "running"`:

```json
{
  "name": "emails",
  "state": "running",
  "rate_limits": {
    "max_dispatches_per_second": 50,
    "max_burst_size": 50,
    "max_concurrent_dispatches": 20
  },
  "retry": {
    "max_attempts": 10,
    "max_retry_duration_seconds": 0,
    "min_backoff_seconds": 1,
    "max_backoff_seconds": 300,
    "max_doublings": 16
  },
  "target": {
    "base_url": "https://app.example.com",
    "has_signing_secret": true
  },
  "created_at": "2026-11-20T14:02:11.512Z",
  "updated_at": "2026-11-28T10:30:12.448Z"
}
```

Response fields are described in [The queue object](#the-queue-object).

**Errors**

| Status | Code | When |
|---|---|---|
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | The key or role can't write. |
| 404 | `not_found` | No queue with this name. |

## Purge a queue

`POST /v1/queues/{queue}:purge`

Deletes every task created up to now, in any state, and keeps the queue and its configuration. Purged tasks disappear from the API at once and are removed from storage in the background; results of attempts that were in flight are discarded, and the purged task IDs can be reused right away. Tasks created after the purge are not affected. Use it to throw away a backlog you no longer want delivered, for example after a bad deploy enqueued garbage.

**Who can call it:** writer or admin API key; dashboard member or admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `queue` | string | yes | — | Queue name, URL-encoded as one segment (`user%2Finstagram`). |

No request body.

**Example**


**TypeScript**

```ts
const queue = await pq.purgeQueue("emails");
```

**Python**

```python
queue = pq.purge_queue("emails")
```

**Go**

```go
queue, err := pq.PurgeQueue(ctx, "emails")
```

**Java**

```java
Queue queue = pq.purgeQueue("emails");
```

**.NET**

```csharp
var queue = await pq.PurgeQueueAsync("emails");
```

**curl**

```bash
curl -X POST https://api.pushqueue.dev/v1/queues/emails:purge \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`202 Accepted` with the [queue object](#the-queue-object); `purged_at` is the purge watermark:

```json
{
  "name": "emails",
  "state": "running",
  "rate_limits": {
    "max_dispatches_per_second": 50,
    "max_burst_size": 50,
    "max_concurrent_dispatches": 20
  },
  "retry": {
    "max_attempts": 10,
    "max_retry_duration_seconds": 0,
    "min_backoff_seconds": 1,
    "max_backoff_seconds": 300,
    "max_doublings": 16
  },
  "target": {
    "base_url": "https://app.example.com",
    "has_signing_secret": true
  },
  "purged_at": "2026-11-28T10:31:00Z",
  "created_at": "2026-11-20T14:02:11.512Z",
  "updated_at": "2026-11-28T10:31:00Z"
}
```

Response fields are described in [The queue object](#the-queue-object).

**Errors**

| Status | Code | When |
|---|---|---|
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | The key or role can't write. |
| 404 | `not_found` | No queue with this name. |

## Get queue stats

`GET /v1/queues/{queue}/stats`

Returns live counts for the queue: how many tasks are due, running, scheduled for later, finished, and how many attempts ran and failed in the last minute and hour. Use it for monitoring and alerting (for example, alert when `oldest_due_age_seconds` grows, which means the queue is falling behind). Filter with `id_prefix` to see stats for one group of tasks if you give related tasks a common ID prefix.

Counts cover tasks still stored on the server; finished tasks are removed after their retention period (on self-hosted servers, 24 hours for succeeded and 7 days for failed by default), and purged tasks are excluded.

**Who can call it:** writer or admin API key; dashboard viewer, member or admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `queue` | string | yes | — | Queue name, URL-encoded as one segment (`user%2Finstagram`). |

**Query parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `id_prefix` | string | no | none | Only count tasks whose ID starts with this. |

**Example**


**TypeScript**

```ts
const stats = await pq.queueStats("emails", { idPrefix: "welcome-" });
```

**Python**

```python
stats = pq.queue_stats("emails", id_prefix="welcome-")
```

**Go**

```go
stats, err := pq.QueueStats(ctx, "emails", "welcome-")
```

**Java**

```java
QueueStats stats = pq.queueStats("emails", "welcome-");
```

**.NET**

```csharp
var stats = await pq.GetQueueStatsAsync("emails", idPrefix: "welcome-");
```

**curl**

```bash
curl "https://api.pushqueue.dev/v1/queues/emails/stats?id_prefix=welcome-" \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`200 OK`:

```json
{
  "state": "running",
  "pending": 42,
  "running": 7,
  "succeeded": 15320,
  "failed": 12,
  "scheduled_future": 310,
  "oldest_due_at": "2026-11-28T10:29:58.12Z",
  "oldest_due_age_seconds": 2.88,
  "dispatched_last_1m": 410,
  "errors_last_1m": 3,
  "dispatched_last_1h": 21877,
  "errors_last_1h": 96,
  "last_purge": "2026-11-27T09:00:00Z"
}
```

| Field | Type | Description |
|---|---|---|
| `state` | string | The queue's state: `running`, `paused` or `disabled`. |
| `pending` | integer | Pending tasks that are due now or overdue. |
| `running` | integer | Tasks currently being delivered. |
| `succeeded` | integer | Succeeded tasks still retained. |
| `failed` | integer | Permanently failed tasks still retained. |
| `scheduled_future` | integer | Pending tasks scheduled for a later time. |
| `oldest_due_at` | string (RFC 3339) | Schedule time of the oldest due task. Omitted when nothing is due. |
| `oldest_due_age_seconds` | number | How long the oldest due task has been waiting. Omitted when nothing is due. |
| `dispatched_last_1m` | integer | Delivery attempts started in the last minute. |
| `errors_last_1m` | integer | Attempts in the last minute that did not get a 2xx response. |
| `dispatched_last_1h` | integer | Delivery attempts started in the last hour. |
| `errors_last_1h` | integer | Attempts in the last hour that did not get a 2xx response. |
| `last_purge` | string (RFC 3339) | Time of the last purge. Omitted if never purged. |

**Errors**

| Status | Code | When |
|---|---|---|
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | The caller has no read permission. |
| 404 | `not_found` | No queue with this name. |

## Read more

- [How queues work](https://pushqueue.dev/docs/concepts/queues/): states, folders and what each setting does.
- [Rate limiting with queues](https://pushqueue.dev/docs/guides/rate-limits/): choose `max_dispatches_per_second` and `max_concurrent_dispatches`.
- [Per-tenant queues](https://pushqueue.dev/docs/patterns/per-tenant-queues/): one queue per customer with folder names.
- [Tasks API reference](https://pushqueue.dev/docs/reference/rest/tasks/): enqueue, inspect, run and delete tasks.
- [API error codes](https://pushqueue.dev/docs/reference/errors/): the problem+json format and every `code`.
