CLI command reference

Every postkub command with its REST operation, required scope, flags, and exit codes.

Updated

Open in ClaudeOpen in ChatGPT
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.

CommandREST callRequired scopePurpose
brands listGET /v1/brandsbrand:readList Brands visible to the authenticated principal.
accounts listGET /v1/accountsaccount:readList connected social accounts, optionally filtered by Brand.
accounts schedule getGET /v1/accounts/{id}/schedule-settingsaccount:readRead an account's timezone and weekly queue slots.
accounts schedule updatePATCH /v1/accounts/{id}/schedule-settingsaccount:scheduleUpdate an account's timezone and/or weekly queue slots.
capabilities getGET /v1/accounts/{id}/capabilitiesaccount:readRead one account's allowed actions and reasons.
posts listGET /v1/postspost:readList posts with Brand, account, status, and UTC time filters.
posts getGET /v1/posts/{id}post:readRead one post projection.
posts createPOST /v1/postspost:createCreate a draft.
posts updatePATCH /v1/posts/{id}post:updateEdit a draft (revision-guarded).
posts deleteDELETE /v1/posts/{id}post:deleteDelete an unaccepted local draft (revision-guarded).
posts publishPOST /v1/posts/{id}/publishpost:publishAccept publish-now for selected accounts (202 = accepted).
posts schedulePOST /v1/posts/{id}/schedulepost:scheduleAccept explicit schedules or reserve each account's next queue slot (202 = accepted).
posts cancelPOST /v1/posts/{id}/cancelpost:cancelCancel unstarted work for selected accounts, or request reconciliation.
posts retryPOST /v1/posts/{id}/retrypost:publishRetry proven-no-effect failures for selected accounts.
posts cover-retryPOST /v1/posts/{id}/cover-retrypost:publishRetry a failed video cover without re-uploading the video.
threads listGET /v1/threadscomment:readList inbox threads (filters: account, handled, linked post).
threads getGET /v1/threads/{id}comment:readRead one thread with its comments.
threads updatePATCH /v1/threads/{id}thread:update / thread:resolveUpdate unread state (thread:update) and/or handled state (thread:resolve).
comments listGET /v1/commentscomment:readList comments (filters: account, thread, unread).
comments replyPOST /v1/comments/{id}/repliescomment:replyAccept a durable comment reply (202 = accepted).
insights accountGET /v1/accounts/{id}/insightsinsight:readRead saved account metrics and freshness.
insights postGET /v1/posts/{id}/insightsinsight:readRead saved post metrics by authorized target account.
activity listGET /v1/activityactivity:readList scoped social activity and sanitized failures.
replies getGET /v1/replies/{id}comment:readRead reply execution status and attempt history.
requests getGET /v1/requests/{requestId}any valid keyRecover a durable mutation receipt for this principal.
whoamiGET /v1/meany valid keyInspect 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.

CommandPurpose
postkub help, --help, -hPrint command usage.
postkub --version, -vPrint 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 listList all accepted operations with scopes and flags (local).
postkub schema describe OPERATIONFetch 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.

FlagTypeDescription
--outputvalueauto (default), pretty, human, or json; auto is human on a TTY, JSON when piped.
--timeoutvaluePer-request deadline in seconds, 1–900 (default 30).
--quietboolSuppress informational stderr lines.
--verboseboolPrint rate-limit response headers on stderr.
--no-colorboolDisable ANSI colors.

Mutation flags

Accepted on every mutating command (anything that is not a GET):

FlagTypeDescription
--inputvalueStructured input from a file, or - for stdin.
--jsonvalueInline structured input as a JSON string.
--idempotency-keyvalueExplicit idempotency UUID; generated when omitted.
--waitoptvalueAfter a 202 acceptance, poll until settled (default 120 seconds; exit code 6 on deadline).
--dry-runboolLocal 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:

FlagTypeDescription
--fieldsvalueComma-separated dot-path projection of the response, with brace expansion; all returns everything.
--cursorvaluePagination cursor (list commands only).
--limitvaluePage size 1–100 (list commands only).

brands, accounts, and capabilities

CommandFlagTypeRequiredDescription
brands list--fieldsvaluenoProject the response.
brands list--cursor, --limitvaluenoPagination.
accounts list--brand-idvaluenoFilter by Brand; falls back to the configured defaultBrandId.
accounts list--fields, --cursor, --limitvaluenoProjection and pagination.
accounts schedule get--id or --account-idvalueone of themTarget account; --account-id falls back to defaultAccountId.
accounts schedule get--fieldsvaluenoProject the response.
accounts schedule update--id or --account-idvalueone of themTarget account.
accounts schedule update--expected-revisionvalueyesRevision guard.
accounts schedule update--timezonevaluenoIANA timezone, e.g. Asia/Bangkok.
accounts schedule update--slotvalue (repeat)noWeekly slot as WEEKDAY:HH:MM, weekday 1–7 or mon–sun.
accounts schedule update--clear-slotsboolnoRemove all weekly slots; cannot combine with --slot.
capabilities get--account-idvalueyesTarget account; falls back to defaultAccountId.
capabilities get--fieldsvaluenoProject the response.

posts

