@postqueen/node is a small typed client for the PostQueen API. It sends your API key and calls five endpoints for you: list channels, create a post, list posts, upload a file and delete a post. Everything else in the API is a plain HTTPS call, shown below.
This page describes version 1.0.7. Run npm ls @postqueen/node to see yours.
Before you start
- Node.js 20.19 or newer. On Node.js 22, use 22.12 or newer. The package loads its HTTP library with
require, which older versions refuse. - A PostQueen workspace on a trial or a paid plan, with at least one connected channel.
- The API key, from the box below.
Where the API key is: in the app, open Connections > API Keys. Only a workspace Admin or Super Admin can reveal or rotate it; other members see it masked. A workspace has one key, and each agent card on Connections shows your MCP address with the key already filled in.
Install and schedule a first post
1
Install the package
2
Set your key
3
Schedule a post
This finds your Bluesky channel and schedules a text post on it.
schedule.ts
4
Check it
The post appears on the calendar in the app, and
created holds one { postId, integration } per channel.The SDK fills in
shortLink, tags and each part’s image when you leave them out. Fields you can leave out lists the rest.In an ES module
In a CommonJS project, or in TypeScript compiled to CommonJS withesModuleInterop, the default import above works. In an ES module ("type": "module", a .mjs file, or TypeScript with "module": "nodenext"), the class is on .default:
The client
On PostQueen Cloud, leave
baseUrl out. If you run PostQueen on your own server, pass your backend’s address, or set POSTQUEEN_API_URL to it:
POSTQUEEN_API_URL before that. An empty string is used as it is, not replaced by the default, and every call then fails.
Fields you can leave out
From 1.0.5 the types follow what the API needs, so the smallest post is a channel, a date and some text.postList() still takes the API’s filter type, which asks for customer: send '' to list the posts of every channel. Version 1.0.4 also asked for group: '', id: '' and delay: 0; update with npm install @postqueen/node@latest.
Which settings each network takes is on Posting settings by network.
Methods
Every method but
deletePost() is typed as returning unknown. Cast the result to the shape you expect, as the examples do.
Post with an image and a thread
Upload the file first, then put itsid and path on the post. The second entry goes out 5 minutes after the first.
upload.ts
upload() sends the file with a content type taken from the extension you pass: png, jpg, jpeg, gif, webp, mp4 and mov are mapped, anything else is sent as JPEG. PostQueen reads the real type from the file itself either way. A video comes back with status: "processing". An MP4 can go into a post right away; a MOV has to reach ready in Get media status first, since a post takes no MOV.
One post on two networks with settings
WordPress and DEV each need a title. WordPress also needs the post type, hereposts.
settings.ts
List and delete posts
list-delete.ts
{ "error": true } when it works. Judge it by the status code, as above.
Errors
The client does not throw when PostQueen answers with an error. It hands back the error body instead, such as{ "msg": "Invalid API key" }, or a 400 with provider and message when a post breaks a network’s rules. Check the shape before you use a result:
errors.ts
post() counts against the 30 POST /posts requests a workspace can send in an hour, except calls refused during validation, and upload() against 300 uploads an hour. Put several channels in one post() call rather than one call per channel. What each status code means is on Limits and errors.
Calls the SDK does not wrap
Every other endpoint is a plain HTTPS call with the same header. Send the key as it is, with noBearer prefix. This one checks whether an uploaded video is ready:
media-status.ts
Next steps
Schedule a post with the API
From listing your channels to checking that the post went out.
Posting settings by network
The settings each network needs in a post, and which fields are required.
Limits and errors
The hourly limits, and the status codes the API returns.
Node.js SDK
Call the API from JavaScript or TypeScript with @postqueen/node.