Tasks API reference
The Tasks API is how you put work on a pushq queue and follow it through delivery. A task is one HTTP request that pushq will send to your endpoint, on time, at the queue’s rate, with retries. This page documents every task endpoint: enqueue a task, enqueue tasks in bulk, list and get tasks, run a task now, delete a task, and list its delivery attempts.
const task = await pq.createTask("emails", { taskId: "welcome-user-42", path: "/hooks/send-welcome", jsonBody: { user_id: 42 }, delaySeconds: 3600,});task = pq.create_task( "emails", task_id="welcome-user-42", path="/hooks/send-welcome", json_body={"user_id": 42}, delay_seconds=3600,)task, err := pq.CreateTask(ctx, "emails", pushq.TaskCreate{ TaskID: "welcome-user-42", Path: "/hooks/send-welcome", JSONBody: map[string]any{"user_id": 42}, DelaySeconds: pushq.Float64(3600),})Task task = pq.createTask("emails", TaskCreate.builder() .taskId("welcome-user-42") .path("/hooks/send-welcome") .jsonBody(Map.of("user_id", 42)) .delaySeconds(3600) .build());PushqTask task = await pq.CreateTaskAsync("emails", new TaskCreate{ TaskId = "welcome-user-42", Path = "/hooks/send-welcome", JsonBody = new { user_id = 42 }, Delay = TimeSpan.FromHours(1),});curl -X POST https://api.pushqueue.dev/v1/queues/emails/tasks \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -H "Content-Type: application/json" \ -d '{"task_id":"welcome-user-42","path":"/hooks/send-welcome","json_body":{"user_id":42},"delay_seconds":3600}'The examples assume an SDK client named pq (and, in Go, a ctx), created as shown in install and configure an SDK. They use the hosted API at https://api.pushqueue.dev; self-hosted servers expose the same endpoints at their own URL. Parameter tables use the JSON field names (dispatch_deadline_seconds); the SDKs use their language’s casing for the same fields: camelCase in TypeScript and Java (dispatchDeadlineSeconds), snake_case in Python, PascalCase in Go and .NET.
Task API permissions
Section titled “Task API permissions”| Endpoint | Writer API key | Admin API key | Dashboard roles |
|---|---|---|---|
| Enqueue, batch enqueue, run, delete | yes | yes | member, admin |
| List, get, list attempts | yes | yes | viewer, member, admin |
A request without valid credentials gets 401 unauthenticated; a key or role without the permission gets 403 permission_denied.
The task object
Section titled “The task object”Every endpoint that returns a task uses this shape.
{ "id": "welcome-user-42", "queue": "emails", "state": "pending", "url": "/hooks/send-welcome", "method": "POST", "headers": { "Content-Type": "application/json" }, "body_base64": "eyJ1c2VyX2lkIjo0Mn0=", "schedule_time": "2026-11-28T11:15:00.12Z", "created_at": "2026-11-28T10:15:00.12Z", "dispatch_deadline_seconds": 600, "retry": { "max_attempts": 3 }, "dispatch_count": 1, "response_count": 1, "first_attempt_at": "2026-11-28T11:15:00.304Z", "last_attempt": { "at": "2026-11-28T11:15:00.304Z", "status": 503, "error": "non_2xx: upstream unavailable" }}| Field | Type | Description |
|---|---|---|
id |
string | Task ID: the task_id you sent, or a server-generated UUIDv7. |
queue |
string | Queue name. |
state |
string | pending (waiting for its time or a dispatch slot, including between retries), running (being delivered now), succeeded (got a 2xx) or failed (retries exhausted, or a task whose own headers can never be sent). |
url |
string | The absolute url, or the path as sent (resolved against the queue’s target.base_url at dispatch). |
method |
string | HTTP method stored on the task. A queue-level target.method overrides it at dispatch. |
headers |
object | Task headers. Only in the full view (and in create responses); omitted when empty. |
body_base64 |
string | Request body, base64-encoded. Only in the full view (and in create responses); omitted when empty. |
schedule_time |
string (RFC 3339) | When the task is (or was) due. Moves forward on each retry, and to “now” on a force-run. |
created_at |
string (RFC 3339) | When the task was created. |
dispatch_deadline_seconds |
number | How long pushq waits for a response on each attempt. |
retry |
object | The per-task retry override you sent (only the fields you set), not the effective policy. Omitted when there is none. Fields as in retry fields. |
dispatch_count |
integer | Attempts started so far. |
response_count |
integer | Attempts that got an HTTP response (any status). |
first_attempt_at |
string (RFC 3339) | When the first attempt started. Omitted before the first attempt. |
finished_at |
string (RFC 3339) | When the task succeeded or failed for good. Omitted while it is pending or running. |
last_attempt.at |
string (RFC 3339) | When the latest attempt started. last_attempt is omitted before the first attempt. |
last_attempt.status |
integer | HTTP status of the latest attempt. Omitted when no response arrived. |
last_attempt.error |
string | Error kind of the latest attempt, followed by up to 512 characters of detail (non_2xx: <response body>). Omitted on success. |
Enqueue a task
Section titled “Enqueue a task”POST /v1/queues/{queue}/tasks
Creates one task. pushq will send it as an HTTP request to url (or the queue’s target.base_url + path) at schedule_time, within the queue’s rate limits, and retry it on failure according to the queue’s retry policy merged with any per-task retry override. Use this for every unit of background work: send an email, call a webhook, run a job later.
Give the task a task_id when the same work might be enqueued twice (a retried request, a duplicate event): a second enqueue with the same ID in the same queue fails with 409 already_exists instead of creating a duplicate. That makes task_id your idempotency key. See deduplicate tasks with task IDs.
Tasks can be added to a paused queue (they wait until it’s resumed) but not to a disabled one.
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). The queue must exist. |
Request body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
task_id |
string | no | server-generated UUIDv7 | Your ID for the task, [A-Za-z0-9_-], 1–500 characters. Deduplicates within the queue (see below). |
url |
string | one of url/path |
— | Absolute http or https URL to call, at most 2083 characters. |
path |
string | one of url/path |
— | Path starting with /, appended to the queue’s target.base_url at dispatch time. The queue must have a target.base_url. |
method |
string | no | POST |
GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS (case-insensitive). |
headers |
object (string → string) | no | none | Request headers. Names and values must be valid HTTP; Host, Content-Length, Transfer-Encoding, Connection, Keep-Alive, Upgrade, TE and Trailer are reserved. Total size at most 16 KiB (self-hosted default). Queue target.headers override these at dispatch. |
json_body |
any JSON value | no | none | Body to send as JSON. Sets Content-Type: application/json unless you set a Content-Type header. Can’t be combined with body_base64. |
body_base64 |
string | no | none | Raw body, standard base64. Without a Content-Type header it is sent as application/octet-stream. Can’t be combined with json_body. |
schedule_time |
string (RFC 3339) | no | now | When to send it. A time in the past means “now”. At most 1 year ahead (self-hosted default). Can’t be combined with delay_seconds. |
delay_seconds |
number | no | 0 |
Send it this many seconds from now. At least 0; also limited by the 1-year schedule-ahead limit. |
dispatch_deadline_seconds |
number | no | 600 |
How long to wait for a response on each attempt before it counts as a timeout. 15–1800. |
retry |
object | no | queue’s policy | Per-task override of the queue’s retry policy; set only the fields you want to change. |
retry.max_attempts |
integer | no | queue’s | -1 (unlimited) or at least 1, including the first attempt. |
retry.max_retry_duration_seconds |
number | no | queue’s | At least 0; 0 = unlimited. Measured from the first attempt. |
retry.min_backoff_seconds |
number | no | queue’s | At least 0. |
retry.max_backoff_seconds |
number | no | queue’s | At least min_backoff_seconds. |
retry.max_doublings |
integer | no | queue’s | 0–31. |
A body (json_body or body_base64) is only allowed with POST, PUT or PATCH, and may be at most 1 MiB once decoded (self-hosted default). The JSON request itself may be at most twice that plus 64 KiB. Per-task retry values are checked against the server’s default retry policy when the task is created; the queue’s policy fills in the fields you leave out when the task runs. See retry backoff and max attempts.
How long a task ID stays taken. A task_id is reserved in its queue for as long as a task with that ID is stored: while it is pending or running, after it finishes until retention cleanup removes it (self-hosted defaults: 24 hours after success, 7 days after failure), and for the dedup window after you delete a task (self-hosted default: 1 hour). Purging the queue frees all IDs immediately. Limits on the hosted service may differ from these self-hosted defaults.
Example
The example at the top of this page enqueues a JSON task with a delay. This one calls an absolute URL with a raw body at a fixed time:
const task = await pq.createTask("emails", { url: "https://api.example.com/hooks/digest", method: "PUT", headers: { "Content-Type": "text/plain" }, body: "weekly digest for user 42", // string or Uint8Array; the SDK base64-encodes it scheduleTime: new Date("2026-12-01T09:00:00Z"), dispatchDeadlineSeconds: 120, retry: { maxAttempts: 3 },});from datetime import datetime, timezonefrom pushq import Retry
task = pq.create_task( "emails", url="https://api.example.com/hooks/digest", method="PUT", headers={"Content-Type": "text/plain"}, body=b"weekly digest for user 42", # raw bytes; the SDK base64-encodes them schedule_time=datetime(2026, 12, 1, 9, 0, tzinfo=timezone.utc), dispatch_deadline_seconds=120, retry=Retry(max_attempts=3),)at := time.Date(2026, 12, 1, 9, 0, 0, 0, time.UTC)task, err := pq.CreateTask(ctx, "emails", pushq.TaskCreate{ URL: "https://api.example.com/hooks/digest", Method: "PUT", Headers: map[string]string{"Content-Type": "text/plain"}, Body: []byte("weekly digest for user 42"), // the SDK base64-encodes it ScheduleTime: &at, DispatchDeadlineSeconds: pushq.Float64(120), Retry: &pushq.Retry{MaxAttempts: pushq.Int(3)},})Task task = pq.createTask("emails", TaskCreate.builder() .url("https://api.example.com/hooks/digest") .method("PUT") .header("Content-Type", "text/plain") .body("weekly digest for user 42".getBytes(StandardCharsets.UTF_8)) // the SDK base64-encodes it .scheduleTime(Instant.parse("2026-12-01T09:00:00Z")) .dispatchDeadlineSeconds(120) .retry(RetryConfig.builder().maxAttempts(3).build()) .build());PushqTask task = await pq.CreateTaskAsync("emails", new TaskCreate{ Url = "https://api.example.com/hooks/digest", Method = "PUT", Headers = new Dictionary<string, string> { ["Content-Type"] = "text/plain" }, Body = Encoding.UTF8.GetBytes("weekly digest for user 42"), // the SDK base64-encodes it ScheduleTime = new DateTimeOffset(2026, 12, 1, 9, 0, 0, TimeSpan.Zero), DispatchDeadline = TimeSpan.FromSeconds(120), Retry = new RetryConfig { MaxAttempts = 3 },});curl -X POST https://api.pushqueue.dev/v1/queues/emails/tasks \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://api.example.com/hooks/digest", "method": "PUT", "headers": { "Content-Type": "text/plain" }, "body_base64": "d2Vla2x5IGRpZ2VzdCBmb3IgdXNlciA0Mg==", "schedule_time": "2026-12-01T09:00:00Z", "dispatch_deadline_seconds": 120, "retry": { "max_attempts": 3 } }'The SDKs take the raw body and do the base64 encoding for you. In .NET, delay_seconds and dispatch_deadline_seconds are TimeSpan properties named Delay and DispatchDeadline, and the task type is PushqTask (to avoid clashing with System.Threading.Tasks.Task). In Python, a naive datetime for schedule_time is treated as UTC. Some SDKs catch conflicting fields before sending: the Java builder rejects url with path, a body with json_body, and schedule_time with delay_seconds; .NET rejects the last two; TypeScript and Python reject a body with json_body. Everything else is validated by the server.
Response
201 Created with the task object. The create response always includes headers and body_base64 when set:
{ "id": "0193b6f2-7c1e-7a3d-9f4e-2b8c5d1a6e90", "queue": "emails", "state": "pending", "url": "https://api.example.com/hooks/digest", "method": "PUT", "headers": { "Content-Type": "text/plain" }, "body_base64": "d2Vla2x5IGRpZ2VzdCBmb3IgdXNlciA0Mg==", "schedule_time": "2026-12-01T09:00:00Z", "created_at": "2026-11-28T10:15:00.12Z", "dispatch_deadline_seconds": 120, "retry": { "max_attempts": 3 }, "dispatch_count": 0, "response_count": 0}Field descriptions are in the task object.
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_argument |
Invalid JSON; bad task_id; both or neither of url/path; invalid URL; path not starting with /; method not allowed; invalid or reserved header; headers or body too large; invalid base64; body with a method that doesn’t allow one; both schedule_time and delay_seconds; schedule too far ahead; dispatch_deadline_seconds outside 15–1800; invalid retry values. |
| 400 | failed_precondition |
The task uses path but the queue has no target.base_url, or the queue is disabled. |
| 401 | unauthenticated |
No valid credentials. |
| 403 | permission_denied |
The key or role can’t write. |
| 404 | not_found |
The queue doesn’t exist. |
| 409 | already_exists |
A task with this task_id is already stored in the queue. |
| 413 | payload_too_large |
The request body is over the size limit. |
See API error codes for the error format.
Enqueue tasks in bulk (batch)
Section titled “Enqueue tasks in bulk (batch)”POST /v1/queues/{queue}/tasks:batch
Creates up to 500 tasks in one request. Use it for fan-out (one task per user, per row, per webhook subscriber) to cut round trips. The batch is not atomic: each item succeeds or fails on its own, and the response lists a result per item in request order. A duplicate task_id, including one repeated inside the same batch, fails only that item with already_exists. See bulk enqueue.
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). The queue must exist. |
Request body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
tasks |
array | yes | — | 1–500 task definitions. |
tasks[].* |
object | — | — | Each item takes exactly the fields of Enqueue a task: task_id, url, path, method, headers, json_body, body_base64, schedule_time, delay_seconds, dispatch_deadline_seconds, retry.*. |
The whole request may be at most 8 MiB.
Example
const results = await pq.createTasks("emails", [ { taskId: "welcome-user-42", path: "/hooks/send-welcome", jsonBody: { user_id: 42 } }, { taskId: "welcome-user-43", path: "/hooks/send-welcome", jsonBody: { user_id: 43 } },]);for (const r of results) { if (r.error) console.warn(`#${r.index}: ${r.error.code} ${r.error.detail}`); else console.log(`#${r.index}: created ${r.task!.id}`);}results = pq.create_tasks("emails", [ {"task_id": "welcome-user-42", "path": "/hooks/send-welcome", "json_body": {"user_id": 42}}, {"task_id": "welcome-user-43", "path": "/hooks/send-welcome", "json_body": {"user_id": 43}},])for r in results: if r.error: print(r.index, r.error.code, r.error.detail) else: print(r.index, r.task.id)results, err := pq.CreateTasks(ctx, "emails", []pushq.TaskCreate{ {TaskID: "welcome-user-42", Path: "/hooks/send-welcome", JSONBody: map[string]any{"user_id": 42}}, {TaskID: "welcome-user-43", Path: "/hooks/send-welcome", JSONBody: map[string]any{"user_id": 43}},})if err != nil { return err // the whole request failed}for _, r := range results { if r.Error != nil { log.Printf("item %d: %s: %s", r.Index, r.Error.Code, r.Error.Detail) continue } fmt.Println("created", r.Task.ID)}List<BatchResult> results = pq.createTasks("emails", List.of( TaskCreate.builder().taskId("welcome-user-42").path("/hooks/send-welcome") .jsonBody(Map.of("user_id", 42)).build(), TaskCreate.builder().taskId("welcome-user-43").path("/hooks/send-welcome") .jsonBody(Map.of("user_id", 43)).build()));
for (BatchResult r : results) { if (r.isSuccess()) { System.out.println(r.getIndex() + " -> " + r.getTask().getId()); } else { System.err.println(r.getIndex() + " failed: " + r.getError().getCode() + " " + r.getError().getDetail()); }}IReadOnlyList<BatchResult> results = await pq.CreateTasksAsync("emails", new[]{ new TaskCreate { TaskId = "welcome-user-42", Path = "/hooks/send-welcome", JsonBody = new { user_id = 42 } }, new TaskCreate { TaskId = "welcome-user-43", Path = "/hooks/send-welcome", JsonBody = new { user_id = 43 } },});foreach (var r in results){ if (r.Error != null) Console.WriteLine($"#{r.Index} failed: {r.Error.Code} {r.Error.Detail}"); else Console.WriteLine($"#{r.Index} -> {r.Task!.Id}");}curl -X POST https://api.pushqueue.dev/v1/queues/emails/tasks:batch \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "tasks": [ { "task_id": "welcome-user-42", "path": "/hooks/send-welcome", "json_body": { "user_id": 42 } }, { "task_id": "welcome-user-43", "path": "/hooks/send-welcome", "json_body": { "user_id": 43 } } ] }'The SDK method is createTasks / create_tasks / CreateTasks / CreateTasksAsync and returns the results array directly. In Python each item is a dict using create_task’s keyword names; unknown keys are silently ignored.
Response
200 OK, even when some items failed:
{ "results": [ { "index": 0, "task": { "id": "welcome-user-42", "queue": "emails", "state": "pending", "url": "/hooks/send-welcome", "method": "POST", "headers": { "Content-Type": "application/json" }, "body_base64": "eyJ1c2VyX2lkIjo0Mn0=", "schedule_time": "2026-11-28T10:15:00.12Z", "created_at": "2026-11-28T10:15:00.12Z", "dispatch_deadline_seconds": 600, "dispatch_count": 0, "response_count": 0 } }, { "index": 1, "error": { "code": "already_exists", "detail": "already exists" } } ]}| Field | Type | Description |
|---|---|---|
results |
array | One entry per input task, in request order. |
results[].index |
integer | Position of the task in the request (0-based). |
results[].task |
task object | The created task. Present only on success. |
results[].error.code |
string | Present only on failure: invalid_argument, already_exists, not_found, failed_precondition or internal. |
results[].error.detail |
string | Human-readable reason for the failure. |
Errors
These fail the whole request; per-item failures are reported in results instead.
| Status | Code | When |
|---|---|---|
| 400 | invalid_argument |
Invalid JSON, tasks empty, or more than 500 tasks. |
| 401 | unauthenticated |
No valid credentials. |
| 403 | permission_denied |
The key or role can’t write. |
| 404 | not_found |
The queue doesn’t exist. |
| 413 | payload_too_large |
Request body over 8 MiB. |
List tasks
Section titled “List tasks”GET /v1/queues/{queue}/tasks
Lists a queue’s tasks, newest first, one page at a time. Filter by state to find failed tasks to inspect or retry, or by id_prefix to find a group of related tasks (for example everything for one user if your IDs start with the user ID). Deleted and purged tasks are not listed; finished tasks are listed until retention cleanup removes them.
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 |
|---|---|---|---|---|
state |
string | no | all | pending, running, succeeded or failed. |
id_prefix |
string | no | none | Only tasks whose ID starts with this. |
view |
string | no | basic |
basic omits headers and body_base64; full includes them. |
page_size |
integer | no | 100 |
Tasks 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
const page = await pq.listTasks("emails", { state: "failed", idPrefix: "welcome-", pageSize: 50 });for (const t of page.items) console.log(t.id, t.lastAttempt?.status, t.lastAttempt?.error);// page.nextPageToken -> pass as pageToken for the next pagepage = pq.list_tasks("emails", state="failed", id_prefix="welcome-", page_size=50)for t in page.items: print(t.id, t.last_attempt.status if t.last_attempt else None)# page.next_page_token -> pass as page_token for the next pagetasks, next, err := pq.ListTasks(ctx, "emails", pushq.ListTasksParams{ State: "failed", IDPrefix: "welcome-", PageSize: 50,})// pass next as PageToken for the next page ("" on the last page)TaskPage page = pq.listTasks("emails", ListTasksParams.builder() .state("failed") .idPrefix("welcome-") .pageSize(50) .build());page.getTasks().forEach(t -> System.out.println(t.getId() + " " + t.getState()));// page.getNextPageToken() -> pageToken(...) for the next pagePage<PushqTask> page = await pq.ListTasksAsync("emails", new ListTasksOptions{ State = TaskState.Failed, IdPrefix = "welcome-", PageSize = 50,});// page.NextPageToken -> ListTasksOptions.PageToken for the next pagecurl "https://api.pushqueue.dev/v1/queues/emails/tasks?state=failed&id_prefix=welcome-&page_size=50" \ -H "Authorization: Bearer $PUSHQ_API_KEY"Response
200 OK:
{ "tasks": [ { "id": "welcome-user-43", "queue": "emails", "state": "failed", "url": "/hooks/send-welcome", "method": "POST", "schedule_time": "2026-11-28T10:42:51.004Z", "created_at": "2026-11-28T10:15:00.12Z", "dispatch_deadline_seconds": 600, "retry": { "max_attempts": 3 }, "dispatch_count": 3, "response_count": 3, "first_attempt_at": "2026-11-28T10:15:00.31Z", "finished_at": "2026-11-28T10:42:51.88Z", "last_attempt": { "at": "2026-11-28T10:42:51.004Z", "status": 500, "error": "non_2xx: template not found" } } ], "next_page_token": "MTI4Nzc"}| Field | Type | Description |
|---|---|---|
tasks |
array of task objects | This page, newest first. Empty array when nothing matches. |
next_page_token |
string | Pass as page_token to get the next page. Omitted on the last page. |
The SDKs return a page object: items / nextPageToken in TypeScript, items / next_page_token in Python, getTasks() / getNextPageToken() in Java, Items / NextPageToken in .NET; Go returns the slice and the next token separately.
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_argument |
Unknown state, or page_size not an integer. |
| 400 | failed_precondition |
page_token is malformed. |
| 401 | unauthenticated |
No valid credentials. |
| 403 | permission_denied |
The caller has no read permission. |
| 404 | not_found |
The queue doesn’t exist. |
Get a task
Section titled “Get a task”GET /v1/queues/{queue}/tasks/{taskID}
Returns one task’s current state, schedule and last attempt. Use it to check whether a specific job ran, or (with view=full) to see exactly what will be sent. Deleted and purged tasks return 404.
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). |
taskID |
string | yes | — | The task’s ID. |
Query parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
view |
string | no | basic |
basic omits headers and body_base64; full includes them. |
Example
const task = await pq.getTask("emails", "welcome-user-42");const full = await pq.getTask("emails", "welcome-user-42", { view: "full" });const body = full.body ? new TextDecoder().decode(full.body) : undefined; // Uint8Arraytask = pq.get_task("emails", "welcome-user-42")full = pq.get_task("emails", "welcome-user-42", view="full")print(full.headers, full.body) # body is decoded bytestask, err := pq.GetTask(ctx, "emails", "welcome-user-42")full, err := pq.GetTaskFull(ctx, "emails", "welcome-user-42") // includes headers + bodybody, _ := base64.StdEncoding.DecodeString(full.BodyBase64)Task task = pq.getTask("emails", "welcome-user-42");Task full = pq.getTaskFull("emails", "welcome-user-42"); // includes headers + bodybyte[] body = full.getBodyBase64() == null ? new byte[0] : Base64.getDecoder().decode(full.getBodyBase64());PushqTask task = await pq.GetTaskAsync("emails", "welcome-user-42");PushqTask full = await pq.GetTaskAsync("emails", "welcome-user-42", TaskView.Full);string? bodyText = full.Body == null ? null : Encoding.UTF8.GetString(full.Body);curl "https://api.pushqueue.dev/v1/queues/emails/tasks/welcome-user-42?view=full" \ -H "Authorization: Bearer $PUSHQ_API_KEY"Go and Java get the full view from a separate method (GetTaskFull, getTaskFull) and return the body as the base64 string; TypeScript, Python and .NET decode it into bytes for you.
Response
200 OK with the task object (here with view=full):
{ "id": "welcome-user-42", "queue": "emails", "state": "succeeded", "url": "/hooks/send-welcome", "method": "POST", "headers": { "Content-Type": "application/json" }, "body_base64": "eyJ1c2VyX2lkIjo0Mn0=", "schedule_time": "2026-11-28T11:15:00.12Z", "created_at": "2026-11-28T10:15:00.12Z", "dispatch_deadline_seconds": 600, "dispatch_count": 1, "response_count": 1, "first_attempt_at": "2026-11-28T11:15:00.304Z", "finished_at": "2026-11-28T11:15:00.511Z", "last_attempt": { "at": "2026-11-28T11:15:00.304Z", "status": 200 }}Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated |
No valid credentials. |
| 403 | permission_denied |
The caller has no read permission. |
| 404 | not_found |
No such task (or it was deleted or purged), or no such queue. |
Delete a task
Section titled “Delete a task”DELETE /v1/queues/{queue}/tasks/{taskID}
Cancels a task. A pending task will never be sent; if it is being delivered right now, the delivery’s result is discarded. You can also delete finished tasks. Use it to cancel scheduled work that is no longer needed, such as a reminder for an order that was already paid. The task ID stays reserved for the dedup window (1 hour by default on self-hosted servers), so re-enqueueing the same ID right away fails with already_exists. See schedule and cancel tasks.
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). |
taskID |
string | yes | — | The task’s ID. |
Example
await pq.deleteTask("emails", "welcome-user-42");pq.delete_task("emails", "welcome-user-42")err := pq.DeleteTask(ctx, "emails", "welcome-user-42")pq.deleteTask("emails", "welcome-user-42");await pq.DeleteTaskAsync("emails", "welcome-user-42");curl -X DELETE https://api.pushqueue.dev/v1/queues/emails/tasks/welcome-user-42 \ -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 |
The key or role can’t write. |
| 404 | not_found |
No such task (or already deleted or purged), or no such queue. |
Run a task now
Section titled “Run a task now”POST /v1/queues/{queue}/tasks/{taskID}:run
Dispatches a pending task immediately: its schedule_time is set to now and it is sent right away, ignoring the queue’s rate limits and its paused state. Use it to test a delivery, to skip the wait on a delayed or backing-off task, or to push one urgent task through a paused queue. Only pending tasks can be run.
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). |
taskID |
string | yes | — | The task’s ID. |
No request body.
Example
const task = await pq.runTask("emails", "welcome-user-42");task = pq.run_task("emails", "welcome-user-42")task, err := pq.RunTask(ctx, "emails", "welcome-user-42")Task task = pq.runTask("emails", "welcome-user-42");PushqTask task = await pq.RunTaskAsync("emails", "welcome-user-42");curl -X POST https://api.pushqueue.dev/v1/queues/emails/tasks/welcome-user-42:run \ -H "Authorization: Bearer $PUSHQ_API_KEY"Response
200 OK with the task object in the full view, still pending with schedule_time set to now (the dispatch happens right after the response):
{ "id": "welcome-user-42", "queue": "emails", "state": "pending", "url": "/hooks/send-welcome", "method": "POST", "headers": { "Content-Type": "application/json" }, "body_base64": "eyJ1c2VyX2lkIjo0Mn0=", "schedule_time": "2026-11-28T10:20:31.007Z", "created_at": "2026-11-28T10:15:00.12Z", "dispatch_deadline_seconds": 600, "dispatch_count": 0, "response_count": 0}Errors
| Status | Code | When |
|---|---|---|
| 400 | failed_precondition |
The task is being delivered right now, or the queue is disabled. |
| 401 | unauthenticated |
No valid credentials. |
| 403 | permission_denied |
The key or role can’t write. |
| 404 | not_found |
No such task or queue, or the task already succeeded, failed, was deleted or was purged. |
List a task’s delivery attempts
Section titled “List a task’s delivery attempts”GET /v1/queues/{queue}/tasks/{taskID}/attempts
Returns the task’s delivery attempts, newest first (up to the 1000 most recent), with the status code, error kind, a snippet of the response body and the duration of each. Use it to debug why a task is failing or retrying. Attempts are kept as long as the task is.
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). |
taskID |
string | yes | — | The task’s ID. |
Example
const attempts = await pq.listAttempts("emails", "welcome-user-42");for (const a of attempts) console.log(a.number, a.responseStatus ?? a.errorKind, a.durationMs);for a in pq.list_attempts("emails", "welcome-user-42"): print(a.number, a.response_status, a.error_kind, a.duration_ms)attempts, err := pq.ListAttempts(ctx, "emails", "welcome-user-42")for _, a := range attempts { fmt.Println(a.Number, a.ResponseStatus, a.ErrorKind, a.DurationMS)}List<Attempt> attempts = pq.listAttempts("emails", "welcome-user-42");for (Attempt a : attempts) { System.out.printf("#%d status=%s kind=%s %dms%n", a.getNumber(), a.getResponseStatus(), a.getErrorKind(), a.getDurationMs());}IReadOnlyList<Attempt> attempts = await pq.ListAttemptsAsync("emails", "welcome-user-42");foreach (var a in attempts) Console.WriteLine($"#{a.Number} {a.ResponseStatus?.ToString() ?? a.ErrorKind} {a.DurationMs}ms");curl https://api.pushqueue.dev/v1/queues/emails/tasks/welcome-user-42/attempts \ -H "Authorization: Bearer $PUSHQ_API_KEY"The SDKs return the list of attempts directly (no page object).
Response
200 OK:
{ "attempts": [ { "number": 2, "dispatch_time": "2026-11-28T11:15:02.41Z", "response_time": "2026-11-28T11:15:02.598Z", "response_status": 200, "duration_ms": 188 }, { "number": 1, "dispatch_time": "2026-11-28T11:15:00.304Z", "response_time": "2026-11-28T11:15:00.511Z", "response_status": 503, "error_kind": "non_2xx", "error_snippet": "upstream unavailable", "duration_ms": 207 } ]}| Field | Type | Description |
|---|---|---|
attempts |
array | Attempts, newest first. Empty array before the first attempt. |
attempts[].number |
integer | Attempt number, starting at 1. |
attempts[].dispatch_time |
string (RFC 3339) | When the request was sent. |
attempts[].response_time |
string (RFC 3339) | When the response arrived. Omitted when there was no response. |
attempts[].response_status |
integer | HTTP status code. Omitted when there was no response. |
attempts[].error_kind |
string | Why the attempt failed: non_2xx, timeout, connect, dns, tls, config (the request couldn’t be built, e.g. relative path with no target.base_url) or lease_lost (the worker stopped mid-delivery). Omitted on success. |
attempts[].error_snippet |
string | Up to 4 KiB of the response body for non_2xx, or the error message otherwise. Omitted when empty. |
attempts[].duration_ms |
integer | How long the attempt took, in milliseconds. |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated |
No valid credentials. |
| 403 | permission_denied |
The caller has no read permission. |
| 404 | not_found |
No such task (or it was deleted or purged), or no such queue. |
Read more
Section titled “Read more”- How tasks work: states, scheduling and task IDs.
- Delivery and request headers: what your endpoint receives and how to respond.
- Deduplicate tasks with task IDs: use
task_idas an idempotency key. - Queues API reference: create and configure the queues tasks go into.
- API error codes: every
codeand what to do about it.