CommandFlagTypeRequiredDescription
posts list--brand-idvaluenoFilter by Brand; falls back to defaultBrandId.
posts list--account-idvaluenoFilter by account.
posts list--statusvaluenoOne of draft, scheduled, publishing, published, failed, cancelled, needs_attention.
posts list--from, --tovaluenoUTC instant range; both required together.
posts list--fields, --cursor, --limitvaluenoProjection and pagination.
posts get--idvalueyesPost ID.
posts create--brand-idvalueyesOwning Brand.
posts create--account-idvalue (repeat)noTarget accounts.
posts create--textvalueyes (or in input)Post text, 1–5000 characters.
posts create--media-urlvalue (repeat)noOrdered public HTTPS media URLs.
posts create--media-kindvaluenoimage or video; video requires exactly one media item.
posts create--first-commentvaluenoBase first comment (max 2200 characters, capability-gated).
posts update--idvalueyesPost ID.
posts update--expected-revisionvalueyes (or in input)Revision guard.
posts update--text, --media-url, --media-kind, --first-comment, --account-idvalue / repeatnoSame semantics as create.
posts delete--idvalueyesPost ID of an unaccepted draft.
posts delete--expected-revisionvalueyes (or in input)Revision guard.
posts publish--idvalueyesPost ID.
posts publish--expected-revisionvaluenoRevision guard; required in the input document when omitted.
posts publish--account-idvalue (repeat)noSubset of targets; publication requires at least one.
posts publish--replace-existingboolnoReplace known-unstarted work for the selected accounts.
posts schedule--idvalueyesPost ID.
posts schedule--expected-revisionvalueyes (or in input)Revision guard.
posts schedule--next-slotboolnoReserve each selected account's earliest free weekly slot.
posts schedule--account-idvalue (repeat)noSubset of targets (with --next-slot).
posts cancel--idvalueyesPost ID.
posts cancel--expected-revisionvaluenoRevision guard.
posts cancel--account-idvalue (repeat)noSubset of targets to cancel.
posts retry / posts cover-retry--idvalueyesPost ID.
posts retry / posts cover-retry--expected-revisionvaluenoRevision guard.
posts retry / posts cover-retry--account-idvalue (repeat)noSubset 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

CommandFlagTypeRequiredDescription
threads list / inbox list--account-idvaluenoFilter by account; falls back to defaultAccountId.
threads list / inbox list--handledvaluenotrue or false.
threads list / inbox list--post-target-idvaluenoFilter by linked post target; the literal none selects unlinked threads.
threads list / inbox list--fields, --cursor, --limitvaluenoProjection and pagination.
threads get--idvalueyesThread ID.
threads update--idvalueyesThread ID.
threads update--expected-revisionvalueyes (or in input)Revision guard.
threads update--handledvaluenotrue or false; true requires thread:resolve.
threads update--unreadvaluenotrue or false; requires thread:update.
comments list--account-idvaluenoFilter by account; falls back to defaultAccountId.
comments list--thread-idvaluenoFilter by thread.
comments list--unreadvaluenotrue or false.
comments list--fields, --cursor, --limitvaluenoProjection and pagination.
comments reply--idvalueyesComment ID to reply to.
comments reply--textvalueyes (or in input)Reply message, 1–2200 characters.
replies get--idvalueyesReply ID.

insights and activity

CommandFlagTypeRequiredDescription
insights account--account-id or --idvalueone of themTarget account; --account-id falls back to defaultAccountId.
insights account--range-start-utc, --range-end-utcvaluenoUTC instant pair, at most 90 days apart; default is the last 30 days.
insights account--fieldsvaluenoProject the response.
insights account--dry-runboolnoPreview the request locally.
insights post / insights posts--idvalueyesPost ID.
insights post / insights posts--range-start-utc, --range-end-utcvaluenoUTC instant pair.
insights post / insights posts--fieldsvaluenoProject the response.
insights post / insights posts--dry-runboolnoPreview the request locally.
activity list--brand-idvaluenoFilter by Brand; falls back to defaultBrandId.
activity list--account-id, --post-idvaluenoFilter by account or post.
activity list--from, --tovaluenoUTC instant range.
activity list--fields, --cursor, --limitvaluenoProjection and pagination.

See the insights API and requests and activity API for response shapes.

requests

CommandFlagTypeRequiredDescription
requests get--idvalueyesRequest UUID; the CLI prints one on stderr before every mutation.

config

CommandFlagTypeRequiredDescription
config path--repoboolnoPrint the repo config path instead of the global one.
config get--repoboolnoRead repo values instead of effective values.
config get--allboolnoPrint every effective value (global only).
config setKEY VALUEpositionalyesSet a permitted key; apiKey is refused.
config set--repoboolnoWrite to the repo config.
config unsetKEYpositionalyesRemove a permitted key.
config unset--repoboolnoRemove 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

CommandFlagTypeDescription
init--non-interactiveboolUse the environment or existing config; never prompt.
init--output jsonvalueMachine-readable summary; only valid with --non-interactive.
doctor--verboseboolPrint all checks, not only failures.
install claude/codex--globalboolTarget the user-level guide file instead of the project.
install claude/codex--dry-runboolPreview the change without writing.
uninstall claude/codex--global, --dry-runboolSame flags as install.
completion bash/zsh/fish--installboolWrite the managed completion block and report its path.

context and schema

CommandArgument / flagDescription
contextnonePrint all context topics as markdown.
context --listflagPrint the topic catalog.
context TOPICpositionalPrint one topic; see the topic table in the CLI guide.
schema listnoneList all accepted operations locally.
schema describepositional OPERATIONFetch 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.