Get machine-readable output
Pass--json explicitly in scripts. The CLI also switches to JSON automatically when stdout is not a terminal, but an explicit flag keeps logs auditable.
Precedence:
--output wins, then --json, then the TTY check (non-terminal → JSON, terminal → human tables).
Data goes to stdout. Diagnostics, progress, and errors go to stderr. Parse stdout; never scrape stderr for results.
Read the success envelope
Almost every command returns the same two-field envelope. (The few that don’t are listed under envelope exceptions.)string
required
Stable identifier for the output shape, for example
repost.events.search/v1. Branch on this — it is versioned and never changes meaning within a major version.object
required
The command result. Its shape is determined by
schema.schema, then read data. The same result, parsed two ways — this is your consuming code, not Repost internals:
Event payloads in
data are redacted by default — credential and signature headers and secret-like JSON keys are masked, but PII is not. See Transcript safety for exactly what is and isn’t removed.Know the envelope exceptions
A few commands do not use the{schema, data} envelope. An agent that assumes a schema field everywhere will break on these.
Handle errors
When JSON is enabled, failures are structured: theerror object goes to stderr and the process exits non-zero.
string
required
Stable machine code. Branch on this, never on the message.
string
required
Human-readable explanation. For people, not programs.
integer
required
Mirrors the process exit status (see the table below).
string
Suggested next step, when one applies.
string
Always present; defaults to
repost docs agent.string
The exact scope to request. Present only on
forbidden_scope.string
Where to mint a token with the missing scope. Present only on
forbidden_scope.error.code and exit_code, never from the human message:
validation_failed, active_org_required, forbidden_scope, and quota_exceeded are terminal — retrying the same command will fail the same way. Only rate_limited and upstream_unavailable are worth retrying.Pin to a contract version
Current contract
Every command schema is
repost.<area>/v1. The success envelope is {schema, data}; the failure envelope is {error}. Exit codes 0–8 are stable. When a payload changes incompatibly, the schema suffix bumps (/v2) and both are served during migration — so an agent can pin to the version it was built against.Continue
Authentication & scopes
Recover from
unauthorized and forbidden_scope, and the read / write / secrets model.Transcript safety
What
events get / events diff mask in data — and what they leave in the clear.Discovery
Pull each command’s exact
data shape from the binary with docs schema.