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.
| Trigger | Result |
|---|---|
--json | JSON on stdout. |
--output json / --output table | Forces JSON on, or human tables on. |
| Non-TTY stdout (piped or redirected) | JSON automatically. |
--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.)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.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.
| Command | Output |
|---|---|
expect | A single bare JSON object (no envelope, no schema). Always JSON, even without --json. |
tail | NDJSON — one bare JSON object per matching event, one per line. Always JSON. |
capabilities | Top-level { schema, version, commands }. Always JSON. |
events get --body-only | The raw request body, no envelope. |
docs schema | { schema, command, output_schema, output_mode, envelope, data_shape? }. |
docs agent / docs search | Markdown text, not JSON. |
Handle errors
When JSON is enabled, failures are structured: theerror object goes to stderr and the process exits non-zero.
Stable machine code. Branch on this, never on the message.
Human-readable explanation. For people, not programs.
Mirrors the process exit status (see the table below).
Suggested next step, when one applies.
Always present; defaults to
repost docs agent.The exact scope to request. Present only on
forbidden_scope.Where to mint a token with the missing scope. Present only on
forbidden_scope.error.code and exit_code, never from the human message:
error.code | exit | When | Agent response |
|---|---|---|---|
validation_failed | 2 | Bad input — a client-side flag/argument check or HTTP 400/422 | Fix the command. Do not retry unchanged. |
active_org_required | 2 | A user token can see zero or multiple licensed organizations, so a mutation has no unambiguous org | Use an organization token or select a user context with exactly one licensed org. |
unauthorized | 3 | Invalid or missing token (401) | Refresh or replace REPOST_TOKEN. |
forbidden_scope | 3 | Token lacks a scope (403) | Request missing_scope or take a read-only path. |
not_found | 4 | Unknown id/bucket/forwarder (404) | Verify the id and active organization. |
quota_exceeded | 5 | Plan limit reached (402) | Not transient. Stop or reduce scope. |
rate_limited | 6 | Server limit (429) | Back off, then retry. |
timeout | 7 | expect / tail / replay wait deadline, or promote setup browser pairing deadline | Report the unmet wait. Inspect state before retrying. |
partial_failure | 8 | health --fail-on breach; replay wait with failures | Inspect details before declaring success. |
conflict | 1 | State changed under you (409/412) | Refresh state, then retry. |
upstream_unavailable | 1 | Service error / unknown (5xx) | Retry with backoff, then report instability. |
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
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.