REST API overview
Everything pushq does is available over a JSON HTTP API. The SDKs and the dashboard use the same API. This page covers the conventions every endpoint shares and lists all endpoints; each group links to its detailed reference.
Use the API directly when there’s no SDK for your language, from shell scripts, or to debug what an SDK sends.
- Interactive reference (Swagger UI): https://api.pushqueue.dev/docs
- OpenAPI document: https://api.pushqueue.dev/openapi.json
A self-hosted server serves the same two pages at /docs and /openapi.json, generated from its own routes. To get the document without running a server, use pushq openapi > openapi.json.
API base URL
Section titled “API base URL”| Server | Base URL |
|---|---|
| Hosted | https://api.pushqueue.dev |
| Self-hosted | Your server, e.g. http://localhost:8080 or https://pushq.example.com |
API endpoints live under /v1. Health, metrics and documentation endpoints (/healthz, /readyz, /metrics, /docs, /openapi.json) sit at the root.
Authenticate with an API key
Section titled “Authenticate with an API key”Send an API key as a bearer token:
curl https://api.pushqueue.dev/v1/queues/emails \ -H "Authorization: Bearer $PUSHQ_API_KEY"Keys look like pq_.... Create them in the dashboard under Settings → API keys, or, when self-hosting, in the server config. See API keys for roles and rotation.
A missing or unknown key returns 401 unauthenticated. A valid key whose role doesn’t allow the call returns 403 permission_denied.
The dashboard authenticates with a session cookie instead. Requests that change something with the cookie must also send X-Requested-With: pushq, which blocks cross-site request forgery. Requests with an Authorization header don’t need it.
A pushq dev server, or a fresh self-hosted server before its first admin account exists, accepts requests without a key.
Who can call what
Section titled “Who can call what”The endpoint tables use these access levels:
| Access | API keys | Dashboard users |
|---|---|---|
| Public | No credentials needed | |
| Read | admin, writer |
admin, member, viewer |
| Write | admin, writer |
admin, member |
| List | admin |
admin, member, viewer |
| Delete queue | admin |
admin, member |
| Manage | admin |
admin |
| Signed-in user | Not allowed (401) |
Any role, with a session cookie |
A writer key works with queues it knows by name: it can create, change, pause, resume and purge queues and enqueue, run and delete tasks, but it can’t list all queues or delete a queue.
Request and response format
Section titled “Request and response format”- Request and response bodies are JSON. Send
Content-Type: application/jsonwith a body. - Field names are
snake_case:rate_limits.max_dispatches_per_second,delay_seconds. The SDKs use their language’s casing. - Timestamps are RFC 3339 strings in UTC, e.g.
2026-12-01T17:00:00Z. - Durations are numbers of seconds and may be fractional:
"min_backoff_seconds": 0.1. - Operations that aren’t plain CRUD use a colon suffix on the resource, Google API style:
POST /v1/queues/emails:pause,POST /v1/queues/emails/tasks/welcome-user-42:run. - Deletes answer
204 No Content.:purgeanswers202 Accepted.
Request bodies have size limits: 256 KiB for queue bodies, 8 MiB for a batch, and for a single task twice limits.max_body_bytes plus 64 KiB (the body is base64-encoded inside the JSON). A larger request fails with 413 payload_too_large. The decoded task body itself must fit in limits.max_body_bytes (default 1 MiB).
URL-encode queue names
Section titled “URL-encode queue names”Queue names can contain / to form folders, such as user/instagram. In a URL path the whole name is one segment, so encode the slash as %2F:
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": "/hooks/post"}'An unencoded slash produces a different path and returns 404 not_found with a hint to encode it. Query parameters take the name as-is: GET /v1/queues?name_prefix=user/ lists the folder. The SDKs encode queue names for you. If you run a reverse proxy, make sure it doesn’t decode %2F; see reverse proxy setup.
Valid queue names are 1 to 200 characters of /-separated segments, each matching [a-z0-9][a-z0-9-]*. Task IDs match [A-Za-z0-9_-]{1,500}.
Paginate list results
Section titled “Paginate list results”GET /v1/queues and GET /v1/queues/{queue}/tasks return one page at a time:
| Query parameter | Description |
|---|---|
page_size |
Items per page. Default 100, maximum 1000 (larger values are capped). |
page_token |
The next_page_token from the previous response. |
The response holds the items (queues or tasks) and a next_page_token. When next_page_token is missing, you have the last page. Keep your other filters (state, id_prefix, name_prefix) the same while you page. A malformed token returns 400 failed_precondition.
let pageToken: string | undefined;do { const page = await pq.listTasks("emails", { state: "failed", pageSize: 500, pageToken }); for (const task of page.items) console.log(task.id); pageToken = page.nextPageToken;} while (pageToken);page_token = Nonewhile True: page = pq.list_tasks("emails", state="failed", page_size=500, page_token=page_token) for task in page.items: print(task.id) page_token = page.next_page_token if not page_token: breaktoken := ""for { tasks, next, err := pq.ListTasks(ctx, "emails", pushq.ListTasksParams{State: "failed", PageSize: 500, PageToken: token}) if err != nil { return err } for _, t := range tasks { fmt.Println(t.ID) } if next == "" { break } token = next}String token = null;do { TaskPage page = pq.listTasks("emails", ListTasksParams.builder() .state("failed").pageSize(500).pageToken(token).build()); for (Task task : page.getTasks()) System.out.println(task.getId()); token = page.getNextPageToken();} while (token != null && !token.isEmpty());string? token = null;do{ var page = await pq.ListTasksAsync("emails", new ListTasksOptions { State = TaskState.Failed, PageSize = 500, PageToken = token, }); foreach (var task in page.Items) Console.WriteLine(task.Id); token = page.NextPageToken;} while (!string.IsNullOrEmpty(token));token=""while :; do resp=$(curl -s "https://api.pushqueue.dev/v1/queues/emails/tasks?state=failed&page_size=500&page_token=$token" \ -H "Authorization: Bearer $PUSHQ_API_KEY") echo "$resp" | jq -r '.tasks[].id' token=$(echo "$resp" | jq -r '.next_page_token // empty') [ -z "$token" ] && breakdoneTasks are listed newest first.
Error responses
Section titled “Error responses”Every error is an RFC 9457 problem+json body with a stable machine-readable code:
{ "type": "about:blank", "title": "Not Found", "status": 404, "code": "not_found", "detail": "not found", "instance": "/v1/queues/emails"}Branch on code, not on detail. See API error codes for every code and how to handle it.
Idempotency and safe retries
Section titled “Idempotency and safe retries”There is no Idempotency-Key header. Instead:
- Queue upserts (
PUT /v1/queues/{queue}) are idempotent: send the same config as often as you like. The response answers201when it created the queue and200otherwise, with anX-Pushq-Resultheader ofcreated,updatedorunchanged. An upsert never changes whether the queue is running or paused. - Task creation is deduplicated by
task_id. If you retry an enqueue after a timeout or network error with the sametask_id, a409 already_existsmeans the first request went through. The ID stays reserved for the server’s dedup window (1 hour by default) after the task finishes or is deleted. Without atask_idthe server generates one, and a retried request can create a duplicate task. - Batch enqueue (
POST /v1/queues/{queue}/tasks:batch) is not atomic. It answers200with one result per task, in request order; each result holds either the createdtaskor anerrorwith acodeanddetail. Retry only the failed items, and give tasks IDs so retries are safe.
Retry requests that fail with 5xx or a network error, with backoff. Don’t retry 4xx errors without changing the request, except 429 rate_limited.
API endpoints
Section titled “API endpoints”Queue endpoints
Section titled “Queue endpoints”Details: Queues reference.
| Method | Path | Summary | Access |
|---|---|---|---|
POST |
/v1/queues |
Create a queue (fails with already_exists if the name is taken) |
Write |
PUT |
/v1/queues/{queue} |
Create or replace a queue’s configuration | Write |
GET |
/v1/queues/{queue} |
Get a queue | Read |
PATCH |
/v1/queues/{queue} |
Update some of a queue’s settings, including state |
Write |
DELETE |
/v1/queues/{queue} |
Delete a queue and all its tasks | Delete queue |
GET |
/v1/queues |
List queues (name_prefix, page_size, page_token) |
List |
POST |
/v1/queues/{queue}:pause |
Pause dispatching | Write |
POST |
/v1/queues/{queue}:resume |
Resume dispatching | Write |
POST |
/v1/queues/{queue}:purge |
Delete every task created up to now | Write |
GET |
/v1/queues/{queue}/stats |
Live queue statistics (id_prefix) |
Read |
Task endpoints
Section titled “Task endpoints”Details: Tasks reference.
| Method | Path | Summary | Access |
|---|---|---|---|
POST |
/v1/queues/{queue}/tasks |
Enqueue a task | Write |
POST |
/v1/queues/{queue}/tasks:batch |
Enqueue up to 500 tasks | Write |
GET |
/v1/queues/{queue}/tasks |
List tasks, newest first (state, id_prefix, view, page_size, page_token) |
Read |
GET |
/v1/queues/{queue}/tasks/{taskID} |
Get a task (view=full includes headers and body) |
Read |
DELETE |
/v1/queues/{queue}/tasks/{taskID} |
Delete a task | Write |
POST |
/v1/queues/{queue}/tasks/{taskID}:run |
Dispatch a task now, bypassing rate limits and the paused state | Write |
GET |
/v1/queues/{queue}/tasks/{taskID}/attempts |
A task’s delivery attempts, newest first | Read |
API key endpoints
Section titled “API key endpoints”Details: API keys reference.
| Method | Path | Summary | Access |
|---|---|---|---|
GET |
/v1/api-keys |
List API keys | Manage |
POST |
/v1/api-keys |
Create an API key (the secret is returned once) | Manage |
DELETE |
/v1/api-keys/{id} |
Revoke an API key | Manage |
Team and user endpoints
Section titled “Team and user endpoints”Details: Teams and users reference. Endpoints marked SaaS exist only on servers in SaaS mode, including the hosted service; those marked self-hosted exist only without it.
| Method | Path | Summary | Access |
|---|---|---|---|
PATCH |
/v1/me |
Change your name | Signed-in user |
POST |
/v1/me/password |
Change your password (self-hosted) | Signed-in user |
GET |
/v1/teams |
Your teams (SaaS) | Signed-in user |
POST |
/v1/teams |
Create a team (SaaS) | Signed-in user |
POST |
/v1/teams/{id}:switch |
Switch your session to another of your teams (SaaS) | Signed-in user |
PATCH |
/v1/teams/current |
Rename the current team (SaaS) | Manage |
GET |
/v1/users |
List members | Manage |
PATCH |
/v1/users/{id} |
Change a member’s role | Manage |
DELETE |
/v1/users/{id} |
Remove a member | Manage |
POST |
/v1/users/{id}/reset-link |
Create a password-reset link (self-hosted) | Manage |
GET |
/v1/invites |
Pending invites | Manage |
POST |
/v1/invites |
Invite someone | Manage |
DELETE |
/v1/invites/{id} |
Revoke an invite | Manage |
Sign-in endpoints
Section titled “Sign-in endpoints”Details: Sign-in reference. These endpoints power the dashboard’s sign-in pages. You don’t need them to use queues and tasks.
| Method | Path | Summary | Access |
|---|---|---|---|
GET |
/v1/auth/session |
Who am I, and how does this server sign people in? | Public |
POST |
/v1/auth/setup |
Create the first admin account (self-hosted) | Public |
POST |
/v1/auth/login |
Sign in with email and password (self-hosted) | Public |
POST |
/v1/auth/logout |
Sign out | Public |
GET |
/v1/auth/invites/{token} |
Look up an invite or password-reset link (self-hosted) | Public |
POST |
/v1/auth/invites/{token}:accept |
Accept an invite or reset link (self-hosted) | Public |
POST |
/v1/auth/email-code |
Email a 6-digit sign-in code (SaaS) | Public |
POST |
/v1/auth/email-code:verify |
Sign in with the emailed code (SaaS) | Public |
GET |
/v1/auth/email-verification |
Is a sign-in waiting for an email verification code? (SaaS) | Public |
POST |
/v1/auth/email-verification |
Finish a sign-in with the emailed verification code (SaaS) | Public |
GET |
/v1/auth/workos/login |
Start signing in with GitHub (SaaS) | Public |
GET |
/v1/auth/workos/callback |
Where GitHub sign-in returns (SaaS) | Public |
System endpoints
Section titled “System endpoints”Details: System reference.
| Method | Path | Summary | Access |
|---|---|---|---|
GET |
/healthz |
Liveness check (ok) |
Public |
GET |
/readyz |
Readiness check; reports the dispatcher role | Public |
GET |
/metrics |
Prometheus metrics | Public by default; otherwise List (in SaaS mode, only the operator’s config-file keys) |
GET |
/openapi.json |
The OpenAPI document | Public |
GET |
/docs |
Interactive API docs (Swagger UI) | Public |
GET |
/v1/version |
Server version, commit and database dialect | Read |
Read more
Section titled “Read more”- API error codes: every
codeand how to handle it. - Install & configure an SDK: typed clients for TypeScript, Python, Go, Java and .NET.
- API keys: create, scope and revoke keys.
- Queues and tasks: what the fields mean.