Skip to main content
postsyncer-cli is PostSyncer’s command-line tool. Each command sends one API v1 request with your API key and prints PostSyncer’s JSON answer. It takes the same fields as the API, so the API reference describes every body you send. It needs Node.js 20 or later. The command you run is postsyncer.

Install

npx runs it once without installing. Every command takes --help, such as postsyncer posts --help.

Sign in with a key

  1. Make a key in Settings → API. Give it only the permissions your commands need: the table below lists them. Authentication explains keys and permissions.
  2. Put the key in POSTSYNCER_TOKEN and check it:
Output
ping reads GET /workspaces, so the key needs workspaces:read. To use a key for one command only, pass it with -t or --token instead.

Find your ids

Note the workspace’s id and the id of the account you post to. The examples below use workspace 4815 and account 16234: put your own ids in their place.

Save a draft

Commands that send a body take JSON in one of three ways: --file (-f) with a path, --data (-d) with the JSON itself, or --stdin to read it from a pipe. Use exactly one. Save this as draft.json:
draft.json
The answer is the new post, with its id. A draft goes nowhere. On Windows, --file is simpler than --data, since each shell quotes differently.

Schedule it

posts update sends PUT /posts/{id} with the same fields as create. Send the workspace_id and the full content again. Save this as schedule.json:
schedule.json
The time is in the workspace’s timezone. The key also needs posts:schedule. Without it, the command prints the 403 and nothing is saved. Leave accounts out and the post keeps its accounts. Update post has every rule.

Upload media

--workspace and --file are required, and --folder puts the file in a media folder. The CLI sends the file to the upload host, https://upload.postsyncer.com/api/v1, and reads the whole file into memory first. Put the answer’s media.id in a post’s content[].media. To copy files from links into the library instead, send POST /media/upload/url:
Add media says which files each network takes.

Options for every command

Put these before the command, such as postsyncer --raw-json posts list.

Commands

Each command sends one request. The key needs the permission in the last column. What to know about some of them:
  • posts get-by-url encodes the link for you. Pass it as you copied it.
  • On the Free plan, posts analyze-twitter is refused, and so is turning on comment moderation or contact collection. Creating and changing labels is on paid plans too. Plan limits has the list.
  • folders delete deletes only an empty folder. A folder with subfolders or files answers 422: move or delete what’s in it first.
  • comments hide asks the network to hide the comment. On a network that can’t hide, it answers 422 and sends nothing. See Answer comments.
  • comments sync takes {"post_id": POST_ID} as its body.
  • labels update needs both name and color.
  • accounts delete disconnects the account. Scheduled posts that go only to it move to drafts. See Delete an account.
  • posts delete can’t be undone. Test safely says what it removes on each network.
The CLI doesn’t cover the brand, snippets, campaigns, webhooks, Google reviews, approvals, post history or connect links. Use the API or the MCP server for those.

When a command fails

The CLI prints the status and PostSyncer’s answer, then exits with code 1:
Output
After a 401 it says to check the key, after a 403 to check its permissions. Error handling lists every answer.

In scripts and CI

  • Keep the key in your CI’s secret store and pass it as POSTSYNCER_TOKEN. Don’t commit it or paste it into chats.
  • A non-zero exit code means the request failed, so a CI step stops there.
  • The CLI shares the rate limit with the API and MCP: 60 requests a minute per person. Wait and retry when a run gets 429.
  • Each command runs once. After a timeout, check with posts list before you create the post again, or you may make two.

Quickstart

The same steps with curl, Node.js or Python.

MCP server

Let an AI agent do the same work.