API Key (Recommended)
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: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.
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:
- Displays a one-time code in your terminal
- Opens your browser to authorize
- 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.
How the device flow works, end to end
How the device flow works, end to end
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
--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.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.