API, CLI and AI agents
By Alex
By Alex
Post from ChatGPT, Claude and other AI assistants, the terminal, or your own code.
Use PublishQ with ChatGPT, Claude and other AI assistants
PublishQ has an MCP server, so AI assistants can list your connected accounts, upload media, and draft, schedule or publish posts for you. Any assistant that supports the Model Context Protocol (MCP) works. Connect your assistant Add https://publishq.com/mcp as a remote MCP server. The first time you use it, your assistant opens PublishQ in your browser: sign in, choose what it may do, and click Approve. There is nothing to install and no key to copy. - ChatGPT: install the PublishQ plugin, sign in to PublishQ and click Approve. Start a new chat and the PublishQ tools are there, on the web, desktop and mobile. - Claude (claude.ai, Claude Desktop, Claude mobile): open Settings > Connectors, choose Add custom connector and paste https://publishq.com/mcp. It works in Cowork too. - Claude Code: run claude mcp add --transport http publishq https://publishq.com/mcp, then open /mcp in a session and choose Authenticate. - Cursor: add "publishq": { "url": "https://publishq.com/mcp" } under mcpServers in ~/.cursor/mcp.json. The full setup, including running the server on your own machine, is in the MCP docs. Step-by-step guides for your assistant We have a page for each assistant, with setup steps and example prompts: - ChatGPT - Claude Cowork - Claude Code - OpenClaw - Hermes Agent - Manus - Muse - Kiro - Gemini CLI - Cursor For any other assistant, see all AI agents. Stay in control - Ask your assistant for a draft or a scheduled post rather than an immediate one. Drafts wait for you, and scheduled posts can be edited or cancelled in PublishQ until they go out. - When you approve, untick anything the assistant does not need. - Most assistants let you hide individual tools, for example the delete tool. See and disconnect connected apps Open API Keys in the sidebar and scroll to Connected apps. Every assistant or device you signed in with is listed with when it was last used. Click Disconnect to remove its access straight away, or rename a connection to tell your devices apart. Connected apps, with the apps you signed in to framed
Create an API key
One API key works for the REST API, the CLI, the SDK and the MCP server. API access comes with every plan. Create a key 1. Open API Keys in the sidebar. 2. Click Create Key. The API Keys page with the Create Key button framed 3. Give it a Name you will recognize, for example "CLI tool" or "CI/CD pipeline". 4. Under Scopes, choose what the key may do. Use Select all for full access. 5. Optionally set an Expiration date. 6. Click Create. The Create Key dialog with a name, scopes and an expiration date 7. Copy the key straight away. It starts with pq_live_ and is shown only once. Scopes Scope Allows posts:read Read posts posts:write Create, update, publish and delete posts accounts:read Read connected accounts workspaces:read Read workspaces workspaces:write Create and update workspaces media:read Read media media:write Upload, move and delete media A request that needs a scope the key does not have is refused with 403. Revoke a key Click the trash icon next to the key and confirm Revoke. Anything using it loses access immediately. Rate limit Requests are rate-limited per key. If you get a 429 response, wait for the time in the Retry-After header, then retry. Next Start with the API quick start, or browse the API reference.
Post from the terminal with the PublishQ CLI
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