API keys API reference
The API keys API (/v1/api-keys) lists, creates and revokes pushq API keys. API keys authenticate programs that call pushq: your app server, a worker, a deploy script. Each key has a role, writer or admin, which decides what it can do. These endpoints manage keys created in the dashboard (or through this API). Most people create keys in the dashboard under Settings → API keys; use these endpoints when you want to automate key rotation or provisioning. See the guide to creating and rotating API keys for the bigger picture.
The SDKs don’t wrap these endpoints; call them over HTTP. All examples use the hosted API at https://api.pushqueue.dev.
API key roles: writer and admin
Section titled “API key roles: writer and admin”| Capability | writer |
admin |
|---|---|---|
| Create, upsert, patch, pause, resume and purge queues it knows by name | yes | yes |
| Read a queue, its stats, tasks and attempts | yes | yes |
| Enqueue, run and delete tasks | yes | yes |
GET /v1/version |
yes | yes |
List queues (GET /v1/queues) |
no | yes |
| Delete queues | no | yes |
| Manage API keys, team members and invites | no | yes |
Give services a writer key unless they really need to list or delete queues.
Keys look like pq_ followed by 32 URL-safe characters. pushq stores only a SHA-256 hash, so the full key is shown once, when it is created. On the hosted service a key belongs to the team that was active when it was created and only sees that team’s queues. Self-hosted servers can also define keys in the server config file; those are not listed or revocable here (see server configuration).
Who can manage API keys
Section titled “Who can manage API keys”All three endpoints need the manage permission: an admin API key, or a dashboard user with the admin role. A writer key or a member/viewer gets 403 permission_denied. On a self-hosted server without dashboard accounts enabled they return 404 not_found.
The API key object
Section titled “The API key object”{ "id": 17, "name": "billing-service", "prefix": "pq_x7Kp2Qa9", "role": "writer", "created_by": "ana@example.com", "created_at": "2026-11-28T10:15:00.12Z", "last_used_at": "2026-11-28T11:02:44Z"}| Field | Type | Description |
|---|---|---|
id |
integer | Key ID; use it to revoke the key. |
name |
string | Label for what uses the key. |
prefix |
string | First 11 characters of the key (pq_ plus 8), so you can recognise it. |
role |
string | writer or admin. |
created_by |
string | Email of the dashboard user who created it. Omitted when an API key created it. |
created_at |
string (RFC 3339) | When the key was created. |
last_used_at |
string (RFC 3339) | When the key last authenticated a request. Updated at most once a minute. Omitted if never used. |
List API keys
Section titled “List API keys”GET /v1/api-keys
Returns the dashboard-managed keys, newest first. On the hosted service you see only the current team’s keys. Use it to audit which keys exist and spot ones that haven’t been used in a long time.
Who can call it: admin API key; dashboard admin.
No parameters.
Example
curl https://api.pushqueue.dev/v1/api-keys \ -H "Authorization: Bearer $PUSHQ_API_KEY"Response
200 OK:
{ "keys": [ { "id": 17, "name": "billing-service", "prefix": "pq_x7Kp2Qa9", "role": "writer", "created_by": "ana@example.com", "created_at": "2026-11-28T10:15:00.12Z", "last_used_at": "2026-11-28T11:02:44Z" }, { "id": 12, "name": "deploy-pipeline", "prefix": "pq_Lm3vT0cE", "role": "admin", "created_at": "2026-10-02T08:00:00Z" } ], "config_keys": 0}| Field | Type | Description |
|---|---|---|
keys |
array of API key objects | Dashboard-managed keys, newest first. |
config_keys |
integer | How many additional keys the server config file defines (self-hosted). Always 0 on the hosted service. |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated |
No valid credentials. |
| 403 | permission_denied |
Not an admin key or admin user. |
| 404 | not_found |
Dashboard accounts are not enabled on this server. |
See API error codes for the error format.
Create an API key
Section titled “Create an API key”POST /v1/api-keys
Creates a key and returns it once, in secret. Store it in your secret manager straight away; it can’t be retrieved later. Use this to provision a key per service, or to rotate a key: create the new one, deploy it, then revoke the old one.
Who can call it: admin API key; dashboard admin.
Request body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | yes | — | What uses the key, e.g. billing-service. 1–100 characters after trimming spaces. |
role |
string | yes | — | writer or admin. |
Example
curl -X POST https://api.pushqueue.dev/v1/api-keys \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "billing-service", "role": "writer" }'Response
201 Created:
{ "key": { "id": 18, "name": "billing-service", "prefix": "pq_9bQe4Rz1", "role": "writer", "created_at": "2026-11-28T12:00:00Z" }, "secret": "pq_9bQe4Rz1Hk2mVxN7cTqL0aYwPf3sUe8D"}| Field | Type | Description |
|---|---|---|
key |
API key object | The new key’s metadata. created_by is set when a dashboard user created it. |
secret |
string | The API key itself. Shown only in this response. |
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_argument |
Invalid JSON, name empty or longer than 100 characters, or role not writer/admin. |
| 401 | unauthenticated |
No valid credentials. |
| 403 | permission_denied |
Not an admin key or admin user. |
| 404 | not_found |
Dashboard accounts are not enabled on this server. |
| 413 | payload_too_large |
Body over 16 KiB. |
Revoke an API key
Section titled “Revoke an API key”DELETE /v1/api-keys/{id}
Deletes a key. Requests that use it fail with 401 unauthenticated from the next request on. Use it when a key leaks, when a service is retired, or as the last step of a rotation. On the hosted service you can only revoke keys that belong to your current team.
Who can call it: admin API key; dashboard admin. An admin key can revoke itself.
Path parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id |
integer | yes | — | The key’s id from the list or create response. |
Example
curl -X DELETE https://api.pushqueue.dev/v1/api-keys/17 \ -H "Authorization: Bearer $PUSHQ_API_KEY"Response
204 No Content with an empty body.
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_argument |
id is not a positive integer. |
| 401 | unauthenticated |
No valid credentials. |
| 403 | permission_denied |
Not an admin key or admin user. |
| 404 | not_found |
No such key in your team, or dashboard accounts are not enabled. |
Read more
Section titled “Read more”- Create and rotate API keys: the dashboard flow and rotation checklist.
- Teams & users API reference: roles for people instead of programs.
- REST API overview: authentication, request format and conventions.
- API error codes:
unauthenticated,permission_deniedand the rest.