CLI command reference
Every postkub command with its REST operation, required scope, flags, and exit codes.
Updated
On this page
Complete, scannable reference for the postkub command: every accepted operation with the REST call it makes, the scope the key needs, and the flags each command group accepts. The CLI exists in preview only — see the CLI guide for setup, examples, and configuration.
Warning
The Postkub CLI is in preview and is not yet installable from npm. This reference describes the planned public interface; commands and flags may still change before the first release.
REST operations
Every command below performs exactly one authorized REST call. Mutating operations require an Idempotency-Key UUID (generated unless you pass --idempotency-key), and existing resources are revision-guarded with --expected-revision. A 202 response means accepted, not provider-completed.
| Command | REST call | Required scope | Purpose |
|---|---|---|---|
brands list | GET /v1/brands | brand:read | List Brands visible to the authenticated principal. |
accounts list | GET /v1/accounts | account:read | List connected social accounts, optionally filtered by Brand. |
accounts schedule get | GET /v1/accounts/{id}/schedule-settings | account:read | Read an account's timezone and weekly queue slots. |
accounts schedule update | PATCH /v1/accounts/{id}/schedule-settings | account:schedule | Update an account's timezone and/or weekly queue slots. |
capabilities get | GET /v1/accounts/{id}/capabilities | account:read | Read one account's allowed actions and reasons. |
posts list | GET /v1/posts | post:read | List posts with Brand, account, status, and UTC time filters. |
posts get | GET /v1/posts/{id} | post:read | Read one post projection. |
posts create | POST /v1/posts | post:create | Create a draft. |
posts update | PATCH /v1/posts/{id} | post:update | Edit a draft (revision-guarded). |
posts delete | DELETE /v1/posts/{id} | post:delete | Delete an unaccepted local draft (revision-guarded). |
posts publish | POST /v1/posts/{id}/publish | post:publish | Accept publish-now for selected accounts (202 = accepted). |
posts schedule | POST /v1/posts/{id}/schedule | post:schedule | Accept explicit schedules or reserve each account's next queue slot (202 = accepted). |
posts cancel | POST /v1/posts/{id}/cancel | post:cancel | Cancel unstarted work for selected accounts, or request reconciliation. |
posts retry | POST /v1/posts/{id}/retry | post:publish | Retry proven-no-effect failures for selected accounts. |
posts cover-retry | POST /v1/posts/{id}/cover-retry | post:publish | Retry a failed video cover without re-uploading the video. |
threads list | GET /v1/threads | comment:read | List inbox threads (filters: account, handled, linked post). |
threads get | GET /v1/threads/{id} | comment:read | Read one thread with its comments. |
threads update | PATCH /v1/threads/{id} | thread:update / thread:resolve | Update unread state (thread:update) and/or handled state (thread:resolve). |
comments list | GET /v1/comments | comment:read | List comments (filters: account, thread, unread). |
comments reply | POST /v1/comments/{id}/replies | comment:reply | Accept a durable comment reply (202 = accepted). |
insights account | GET /v1/accounts/{id}/insights | insight:read | Read saved account metrics and freshness. |
insights post | GET /v1/posts/{id}/insights | insight:read | Read saved post metrics by authorized target account. |
activity list | GET /v1/activity | activity:read | List scoped social activity and sanitized failures. |
replies get | GET /v1/replies/{id} | comment:read | Read reply execution status and attempt history. |
requests get | GET /v1/requests/{requestId} | any valid key | Recover a durable mutation receipt for this principal. |
whoami | GET /v1/me | any valid key | Inspect the authenticated principal, workspace, target IDs, and granted actions. |
API-level details for each operation live in the API reference: discovery and accounts, posts, publications, inbox, insights, and requests and activity.
Aliases: inbox list runs threads list; insights posts runs insights post; threads resolve runs threads update with handled: true (it cannot set handled to false, and it needs the thread:resolve scope).
Local and setup commands
These commands do not map to a social REST operation. schema describe reads the server's OpenAPI document at GET /api/docs-json; the rest run entirely locally.
| Command | Purpose |
|---|---|
postkub help, --help, -h | Print command usage. |
postkub --version, -v | Print the CLI version. |
postkub init [--non-interactive] | Save and verify configuration; summarize granted scope; optionally install an agent guide. |
postkub doctor [--verbose] | Check Node version, config, key format, connectivity, scope, and CLI freshness. |
postkub config path/get/set/unset [--repo] | Inspect or edit global and repo config. |
postkub context [--list / TOPIC] | Print the agent-readable context topics. |
postkub completion bash/zsh/fish [--install] | Print or install shell completion. |
postkub install claude/codex [--global] [--dry-run] | Install the Postkub guide for a coding agent. |
postkub uninstall claude/codex [--global] [--dry-run] | Remove the Postkub-managed guide content. |
postkub schema list | List all accepted operations with scopes and flags (local). |
postkub schema describe OPERATION | Fetch one operation's schema from the served OpenAPI document. |
init --non-interactive verifies an existing configuration or the environment variables without prompting; --output json is valid only together with --non-interactive.
Global flags
Accepted on every command. Types: value takes an argument, bool takes none, optvalue takes an optional argument.
| Flag | Type | Description |
|---|---|---|
--output | value | auto (default), pretty, human, or json; auto is human on a TTY, JSON when piped. |
--timeout | value | Per-request deadline in seconds, 1–900 (default 30). |
--quiet | bool | Suppress informational stderr lines. |
--verbose | bool | Print rate-limit response headers on stderr. |
--no-color | bool | Disable ANSI colors. |
Mutation flags
Accepted on every mutating command (anything that is not a GET):
| Flag | Type | Description |
|---|---|---|
--input | value | Structured input from a file, or - for stdin. |
--json | value | Inline structured input as a JSON string. |
--idempotency-key | value | Explicit idempotency UUID; generated when omitted. |
--wait | optvalue | After a 202 acceptance, poll until settled (default 120 seconds; exit code 6 on deadline). |
--dry-run | bool | Local validation and request preview only; nothing is sent. |
Exactly one of --input / --json is allowed; per-field flags complete the document but cannot override a field the document already supplies.
Read flags
Accepted on GET commands:
| Flag | Type | Description |
|---|---|---|
--fields | value | Comma-separated dot-path projection of the response, with brace expansion; all returns everything. |
--cursor | value | Pagination cursor (list commands only). |
--limit | value | Page size 1–100 (list commands only). |
brands, accounts, and capabilities
| Command | Flag | Type | Required | Description |
|---|---|---|---|---|
brands list | --fields | value | no | Project the response. |
brands list | --cursor, --limit | value | no | Pagination. |
accounts list | --brand-id | value | no | Filter by Brand; falls back to the configured defaultBrandId. |
accounts list | --fields, --cursor, --limit | value | no | Projection and pagination. |
accounts schedule get | --id or --account-id | value | one of them | Target account; --account-id falls back to defaultAccountId. |
accounts schedule get | --fields | value | no | Project the response. |
accounts schedule update | --id or --account-id | value | one of them | Target account. |
accounts schedule update | --expected-revision | value | yes | Revision guard. |
accounts schedule update | --timezone | value | no | IANA timezone, e.g. Asia/Bangkok. |
accounts schedule update | --slot | value (repeat) | no | Weekly slot as WEEKDAY:HH:MM, weekday 1–7 or mon–sun. |
accounts schedule update | --clear-slots | bool | no | Remove all weekly slots; cannot combine with --slot. |
capabilities get | --account-id | value | yes | Target account; falls back to defaultAccountId. |
capabilities get | --fields | value | no | Project the response. |
posts
| Command | Flag | Type | Required | Description |
|---|---|---|---|---|
posts list | --brand-id | value | no | Filter by Brand; falls back to defaultBrandId. |
posts list | --account-id | value | no | Filter by account. |
posts list | --status | value | no | One of draft, scheduled, publishing, published, failed, cancelled, needs_attention. |
posts list | --from, --to | value | no | UTC instant range; both required together. |
posts list | --fields, --cursor, --limit | value | no | Projection and pagination. |
posts get | --id | value | yes | Post ID. |
posts create | --brand-id | value | yes | Owning Brand. |
posts create | --account-id | value (repeat) | no | Target accounts. |
posts create | --text | value | yes (or in input) | Post text, 1–5000 characters. |
posts create | --media-url | value (repeat) | no | Ordered public HTTPS media URLs. |
posts create | --media-kind | value | no | image or video; video requires exactly one media item. |
posts create | --first-comment | value | no | Base first comment (max 2200 characters, capability-gated). |
posts update | --id | value | yes | Post ID. |
posts update | --expected-revision | value | yes (or in input) | Revision guard. |
posts update | --text, --media-url, --media-kind, --first-comment, --account-id | value / repeat | no | Same semantics as create. |
posts delete | --id | value | yes | Post ID of an unaccepted draft. |
posts delete | --expected-revision | value | yes (or in input) | Revision guard. |
posts publish | --id | value | yes | Post ID. |
posts publish | --expected-revision | value | no | Revision guard; required in the input document when omitted. |
posts publish | --account-id | value (repeat) | no | Subset of targets; publication requires at least one. |
posts publish | --replace-existing | bool | no | Replace known-unstarted work for the selected accounts. |
posts schedule | --id | value | yes | Post ID. |
posts schedule | --expected-revision | value | yes (or in input) | Revision guard. |
posts schedule | --next-slot | bool | no | Reserve each selected account's earliest free weekly slot. |
posts schedule | --account-id | value (repeat) | no | Subset of targets (with --next-slot). |
posts cancel | --id | value | yes | Post ID. |
posts cancel | --expected-revision | value | no | Revision guard. |
posts cancel | --account-id | value (repeat) | no | Subset of targets to cancel. |
posts retry / posts cover-retry | --id | value | yes | Post ID. |
posts retry / posts cover-retry | --expected-revision | value | no | Revision guard. |
posts retry / posts cover-retry | --account-id | value (repeat) | no | Subset of targets to retry. |
posts create, posts update, posts schedule, posts cancel, posts retry, posts cover-retry, and posts delete also accept the full JSON document form via --input / --json with the fields described in the posts API and publications API.
inbox: threads, comments, and replies
| Command | Flag | Type | Required | Description |
|---|---|---|---|---|
threads list / inbox list | --account-id | value | no | Filter by account; falls back to defaultAccountId. |
threads list / inbox list | --handled | value | no | true or false. |
threads list / inbox list | --post-target-id | value | no | Filter by linked post target; the literal none selects unlinked threads. |
threads list / inbox list | --fields, --cursor, --limit | value | no | Projection and pagination. |
threads get | --id | value | yes | Thread ID. |
threads update | --id | value | yes | Thread ID. |
threads update | --expected-revision | value | yes (or in input) | Revision guard. |
threads update | --handled | value | no | true or false; true requires thread:resolve. |
threads update | --unread | value | no | true or false; requires thread:update. |
comments list | --account-id | value | no | Filter by account; falls back to defaultAccountId. |
comments list | --thread-id | value | no | Filter by thread. |
comments list | --unread | value | no | true or false. |
comments list | --fields, --cursor, --limit | value | no | Projection and pagination. |
comments reply | --id | value | yes | Comment ID to reply to. |
comments reply | --text | value | yes (or in input) | Reply message, 1–2200 characters. |
replies get | --id | value | yes | Reply ID. |
insights and activity
| Command | Flag | Type | Required | Description |
|---|---|---|---|---|
insights account | --account-id or --id | value | one of them | Target account; --account-id falls back to defaultAccountId. |
insights account | --range-start-utc, --range-end-utc | value | no | UTC instant pair, at most 90 days apart; default is the last 30 days. |
insights account | --fields | value | no | Project the response. |
insights account | --dry-run | bool | no | Preview the request locally. |
insights post / insights posts | --id | value | yes | Post ID. |
insights post / insights posts | --range-start-utc, --range-end-utc | value | no | UTC instant pair. |
insights post / insights posts | --fields | value | no | Project the response. |
insights post / insights posts | --dry-run | bool | no | Preview the request locally. |
activity list | --brand-id | value | no | Filter by Brand; falls back to defaultBrandId. |
activity list | --account-id, --post-id | value | no | Filter by account or post. |
activity list | --from, --to | value | no | UTC instant range. |
activity list | --fields, --cursor, --limit | value | no | Projection and pagination. |
See the insights API and requests and activity API for response shapes.
requests
| Command | Flag | Type | Required | Description |
|---|---|---|---|---|
requests get | --id | value | yes | Request UUID; the CLI prints one on stderr before every mutation. |
config
| Command | Flag | Type | Required | Description |
|---|---|---|---|---|
config path | --repo | bool | no | Print the repo config path instead of the global one. |
config get | --repo | bool | no | Read repo values instead of effective values. |
config get | --all | bool | no | Print every effective value (global only). |
config set | KEY VALUE | positional | yes | Set a permitted key; apiKey is refused. |
config set | --repo | bool | no | Write to the repo config. |
config unset | KEY | positional | yes | Remove a permitted key. |
config unset | --repo | bool | no | Remove from the repo config. |
Permitted keys: defaultBrandId, defaultAccountId, output, timeout in both scopes; apiUrl only in the global file (via init); apiKey never via config set.
init, doctor, and agent guides
| Command | Flag | Type | Description |
|---|---|---|---|
init | --non-interactive | bool | Use the environment or existing config; never prompt. |
init | --output json | value | Machine-readable summary; only valid with --non-interactive. |
doctor | --verbose | bool | Print all checks, not only failures. |
install claude/codex | --global | bool | Target the user-level guide file instead of the project. |
install claude/codex | --dry-run | bool | Preview the change without writing. |
uninstall claude/codex | --global, --dry-run | bool | Same flags as install. |
completion bash/zsh/fish | --install | bool | Write the managed completion block and report its path. |
context and schema
| Command | Argument / flag | Description |
|---|---|---|
context | none | Print all context topics as markdown. |
context --list | flag | Print the topic catalog. |
context TOPIC | positional | Print one topic; see the topic table in the CLI guide. |
schema list | none | List all accepted operations locally. |
schema describe | positional OPERATION | Fetch the served OpenAPI schema for one operation. |
Exit codes
The exit-code table is shared with the CLI guide: exit codes. In short: 0 accepted/completed, 1 unexpected client error, 2 usage/schema, 3 authentication/authorization, 4 API rejection, 5 transport/uncertain, 6 wait deadline exceeded, 130 SIGINT, 143 SIGTERM.
