Queues and queue configuration
A pushq queue holds tasks and decides how they are delivered: how fast, how many at once, how failures are retried, and where relative paths point. This page covers creating and configuring queues, every queue setting, pausing, purging and deleting queues, queue folders, and queue stats.
Use one queue per kind of work (emails, webhooks), or one per customer when each needs its own rate limit (see Rate limits).
The examples on this page assume a client named pq (see Install & configure an SDK). Parameter tables use the JSON field names; the SDKs use their language’s casing (maxDispatchesPerSecond in TypeScript and Java, max_dispatches_per_second in Python, MaxDispatchesPerSecond in Go and .NET).
import { Pushq } from "pushq";
const pq = new Pushq({ apiKey: process.env.PUSHQ_API_KEY });import osfrom pushq import Pushq, RateLimits, Retry, Target
pq = Pushq(api_key=os.environ["PUSHQ_API_KEY"])import pushq "github.com/blissfulrays/pushq/sdks/go"
pq := pushq.New("", os.Getenv("PUSHQ_API_KEY")) // "" = hosted APIctx := context.Background()import io.pushq.*;
Pushq pq = Pushq.builder().apiKey(System.getenv("PUSHQ_API_KEY")).build();using Pushq;
using var pq = new PushqClient(apiKey: Environment.GetEnvironmentVariable("PUSHQ_API_KEY"));export PUSHQ_API_KEY=pq_...Create a queue
Section titled “Create a queue”There are two ways to create a queue.
Create or update a queue with PUT (upsert)
Section titled “Create or update a queue with PUT (upsert)”PUT /v1/queues/{queue} is an idempotent upsert. It creates the queue if it doesn’t exist and replaces its configuration if it does. It is cheap enough to call before every enqueue, so your code never has to check whether a queue exists.
await pq.upsertQueue("emails", { rateLimits: { maxDispatchesPerSecond: 10, maxConcurrentDispatches: 5 }, retry: { maxAttempts: 5, minBackoffSeconds: 1, maxBackoffSeconds: 300 }, target: { baseUrl: "https://api.example.com" },});pq.upsert_queue( "emails", rate_limits=RateLimits(max_dispatches_per_second=10, max_concurrent_dispatches=5), retry=Retry(max_attempts=5, min_backoff_seconds=1, max_backoff_seconds=300), target=Target(base_url="https://api.example.com"),)_, err := pq.UpsertQueue(ctx, "emails", pushq.QueueConfig{ RateLimits: &pushq.RateLimits{ MaxDispatchesPerSecond: pushq.Float64(10), MaxConcurrentDispatches: pushq.Int(5), }, Retry: &pushq.Retry{ MaxAttempts: pushq.Int(5), MinBackoffSeconds: pushq.Float64(1), MaxBackoffSeconds: pushq.Float64(300), }, Target: &pushq.Target{BaseURL: "https://api.example.com"},})pq.upsertQueue("emails", QueueConfig.builder() .rateLimits(RateLimits.builder().maxDispatchesPerSecond(10).maxConcurrentDispatches(5).build()) .retry(RetryConfig.builder().maxAttempts(5).minBackoffSeconds(1).maxBackoffSeconds(300).build()) .target(Target.builder().baseUrl("https://api.example.com").build()) .build());await pq.UpsertQueueAsync("emails", new QueueConfig{ RateLimits = new RateLimits { MaxDispatchesPerSecond = 10, MaxConcurrentDispatches = 5 }, Retry = new RetryConfig { MaxAttempts = 5, MinBackoffSeconds = 1, MaxBackoffSeconds = 300 }, Target = new Target { BaseUrl = "https://api.example.com" },});curl -X PUT https://api.pushqueue.dev/v1/queues/emails \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -d '{ "rate_limits": {"max_dispatches_per_second": 10, "max_concurrent_dispatches": 5}, "retry": {"max_attempts": 5, "min_backoff_seconds": 1, "max_backoff_seconds": 300}, "target": {"base_url": "https://api.example.com"} }'The response is the queue. The status is 201 when the queue was created and 200 otherwise, and the X-Pushq-Result header says what happened: created, updated or unchanged.
PUT never changes the queue’s state, so calling it on every enqueue can’t accidentally resume a paused queue.
Create a queue only if it doesn’t exist (POST)
Section titled “Create a queue only if it doesn’t exist (POST)”POST /v1/queues creates a queue and fails with 409 already_exists if the name is taken. The body is the same as PUT plus a name field.
await pq.createQueue("emails", { rateLimits: { maxDispatchesPerSecond: 10 } });pq.create_queue("emails", rate_limits=RateLimits(max_dispatches_per_second=10))_, err := pq.CreateQueue(ctx, "emails", pushq.QueueConfig{ RateLimits: &pushq.RateLimits{MaxDispatchesPerSecond: pushq.Float64(10)},})pq.createQueue("emails", QueueConfig.builder() .rateLimits(RateLimits.builder().maxDispatchesPerSecond(10).build()) .build());await pq.CreateQueueAsync("emails", new QueueConfig{ RateLimits = new RateLimits { MaxDispatchesPerSecond = 10 },});curl -X POST https://api.pushqueue.dev/v1/queues \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -d '{"name": "emails", "rate_limits": {"max_dispatches_per_second": 10}}'Use this when creating a queue that already exists should be an error, for example in a provisioning script. New queues always start in the running state.
Queue configuration reference
Section titled “Queue configuration reference”All fields are optional. Omitted fields take the default shown.
Rate limit settings
Section titled “Rate limit settings”| Parameter | Type | Default | Description |
|---|---|---|---|
rate_limits.max_dispatches_per_second |
number | 500 |
Token refill rate. Must be greater than 0 and at most 10000. Fractions are allowed: 0.5 is one dispatch every two seconds. |
rate_limits.max_burst_size |
integer | 0 (auto) |
Token bucket size, 0 to 10000. 0 means auto: max_dispatches_per_second rounded up, between 1 and 500. Responses always show the resolved value. |
rate_limits.max_concurrent_dispatches |
integer | 1000 |
Maximum requests in flight at once for this queue, 1 to 10000. |
How these interact, and how to pick values, is covered in the Rate limits guide.
Retry settings
Section titled “Retry settings”| Parameter | Type | Default | Description |
|---|---|---|---|
retry.max_attempts |
integer | 100 |
Total attempts, including the first. -1 means unlimited. 0 is rejected. |
retry.max_retry_duration_seconds |
number | 0 (unlimited) |
How long after the first attempt retries may continue. Must be 0 or more. |
retry.min_backoff_seconds |
number | 0.1 |
Delay before the first retry. Must be 0 or more. |
retry.max_backoff_seconds |
number | 3600 |
Upper bound on any delay. Must be at least min_backoff_seconds. |
retry.max_doublings |
integer | 16 |
How many times the delay doubles before growing linearly, 0 to 31. |
The exact schedule, and how max_attempts and max_retry_duration_seconds combine, are explained in Retries. Tasks can override any of these individually.
Target settings: base URL, method, headers and signing secret
Section titled “Target settings: base URL, method, headers and signing secret”| Parameter | Type | Default | Description |
|---|---|---|---|
target.base_url |
string | none | Absolute http or https URL. Tasks created with a relative path are sent to base_url + path. Without it, every task must have an absolute url. |
target.method |
string | none | When set, overrides every task’s HTTP method. One of GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS. |
target.headers |
object | none | Headers added to every delivery. They win over task headers with the same name. At most 16 KiB in total (names plus values). |
target.signing_secret |
string | none | Standard Webhooks secret (whsec_...). When set, every delivery is signed. Never returned; responses show has_signing_secret instead. |
The target is applied at delivery time, so changing base_url or headers affects tasks that are already queued. See Delivery for the full request pushq sends.
target.headers can’t contain Host, Content-Length, Transfer-Encoding, Connection, Keep-Alive, Upgrade, TE or Trailer, and values can’t contain control characters such as CR, LF or NUL.
signing_secret has special update rules: omit it to keep the stored secret, send "" to remove it.
Dead-letter queue
Section titled “Dead-letter queue”| Parameter | Type | Default | Description |
|---|---|---|---|
dead_letter_queue |
string | none | Name of another queue that receives a copy of each task that runs out of retries. Can’t be the queue itself. |
See Dead-letter queues.
Queue name rules
Section titled “Queue name rules”Names are lowercase and made of one or more segments separated by /. Each segment matches [a-z0-9][a-z0-9-]* (starts with a letter or digit, then letters, digits and hyphens). The whole name is at most 200 characters. See Folders.
Update queue settings with PATCH
Section titled “Update queue settings with PATCH”PATCH /v1/queues/{queue} changes only the fields you send and leaves everything else alone. The merged result is validated before it is saved, so a PATCH can never leave a queue with invalid settings.
await pq.patchQueue("emails", { rateLimits: { maxDispatchesPerSecond: 2 } });pq.patch_queue("emails", rate_limits=RateLimits(max_dispatches_per_second=2))_, err := pq.PatchQueue(ctx, "emails", pushq.QueueConfig{ RateLimits: &pushq.RateLimits{MaxDispatchesPerSecond: pushq.Float64(2)},}, "") // last argument: new state, "" = unchangedpq.patchQueue("emails", QueuePatch.builder() .rateLimits(RateLimits.builder().maxDispatchesPerSecond(2).build()) .build());await pq.PatchQueueAsync("emails", new QueuePatch{ RateLimits = new RateLimits { MaxDispatchesPerSecond = 2 },});curl -X PATCH https://api.pushqueue.dev/v1/queues/emails \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -d '{"rate_limits": {"max_dispatches_per_second": 2}}'PATCH differs from PUT in these ways (Go’s PatchQueue only sends non-empty strings, so it can’t clear base_url, method, headers or dead_letter_queue; use the HTTP API for that, or ClearSigningSecret: true for the secret):
- It accepts a
statefield:running,pausedordisabled. target.headers, when sent, replaces the whole header map. Send{}to remove all queue headers.target.signing_secret: ""removes the secret,target.base_url: ""removes the base URL, anddead_letter_queue: ""removes the dead-letter queue.
Changes take effect for the next dispatch, including tasks already waiting in the queue. Use this when you want to adjust one setting at runtime, such as lowering a rate limit during an incident.
Queue states
Section titled “Queue states”| State | Accepts new tasks | Dispatches tasks | :run works |
|---|---|---|---|
running |
Yes | Yes | Yes |
paused |
Yes | No | Yes |
disabled |
No (400 failed_precondition) |
No | No (400 failed_precondition) |
In every state you can still read the queue, list its tasks, read stats, change its configuration and purge it.
Pausing or disabling a queue doesn’t interrupt requests already in flight; they finish normally. If one of them fails, its retry is scheduled and waits until the queue runs again.
Pause and resume a queue
Section titled “Pause and resume a queue”await pq.pauseQueue("emails");await pq.resumeQueue("emails");pq.pause_queue("emails")pq.resume_queue("emails")_, err := pq.PauseQueue(ctx, "emails")_, err = pq.ResumeQueue(ctx, "emails")pq.pauseQueue("emails");pq.resumeQueue("emails");await pq.PauseQueueAsync("emails");await pq.ResumeQueueAsync("emails");curl -X POST https://api.pushqueue.dev/v1/queues/emails:pause \ -H "Authorization: Bearer $PUSHQ_API_KEY"
curl -X POST https://api.pushqueue.dev/v1/queues/emails:resume \ -H "Authorization: Bearer $PUSHQ_API_KEY"Both return the queue. Pausing a disabled queue fails with 400 failed_precondition; :resume moves a queue from either paused or disabled back to running.
Use pause when the endpoint is down or misbehaving and you want tasks to pile up safely instead of using up their retries. Tasks whose time has passed are delivered as soon as you resume, within the queue’s rate limits.
Disable a queue
Section titled “Disable a queue”There is no :disable endpoint; set the state with PATCH:
await pq.patchQueue("emails", { state: "disabled" });pq.patch_queue("emails", state="disabled")_, err := pq.PatchQueue(ctx, "emails", pushq.QueueConfig{}, "disabled")pq.patchQueue("emails", QueuePatch.builder().state("disabled").build());await pq.PatchQueueAsync("emails", new QueuePatch { State = QueueState.Disabled });curl -X PATCH https://api.pushqueue.dev/v1/queues/emails \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -d '{"state": "disabled"}'Use this when producers must stop enqueuing to a queue, for example while you retire it. Re-enable it with :resume or a PATCH to running.
Purge all tasks from a queue
Section titled “Purge all tasks from a queue”POST /v1/queues/{queue}:purge deletes every task created up to now, in any state (pending, running, succeeded or failed). It answers 202 with the queue; purged_at shows the purge time.
await pq.purgeQueue("emails");pq.purge_queue("emails")_, err := pq.PurgeQueue(ctx, "emails")pq.purgeQueue("emails");await pq.PurgeQueueAsync("emails");curl -X POST https://api.pushqueue.dev/v1/queues/emails:purge \ -H "Authorization: Bearer $PUSHQ_API_KEY"How it behaves:
- The cut-off is exact: every task created before the purge disappears from the API immediately, and the rows are removed in the background.
- Tasks created after the purge are not affected, even within the same millisecond.
- Requests already in flight can still reach your endpoint, but their results are discarded and they are not retried.
- Task IDs of purged tasks can be reused right away, without waiting for the dedup window.
- The queue’s configuration and state are unchanged.
Use this to throw away a backlog you no longer want delivered, such as tasks built from bad data.
Delete a queue
Section titled “Delete a queue”DELETE /v1/queues/{queue} deletes the queue together with all of its tasks and their attempt history. It answers 204. The name can be reused immediately.
await pq.deleteQueue("emails");pq.delete_queue("emails")err := pq.DeleteQueue(ctx, "emails")pq.deleteQueue("emails");await pq.DeleteQueueAsync("emails");curl -X DELETE https://api.pushqueue.dev/v1/queues/emails \ -H "Authorization: Bearer $PUSHQ_API_KEY"Deleting needs more than write access: admin API keys and admin or member dashboard users can delete queues; writer API keys get 403 permission_denied. Requests already in flight may still reach your endpoint, but their results are discarded.
Get and list queues
Section titled “Get and list queues”GET /v1/queues/{queue} returns one queue. Any role can read a queue it knows by name.
GET /v1/queues lists queues in name order:
| Query parameter | Default | Description |
|---|---|---|
name_prefix |
none | Only queues whose name starts with this string, such as tenants/. |
page_size |
100 |
Results per page, up to 1000. |
page_token |
none | next_page_token from the previous page. |
let pageToken: string | undefined;do { const page = await pq.listQueues({ namePrefix: "tenants/", pageToken }); for (const q of page.items) console.log(q.name, q.state); pageToken = page.nextPageToken;} while (pageToken);page_token = Nonewhile True: page = pq.list_queues(name_prefix="tenants/", page_token=page_token) for q in page.items: print(q.name, q.state) page_token = page.next_page_token if not page_token: breaktoken := ""for { queues, next, err := pq.ListQueues(ctx, pushq.ListQueuesParams{NamePrefix: "tenants/", PageToken: token}) if err != nil { return err } for _, q := range queues { fmt.Println(q.Name, q.State) } if next == "" { break } token = next}String token = null;do { QueuePage page = pq.listQueues(ListQueuesParams.builder().namePrefix("tenants/").pageToken(token).build()); for (Queue q : page.getQueues()) System.out.println(q.getName() + " " + q.getState()); token = page.getNextPageToken();} while (token != null && !token.isEmpty());string? token = null;do{ var page = await pq.ListQueuesAsync(new ListQueuesOptions { NamePrefix = "tenants/", PageToken = token }); foreach (var q in page.Items) Console.WriteLine($"{q.Name} {q.State}"); token = page.NextPageToken;} while (token != null);curl "https://api.pushqueue.dev/v1/queues?name_prefix=tenants/" \ -H "Authorization: Bearer $PUSHQ_API_KEY"Listing needs list permission: admin API keys and every dashboard user have it, writer API keys don’t. Writer keys are meant for apps that work with queues they already know by name.
A queue response looks like this:
{ "name": "emails", "state": "running", "rate_limits": {"max_dispatches_per_second": 10, "max_burst_size": 10, "max_concurrent_dispatches": 5}, "retry": {"max_attempts": 5, "max_retry_duration_seconds": 0, "min_backoff_seconds": 1, "max_backoff_seconds": 300, "max_doublings": 16}, "target": {"base_url": "https://api.example.com", "has_signing_secret": false}, "created_at": "2026-11-28T10:00:00Z", "updated_at": "2026-11-28T10:00:00Z"}target.method, target.headers, dead_letter_queue and purged_at appear when set.
Queue folders
Section titled “Queue folders”A / in a queue name puts the queue in a folder: user/instagram is an instagram queue in a user folder, and folders can nest (user/tiktok/eu). Folders are only part of the name. They need no setup, have no settings of their own, and exist as long as some queue name uses them. Each queue in a folder is still independent, with its own limits and retry settings.
In API paths, the whole name is a single path segment, so encode / as %2F. The SDKs do this for you, so pass the name as is:
await pq.upsertQueue("user/instagram", { target: { baseUrl: "https://api.example.com" } });await pq.createTask("user/instagram", { path: "/hooks/post" });pq.upsert_queue("user/instagram", target=Target(base_url="https://api.example.com"))pq.create_task("user/instagram", path="/hooks/post")_, 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: "/hooks/post"})pq.upsertQueue("user/instagram", QueueConfig.builder() .target(Target.builder().baseUrl("https://api.example.com").build()) .build());pq.createTask("user/instagram", TaskCreate.builder().path("/hooks/post").build());await pq.UpsertQueueAsync("user/instagram", new QueueConfig{ Target = new Target { BaseUrl = "https://api.example.com" },});await pq.CreateTaskAsync("user/instagram", new TaskCreate { Path = "/hooks/post" });curl -X PUT https://api.pushqueue.dev/v1/queues/user%2Finstagram \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -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" \ -d '{"path": "/hooks/post"}'If you send the / unencoded, the API answers 404 with a hint to URL-encode the name. In query strings such as name_prefix=user/, no encoding is needed.
Use folders to group many related queues, such as one queue per customer under tenants/, and to list or monitor them together with name_prefix.
Queue stats and monitoring
Section titled “Queue stats and monitoring”GET /v1/queues/{queue}/stats returns live counts for a queue without listing its tasks. Add id_prefix to count only tasks whose ID starts with a prefix.
const stats = await pq.queueStats("emails", { idPrefix: "invoice-" });stats = pq.queue_stats("emails", id_prefix="invoice-")stats, err := pq.QueueStats(ctx, "emails", "invoice-")QueueStats stats = pq.queueStats("emails", "invoice-");var stats = await pq.GetQueueStatsAsync("emails", idPrefix: "invoice-");curl "https://api.pushqueue.dev/v1/queues/emails/stats?id_prefix=invoice-" \ -H "Authorization: Bearer $PUSHQ_API_KEY"{ "state": "running", "pending": 12, "running": 3, "succeeded": 4810, "failed": 2, "scheduled_future": 140, "oldest_due_at": "2026-11-28T10:00:00Z", "oldest_due_age_seconds": 4.2, "dispatched_last_1m": 95, "errors_last_1m": 1, "dispatched_last_1h": 5120, "errors_last_1h": 30}| Field | Description |
|---|---|
state |
The queue’s state: running, paused or disabled. |
pending |
Tasks that are due now or overdue and waiting to be dispatched, including retries whose time has come. |
running |
Tasks currently being delivered. |
succeeded |
Succeeded tasks still retained (24 hours by default on a self-hosted server). |
failed |
Failed tasks still retained (7 days by default on a self-hosted server). |
scheduled_future |
Pending tasks scheduled for later, including those waiting for a retry. |
oldest_due_at |
Schedule time of the oldest due task. Omitted when nothing is due. |
oldest_due_age_seconds |
How long that task has been waiting past its schedule time. A growing value means the queue is falling behind. |
dispatched_last_1m / dispatched_last_1h |
Delivery attempts started in the last minute / hour. |
errors_last_1m / errors_last_1h |
Of those attempts, how many did not get a 2xx response (non-2xx status, timeout or connection error). |
last_purge |
Time of the last purge. Omitted if the queue was never purged. |
Purged and deleted tasks are not counted. Use stats for dashboards and alerts: alert on oldest_due_age_seconds for lag and on errors_last_1m for a failing endpoint.
Read more
Section titled “Read more”- Tasks, scheduling and deduplication: what goes into a queue.
- Rate limits and concurrency: choose
rate_limitsvalues. - Retry backoff and max attempts: how the
retrysettings play out. - Per-tenant queues: one queue per customer with folders.
- Dead-letter queues: keep tasks that run out of retries.