Skip to main content
One key and the CLI is talking to your account. Every command works with it, and it is the route to take on the hosted service.

Copy your key

Open app.postqueen.ai, go to Settings > Developers > Public API, and click Reveal.

Export it

Point at your own backend, if you self-host

Use the same value as NEXT_PUBLIC_BACKEND_URL. The CLI appends /public/v1/... to whatever you set, and most single-domain setups serve the backend under /api:
Leave the /api off and every command comes back 404, because the request lands on the web interface instead of the backend. If you are unsure which shape your install has, check NEXT_PUBLIC_BACKEND_URL in your docker-compose.yaml and use exactly that.

Prove it works

This is the first command that actually reaches the API:
Your connected channels come back as JSON. The key works, the URL is right, and every other command will reach her.
Keep the key secret: it grants full access to your account. You can revoke or rotate it any time from the same Settings screen.

What auth:status Tells You

auth:status reports which credentials the CLI found and which API URL it will use. It does not contact the server, so it will happily report a key that has been revoked. Treat it as “what am I configured with”, not “does this still work”. The only real proof is a command that reaches the API, such as integrations:list.

Environment Variables

*POSTQUEEN_API_KEY is required unless you have stored OAuth2 credentials from a self-hosted auth server.
When both are present, stored OAuth2 credentials take priority over the API key.

OAuth2 Device Flow (Advanced)

The CLI also ships an OAuth2 device flow:
auth:login requires an auth server to mediate the flow, and PostQueen does not currently host one. The default cli-auth.postqueen.ai endpoint is not available, so running the command without your own auth server will fail. Use an API key instead; every command behaves the same either way.
Self-host the auth server if you want the device flow anyway, for example to hand out short-lived CLI access without sharing API keys. When a reachable auth server is configured, auth:login:
  1. Displays a one-time code in your terminal
  2. Opens your browser to authorize
  3. Saves credentials to ~/.postqueen/credentials.json

Self-Hosting the Auth Server

The auth server holds the OAuth app secret and mediates the device flow, so you can authenticate without client credentials of your own.
Prerequisites: Node.js >= 18 and PostgreSQL.

Clone the repository

The auth server lives in the postqueen-agent repository:

Create an OAuth app in PostQueen

Go to PostQueen Settings > Developer > OAuth Apps and create a new app. Set the callback URL to:

Set up Postgres

Create a database. The server auto-creates the device_requests table on startup. Rows are deleted after the CLI retrieves the token, or on next access once expired (15 minutes).

Configure environment

Run the server

Point the CLI at your server

You can also pass the URL per invocation with the --auth-server flag on auth:login.
A one-time code appears in your terminal and your browser opens to authorize. Credentials land in ~/.postqueen/credentials.json.

Server Endpoints

Deployment

Any platform that runs Node.js and can connect to Postgres works, such as Railway, Fly.io, or a plain VPS.
The server is stateless beyond Postgres, so it scales horizontally. Run multiple instances behind a load balancer if needed.

Next steps

Schedule your first post

Channels, threads and drafts, in one command.

Find your channel IDs

What is connected, what each network accepts, and the tools it offers.

Every flag

The full reference, including which commands print plain text.

OAuth2 for your own app

The authorization code flow, for apps acting on behalf of other users.