Skip to content
Docs menu

CLI

Publish local files and check your posts from a terminal.

On this page

Install from the checkout

The CLI requires Node 22.18 or newer. With the Posthoop checkout's dependencies installed, package the CLI and install the local tarball. Run these from the repository root.

Shell
pnpm --dir packages/cli pack --out "$PWD/posthoop.tgz"
npm install --global ./posthoop.tgz

You can also run node packages/cli/src/index.ts --help directly from the checkout.

Log in with an API key

Shell
posthoop login --url https://posthoop.com

Paste a workspace key when prompted. Login checks the key against the accounts endpoint and saves the connection in ~/.config/posthoop/config.json, or $XDG_CONFIG_HOME/posthoop/config.json. Use a Publishing key to post. For noninteractive login, set POSTHOOP_API_KEY and supply --url or POSTHOOP_URL. Later commands use the saved connection.

Check a post before uploading

Shell
posthoop post photo.jpg detail.jpg --caption "From the studio" \
  --to instagram:@myhandle --dry-run

Use platform:@handle if several accounts share a platform. A dry run sends metadata for validation. It exits with status 1 when validation fails. Remove --dry-run to upload and publish, or add --at followed by a future ISO timestamp to schedule.

The CLI uses ffprobe when available for video metadata. If it is unavailable, pass --duration in seconds for TikTok and YouTube videos, and --width and --height for YouTube. These options apply to every file in the command.

Command reference

login

Check an API key and save your connection.

Usage
posthoop login [--url <origin>]
OptionMeaning
--url <origin>Posthoop server origin. Uses POSTHOOP_URL or prompts if omitted.

accounts

List social accounts in the workspace.

Usage
posthoop accounts

post

Publish, schedule, or validate a post with 1 to 35 files.

Usage
posthoop post <file...> --to <destinations> [--caption <text>] [--at <ISO time>] [--dry-run] [--privacy <option>] [--board <id>] [--duration <seconds>] [--width <pixels>] [--height <pixels>]
OptionMeaning
--to <destinations>Comma-separated platforms or platform:@handle selectors.
--caption <text>Caption for all selected accounts. Defaults to an empty string.
--at <ISO time>Schedule a future time with an offset. Omit to publish now.
--dry-runValidate file metadata and targets without uploading or publishing.
--privacy <option>TikTok or YouTube privacy setting. TikTok defaults to SELF_ONLY.
--board <id>Pinterest board ID.
--duration <seconds>Override the detected video duration for all files.
--width <pixels>Override the detected width for all files.
--height <pixels>Override the detected height for all files.

posts

List recent posts with their target statuses.

Usage
posthoop posts

status

Read a post and its target outcomes.

Usage
posthoop status <id>

help

Print CLI usage. Also available as --help or -h.

Usage
posthoop help