Skip to content
pushqdocs
Get started

The Auth API (/v1/auth/*) signs people in to the pushq dashboard: it reports the current session, runs first-time setup and password sign-in on self-hosted servers, and handles email-code and GitHub sign-in on the hosted service. They exist mainly for the dashboard’s own sign-in pages; programs that call pushq should use an API key instead of a session. You’d call these directly to build a custom sign-in flow, to script first-time setup of a self-hosted server, or to debug sign-in.

The SDKs don’t wrap these endpoints; call them over HTTP.

pushq has two sign-in modes. Endpoints that don’t apply to the server’s mode return 404 not_found.

Endpoint Self-hosted Hosted / SaaS mode
GET /v1/auth/session yes yes
POST /v1/auth/logout yes yes
POST /v1/auth/setup yes no
POST /v1/auth/login yes no
GET /v1/auth/invites/{token} yes no
POST /v1/auth/invites/{token}:accept yes no
POST /v1/auth/email-code no yes
POST /v1/auth/email-code:verify no yes
GET /v1/auth/email-verification yes (always reports nothing pending) yes
POST /v1/auth/email-verification no yes
GET /v1/auth/workos/login no yes
GET /v1/auth/workos/callback no yes

Self-hosted means email-and-password accounts stored by your server (they also need dashboard accounts enabled; otherwise those endpoints return 404). SaaS mode means WorkOS is configured, as on https://api.pushqueue.dev: people sign in with a code sent to their email or with GitHub, and there are no passwords. See SaaS mode for running it yourself.

Session cookies, CSRF protection and rate limits

Section titled “Session cookies, CSRF protection and rate limits”

A successful sign-in sets the pushq_session cookie: HttpOnly, SameSite=Strict, Path=/, Secure when the request came over HTTPS (directly or via X-Forwarded-Proto: https). Sessions last 30 days and slide: a session used in its last 15 days is extended to 30 days again and the cookie is re-issued.

Every POST to /v1/auth/* that doesn’t carry an Authorization header must send an X-Requested-With header with any non-empty value (the dashboard sends pushq). Without it the request fails with 403 permission_denied. Browsers only let same-origin scripts set custom headers, so this blocks cross-site forgery. The examples below send it and keep cookies in a file with curl -c/-b.

Endpoints that check passwords or codes (setup, login, invite :accept, email-code, email-code:verify, POST email-verification) are rate-limited per client IP: 10 attempts, refilling one every 6 seconds. Over the limit they return 429 rate_limited with Retry-After: 6.

None of these endpoints need credentials.

setup, login, invite :accept and email-code:verify all answer with the signed-in user:

{
"user": {
"id": 3,
"email": "ana@example.com",
"name": "Ana Lima",
"role": "admin",
"created_at": "2026-09-14T08:12:00Z",
"last_login_at": "2026-11-28T09:01:12Z"
}
}
Field Type Description
user.id integer User ID.
user.email string Email address (lowercase).
user.name string Display name; may be empty.
user.role string admin, member or viewer. In SaaS mode this is the stored account role; the team role is in GET /v1/auth/session.
user.created_at string (RFC 3339) When the account was created.
user.last_login_at string (RFC 3339) Last sign-in. Omitted if never signed in.

GET /v1/auth/session

Tells the caller who they are and how this server signs people in. The dashboard calls it on load to decide whether to show first-time setup, the sign-in page, a team picker or the app. It never fails for lack of credentials; it reports authenticated: false instead. It also works with an API key, which makes it a handy way to check what a key is allowed to do.

Who can call it: anyone. Applies in every mode.

Example

Terminal window
curl https://api.pushqueue.dev/v1/auth/session \
-H "Authorization: Bearer $PUSHQ_API_KEY"

Response

200 OK. For a hosted dashboard user:

{
"mode": "saas",
"setup_required": false,
"setup_requires_key": false,
"authenticated": true,
"kind": "user",
"role": "admin",
"user": {
"id": 3,
"email": "ana@example.com",
"name": "Ana Lima",
"role": "admin",
"created_at": "2026-09-14T08:12:00Z",
"last_login_at": "2026-11-28T09:01:12Z"
},
"permissions": {
"read": true,
"list": true,
"write": true,
"delete_queue": true,
"manage": true
},
"sso_providers": ["workos"],
"team": { "id": 4, "name": "Acme", "role": "admin" },
"teams": [
{ "id": 4, "name": "Acme", "role": "admin" },
{ "id": 11, "name": "Side project", "role": "viewer" }
],
"needs_team": false
}

For a writer API key on a self-hosted server:

{
"mode": "locked",
"setup_required": false,
"setup_requires_key": false,
"authenticated": true,
"kind": "api_key",
"role": "writer",
"key_name": "billing-service",
"permissions": {
"read": true,
"list": false,
"write": true,
"delete_queue": false,
"manage": false
},
"sso_providers": [],
"needs_team": false
}
Field Type Description
mode string dev (authentication disabled), open (self-hosted with no API keys and no accounts yet, so no credentials are needed), locked (self-hosted, credentials required) or saas.
setup_required boolean Self-hosted: no dashboard account exists yet, so the dashboard should offer first-time setup. Always false in SaaS and dev mode.
setup_requires_key boolean Setup is required and the server has config-file API keys, so setup needs one of its admin keys.
authenticated boolean Whether the request carried valid credentials (always true in open and dev mode).
kind string user (session cookie), api_key or open. Omitted when not authenticated.
role string The caller’s role: user role, key role, or admin when open. In SaaS mode, the role in the current team. Omitted when there is none.
user object The signed-in user (user fields). Omitted for API keys and anonymous callers.
key_name string Name of the API key used (config file for keys from the server config). Omitted otherwise.
permissions.read boolean Can view queues, stats, tasks and attempts by name.
permissions.list boolean Can list every queue and read /metrics.
permissions.write boolean Can create and change queues and enqueue, run and delete tasks.
permissions.delete_queue boolean Can delete queues.
permissions.manage boolean Can manage members, invites and API keys.
sso_providers array of strings Single sign-on options for the sign-in page: ["workos"] in SaaS mode, otherwise empty.
team object SaaS mode: the current team (id, name, role). Omitted when there is none.
teams array SaaS mode, signed-in users: every team the user belongs to (id, name, role). Omitted otherwise.
needs_team boolean SaaS mode: the user is signed in but has no current team yet and must create or pick one. Until then they have no queue permissions.

Errors

Only 500 internal on a server-side failure. See API error codes.

POST /v1/auth/setup

Creates the first dashboard account, as an admin, and signs it in. It works only while the server has no accounts at all; after that, add people with invites. Creating the first account ends open mode: from then on every API request needs a session or an API key. Self-hosted only.

If the server’s config file defines API keys, the server is already protected, so setup also requires one of those keys with the admin role, in api_key or in an Authorization: Bearer header. This stops anyone who can reach the dashboard from claiming it.

Who can call it: anyone (no credentials), subject to the rules above. Rate-limited.

Request body

Parameter Type Required Default Description
email string yes — Admin’s email address (stored lowercase).
password string yes — At least 8 characters and at most 256 bytes.
name string no "" Display name, at most 100 characters.
api_key string only when config-file keys exist — An admin key from the server config. Can instead be sent as Authorization: Bearer <key>.

Example

Terminal window
curl -X POST https://pushq.example.com/v1/auth/setup \
-c cookies.txt \
-H "X-Requested-With: pushq" \
-H "Content-Type: application/json" \
-d '{ "email": "ana@example.com", "name": "Ana Lima", "password": "a-long-passphrase" }'

Response

201 Created with the sign-in response and a Set-Cookie: pushq_session=... header.

{
"user": {
"id": 1,
"email": "ana@example.com",
"name": "Ana Lima",
"role": "admin",
"created_at": "2026-11-28T12:00:00Z",
"last_login_at": "2026-11-28T12:00:00Z"
}
}

Errors

Status Code When
400 invalid_argument Invalid JSON or email, password too short or long, name too long.
400 failed_precondition Setup is already done (an account exists).
403 permission_denied Config-file keys exist and no admin config key was given, or the X-Requested-With header is missing.
404 not_found SaaS mode, or dashboard accounts are disabled.
413 payload_too_large Body over 16 KiB.
429 rate_limited Too many attempts.

POST /v1/auth/login

Checks an email and password and starts a session. Self-hosted only. Wrong email and wrong password give the same error, so the response doesn’t reveal which accounts exist.

Who can call it: anyone. Rate-limited.

Request body

Parameter Type Required Default Description
email string yes — Account email (case-insensitive).
password string yes — Account password.

Example

Terminal window
curl -X POST https://pushq.example.com/v1/auth/login \
-c cookies.txt \
-H "X-Requested-With: pushq" \
-H "Content-Type: application/json" \
-d '{ "email": "ana@example.com", "password": "a-long-passphrase" }'

Response

200 OK with the sign-in response and a Set-Cookie: pushq_session=... header.

{
"user": {
"id": 1,
"email": "ana@example.com",
"name": "Ana Lima",
"role": "admin",
"created_at": "2026-11-28T12:00:00Z",
"last_login_at": "2026-11-28T14:21:07Z"
}
}

Errors

Status Code When
400 invalid_argument Invalid JSON.
401 unauthenticated Unknown email or wrong password.
403 permission_denied Missing X-Requested-With header.
404 not_found SaaS mode, or dashboard accounts are disabled.
429 rate_limited Too many attempts.

POST /v1/auth/logout

Ends the current session on the server and clears the cookie. It succeeds even if there was no session. Applies in every mode.

Who can call it: anyone.

Example

Terminal window
curl -X POST https://api.pushqueue.dev/v1/auth/logout \
-b cookies.txt \
-H "X-Requested-With: pushq"

Response

204 No Content with an empty body and a Set-Cookie header that deletes pushq_session.

Errors

Status Code When
403 permission_denied Missing X-Requested-With header.

GET /v1/auth/invites/{token}

Shows what an invite or password-reset link is for, without using it up. The dashboard’s /invite page calls it to show “You’ve been invited as member” or “Reset the password for ana@example.com”. Invite and reset links look like https://pushq.example.com/invite#token=pqi_...; the token is the part after token=. Self-hosted only.

Who can call it: anyone holding the token.

Path parameters

Parameter Type Required Default Description
token string yes — The pqi_... token from the link.

Example

Terminal window
curl https://pushq.example.com/v1/auth/invites/pqi_Zr8wK1nQ3yT0vB6xM2cL9pH4dF7aJ5sE1uG8iO3kYqA

Response

200 OK:

{
"id": 9,
"kind": "invite",
"email": "sam@example.com",
"role": "member",
"created_at": "2026-11-28T10:00:00Z",
"expires_at": "2026-12-05T10:00:00Z"
}
Field Type Description
id integer Invite ID.
kind string invite (creates a new account) or reset (sets a new password for an existing one).
email string The account email.
role string Role the new account gets. Omitted for reset.
created_at string (RFC 3339) When the link was created.
expires_at string (RFC 3339) When it stops working (7 days for invites, 24 hours for reset links).

Errors

Status Code When
404 not_found The link is invalid, already used or expired; or SaaS mode.

POST /v1/auth/invites/{token}:accept

Uses an invite or reset link and signs the person in. For an invite it creates the account with the invited email and role. For a reset link it sets the new password and signs the user out of every other session. Each link works once. Self-hosted only.

Who can call it: anyone holding the token. Rate-limited.

Path parameters

Parameter Type Required Default Description
token string yes — The pqi_... token from the link.

Request body

Parameter Type Required Default Description
password string yes — New password: at least 8 characters, at most 256 bytes.
name string no "" Display name, at most 100 characters. Used for new accounts; ignored by reset links.

Example

Terminal window
curl -X POST https://pushq.example.com/v1/auth/invites/pqi_Zr8wK1nQ3yT0vB6xM2cL9pH4dF7aJ5sE1uG8iO3kYqA:accept \
-c cookies.txt \
-H "X-Requested-With: pushq" \
-H "Content-Type: application/json" \
-d '{ "name": "Sam Ortiz", "password": "another-long-passphrase" }'

Response

200 OK with the sign-in response and a Set-Cookie: pushq_session=... header.

{
"user": {
"id": 8,
"email": "sam@example.com",
"name": "Sam Ortiz",
"role": "member",
"created_at": "2026-11-28T15:00:00Z",
"last_login_at": "2026-11-28T15:00:00Z"
}
}

Errors

Status Code When
400 invalid_argument Invalid JSON, password too short or long, name too long.
403 permission_denied Missing X-Requested-With header.
404 not_found The link is invalid, already used or expired; or SaaS mode.
409 already_exists An account with the invited email already exists.
429 rate_limited Too many attempts.

POST /v1/auth/email-code

Emails a 6-digit sign-in code to the address. If the email has no account yet, one is created, so this is also how people sign up. The response is the same either way and doesn’t reveal whether the address already had an account. Follow up with Sign in with the emailed code. SaaS only.

Who can call it: anyone. Rate-limited.

Request body

Parameter Type Required Default Description
email string yes — Email address; must contain @, no spaces, at most 254 characters. Case-insensitive.

Example

Terminal window
curl -X POST https://api.pushqueue.dev/v1/auth/email-code \
-H "X-Requested-With: pushq" \
-H "Content-Type: application/json" \
-d '{ "email": "ana@example.com" }'

Response

200 OK:

{ "sent": true }
Field Type Description
sent boolean Always true on success.

Errors

Status Code When
400 invalid_argument Invalid JSON or email.
400 failed_precondition WorkOS rejected the request; detail explains why.
403 permission_denied Missing X-Requested-With header.
404 not_found Not in SaaS mode.
413 payload_too_large Body over 4 KiB.
429 rate_limited Too many attempts.
502 internal WorkOS is unavailable.

POST /v1/auth/email-code:verify

Checks the code from the email and starts a session. Entering the code proves the person owns the inbox, so the email is marked verified. The session starts in the team the user last used (or their first team; needs_team in the session tells you if they have none). SaaS only.

If WorkOS needs a separate email-verification step, this answers 403 email_verification_required and sets a short-lived pushq_email_verify cookie (15 minutes); finish with Finish a paused sign-in.

Who can call it: anyone. Rate-limited.

Request body

Parameter Type Required Default Description
email string yes — The address the code was sent to.
code string yes — The 6-digit code.

Example

Terminal window
curl -X POST https://api.pushqueue.dev/v1/auth/email-code:verify \
-c cookies.txt \
-H "X-Requested-With: pushq" \
-H "Content-Type: application/json" \
-d '{ "email": "ana@example.com", "code": "482913" }'

Response

200 OK with the sign-in response and a Set-Cookie: pushq_session=... header.

{
"user": {
"id": 3,
"email": "ana@example.com",
"name": "Ana Lima",
"role": "member",
"created_at": "2026-09-14T08:12:00Z",
"last_login_at": "2026-11-28T09:01:12Z"
}
}

Errors

Status Code When
400 invalid_argument Invalid JSON, or email or code missing.
400 failed_precondition The sign-in can’t complete, for example the email is linked to a different account; detail explains.
401 unauthenticated The code is wrong or expired.
403 email_verification_required WorkOS emailed a verification code; finish with POST /v1/auth/email-verification.
403 permission_denied Missing X-Requested-With header.
404 not_found Not in SaaS mode.
429 rate_limited Too many attempts.
502 internal WorkOS is unavailable.

GET /v1/auth/email-verification

Reports whether this browser has a sign-in waiting for an email verification code, and which address the code went to. The sign-in page calls it after being sent to /login?verify=1. It reads the pushq_email_verify cookie, so without that cookie it reports nothing pending.

Who can call it: anyone. Works in every mode, but only SaaS mode ever pauses a sign-in.

Example

Terminal window
curl https://api.pushqueue.dev/v1/auth/email-verification \
-b cookies.txt

Response

200 OK:

{ "pending": true, "email": "ana@example.com" }
Field Type Description
pending boolean A sign-in is waiting for an email verification code.
email string Where the verification code was sent. Empty when nothing is pending.

Errors

None specific to this endpoint.

POST /v1/auth/email-verification

Completes a sign-in that was paused for email verification (after email-code:verify answered email_verification_required, or a GitHub sign-in redirected to /login?verify=1). Send the code from the verification email; the paused sign-in is identified by the pushq_email_verify cookie. SaaS only.

Who can call it: anyone with the pending-verification cookie. Rate-limited.

Request body

Parameter Type Required Default Description
code string yes — The code from the verification email.

Example

Terminal window
curl -X POST https://api.pushqueue.dev/v1/auth/email-verification \
-b cookies.txt -c cookies.txt \
-H "X-Requested-With: pushq" \
-H "Content-Type: application/json" \
-d '{ "code": "907315" }'

Response

200 OK with a Set-Cookie: pushq_session=... header (and the pending-verification cookie cleared):

{
"user": {
"id": 3,
"email": "ana@example.com",
"name": "Ana Lima",
"role": "member",
"created_at": "2026-09-14T08:12:00Z",
"last_login_at": "2026-11-28T09:01:12Z"
},
"next": "/queues"
}
Field Type Description
user object The signed-in user (user fields).
next string Dashboard path to go to next (from the original sign-in’s next, or /).

Errors

Status Code When
400 invalid_argument Invalid JSON.
400 failed_precondition No pending verification (cookie missing or older than 15 minutes), or the sign-in can’t complete; detail explains.
401 unauthenticated The code is wrong or expired.
403 permission_denied Missing X-Requested-With header.
404 not_found Not in SaaS mode.
429 rate_limited Too many attempts.
502 internal WorkOS is unavailable.

GET /v1/auth/workos/login

Starts a GitHub sign-in through WorkOS. This is a browser navigation, not an API call: link the “Sign in with GitHub” button to it. It sets a short-lived state cookie (10 minutes) and redirects to GitHub’s consent screen. SaaS only.

Who can call it: anyone (a browser).

Query parameters

Parameter Type Required Default Description
provider string yes — Sign-in provider. Only github is supported.
next string no / Dashboard path to return to afterwards. Must be a path on the same site (not //host, not under /v1/); anything else becomes /.

Example

Terminal window
curl -i "https://api.pushqueue.dev/v1/auth/workos/login?provider=github&next=/queues"

Response

302 Found with a Location header pointing at GitHub. An unknown provider redirects to /login?error=Unknown%20sign-in%20option. instead.

Errors

Status Code When
404 not_found Not in SaaS mode.

GET /v1/auth/workos/callback

Where WorkOS sends the browser back after GitHub. It checks the state cookie set by Start GitHub sign-in, exchanges the code with WorkOS, creates the session and redirects into the dashboard. You don’t call it yourself, but its URL must be registered as a redirect URI in your WorkOS dashboard when you run SaaS mode. SaaS only.

Who can call it: the browser, coming from WorkOS.

Query parameters

Set by WorkOS, not by you.

Parameter Type Required Default Description
code string yes — Authorization code from WorkOS.
state string yes — Must match the state cookie.
error string no — Set by WorkOS when sign-in was cancelled or failed.
error_description string no — Human-readable reason for error.

Response

Always 302 Found:

Redirect target When
The next path from the login step (default /) Signed in; Set-Cookie: pushq_session=... is included.
/login?verify=1 WorkOS requires email verification first; finish with Finish a paused sign-in.
/login?error=<message> State cookie missing or expired, state mismatch, cancelled at GitHub, or WorkOS rejected the sign-in.

Errors

Status Code When
404 not_found Not in SaaS mode.