Home API, CLI and AI agents Post from the terminal with the PublishQ CLI

Post from the terminal with the PublishQ CLI

Last updated on Dec 01, 2026

The PublishQ CLI lets you publish and schedule posts, and manage your accounts, media and workspaces, from the terminal.

Install

npm install -g @publishq/cli@latest

You get two commands, publishq and pq. They are the same.

Sign in

pq login

It prints a link and a code and opens the link in your browser. Check the page shows the same code and click Approve. The login is saved on your machine and renews itself. On a server over SSH, open the link on any other device. pq logout signs out.

To use an API key instead, run pq auth set --key "pq_live_...". See Create an API key.

Try it

pq accounts list --pretty

Output is JSON by default, which suits scripts and agents. Add --pretty to read it yourself.

In CI

Set PUBLISHQ_API_KEY in the job's environment. The CLI reads it directly, so nothing is written to disk.

Learn more

Every command is in the CLI docs. Your CLI logins are listed under API Keys > Connected apps as "PublishQ CLI", where you can disconnect them.

Connected apps with a PublishQ CLI login framed
Figure 1. Desktop version