Postonus
CLI

Scripting

--json, stdout vs. stderr, and exit codes — how to drive the CLI from another program.

Last updated on

Every command takes --json. It prints machine-readable JSON on stdout and skips all interactive rendering — no Ink, no colour, no spinners.

postonus queue list --json | jq -r '.queue[] | "\(.scheduledAt) \(.platform)"'

stdout carries data, stderr carries progress

Data goes to stdout. Progress lines and hints ("Uploading demo.mp4…") go to stderr. A pipe only ever sees the data:

postonus post --file draft.md --to linkedin --at 2026-08-01T09:30:00Z --json

-q, --quiet suppresses the stderr progress lines without switching to JSON, for when you want the human-readable stdout output but no chatter.

Exit codes

CodeMeaning
0Success.
1Any other failure: a server fault, an unreachable host, a missing file.
2Usage or validation: a missing or unparseable argument, a time with no offset, a post over a limit.
3Auth: no credentials, or a sign-in that expired.
4Plan or quota: the workspace's plan does not allow it, or this month's allowance is used up.
5Rate limit: wait the retryAfter seconds the error reports, then retry.

An error is written to stderr as Error: <message>, followed by each broken rule. In --json mode it is written to stdout instead, as the same object the API and the MCP tools return:

{
  "code": "CONTENT_TOO_LONG",
  "message": "Content exceeds the platform limit.",
  "data": {
    "violations": [
      {
        "message": "Content is 312 characters; TWITTER allows 280.",
        "platform": "TWITTER",
        "limit": 280,
        "actual": 312
      }
    ]
  }
}

No TTY means no prompts

With no terminal attached (piped input, CI), the CLI never prompts, spins, or colours output — pass the flags a prompt would have asked for instead. --no-input makes this explicit: a command that would need to prompt fails immediately with a message telling you which flag to pass, rather than hanging on a read that will never arrive.

--no-color turns off colour even in a real terminal; NO_COLOR (any value) does the same from the environment.

Piping content in

cat draft.md | postonus post --to x --optimal

Only used when no --file, --editor, or positional text is given, and only when stdin is not a TTY.

Dry-running a post

postonus post "test" --to x --optimal --dry-run

Resolves channels and prints what would be scheduled — content, target channels, timing — without creating anything.

On this page