Castia CLI command reference
This page separates the CLI grammar from the Operator capabilities the server actually advertises. The CLI is generic: a command can be syntactically valid while the server still rejects an unavailable capability. Always discover the current server before automating it:
castia capabilities list --json
castia capabilities show company.show@v1 --jsonpublic grammar
This block is checked against castia --help in CI.
Usage: castia [global options] <command>
Commands:
auth login|logout|status
org list|show|use
token create|list|revoke
usage [--days <1-365>]
usage history [--cursor <opaque>] [--limit <1-100>]
credits
credits controls [set --input <@file|->]
capabilities list|show
work [--needs-human]
list <resource>
show <kind:id>
do <action@v1> [kind:id]
approve <operation-id> --fingerprint <hash>
reject <operation-id> --reason <text>
wait <operation-id> [--follow]
watch <operation-id>
watch <kind:id>
operation show|cancel <operation-id>
config list|get|set
doctor
completion bash|zsh|fish|powershell
version
Aliases: login, whoami, capabilities, inspect, run, follow
Global options:
--org <id> --profile <name> --url <https-origin>
--json --jsonl --quiet --dry-run --wait
--input <@file|-> --idempotency-key <key> --expected-revision <revision>
--cursor <cursor> --after <cursor> --limit <1-100>
--days <1-365>
--fingerprint <hash> --reason <text>
--needs-human --view <evidence|audit|review>--json emits one versioned envelope. --jsonl emits newline-delimited envelopes for follow/watch flows. --quiet suppresses normal output. Those three modes are mutually exclusive. Use --input @file or --input -; action input is capped at 64 KiB. --dry-run is an offline request preview and never grants authority or starts an effect.
available Operator capabilities
The list below is checked against the production capability registry. Role and scope are minimums. revision means the action must name the exact current resource revision.
campaign-run.show@v1read one Campaign Run
membercampaign:readcampaign.audience.create@v1create a visible audience pinned to one Segment Playbook Version
membercampaign:writecampaign.audience.freeze@v1freeze the pinned audience
membercampaign:writerevisioncampaign.drafts.generate@v1create the first immutable draft revision
membercampaign:writerevisioncampaign.hold@v1hold a Campaign Run with a reason
membercampaign:writerevisioncampaign.launch@v1bind a human approval to the exact frozen launch scope
membercampaign:launchrevisionhuman approvalCurrent limitation: it starts zero delivery.campaign.outcome.record@v1record an allowlisted outcome
membercampaign:writerevisioncampaign.prepare@v1prepare the frozen Campaign Run scope
membercampaign:writerevisioncampaign.resume@v1resume a held Campaign Run
membercampaign:writerevisioncampaign.run.create@v1create a manual or mailbox-draft run from one visible audience
membercampaign:writecapability.list@v1discover capabilities and their schemas
membercapability:readcompany.archive@v1soft-archive a Company
admincompany:archiverevisionhuman approvalcompany.followup.schedule@v1schedule a Company follow-up
membercompany:writerevisioncompany.import@v1import or de-duplicate a Company
membercompany:writecompany.list@v1list visible Companies
membercompany:readcompany.research@v1run governed external Company research
membercompany:researchrevisioncompany.show@v1read one visible Company
membercompany:readcredit-controls.show@v1report whether credit-control writes are currently supported
admincredits:readCurrent limitation: writes are unavailable until a server budget policy exists.credits.show@v1read current credit balance and billing state
admincredits:readdraft.approve@v1human approval of one immutable draft revision
membercampaign:writerevisionhuman actor onlydraft.reject@v1human rejection of one immutable draft revision
membercampaign:writerevisionhuman actor onlydraft.revise@v1append an immutable draft revision
membercampaign:writerevisionicp.list@v1list published ICP selections
membericp:readicp.show@v1read one published ICP selection
membericp:readoperation.approve@v1approve one exact operation fingerprint
adminoperation:approverevisionhuman actor onlyoperation.cancel@v1cancel eligible queued or approval-held work
memberoperation:controlrevisionoperation.follow@v1stream durable operation events
memberoperation:readoperation.reject@v1reject one exact operation fingerprint with a reason
adminoperation:approverevisionhuman actor onlyoperation.show@v1read one safe operation projection
memberoperation:readsegment-playbook-version.list@v1list immutable published Segment Playbook Versions
memberplaybook:readsegment-playbook-version.show@v1read one immutable published Segment Playbook Version
memberplaybook:readusage-event.list@v1list recent credit ledger events
admincredits:readusage.show@v1read bounded credit usage
adminbilling:readcredits:readwork.list@v1list tenant-scoped Operator work
memberoperation:read
resource commands
castia list company --limit 25 --json
castia show company:COMPANY_ID --json
castia list icp --json
castia show icp:PUBLICATION_ID --json
castia list segment-playbook-version --json
castia show segment-playbook-version:VERSION_ID --json
castia usage --days 30 --json
castia usage history --limit 25 --cursor OPAQUE_CURSOR --json
castia credits --json
castia credits controls --json
castia show campaign-run:RUN_ID --view review --json
castia work --needs-human --json
castia operation show OPERATION_ID --json
castia wait OPERATION_ID --follow --jsonl
castia watch campaign-run:RUN_ID --jsonlThe optional show views are review, evidence, and audit. The server decides what each safe projection contains; the CLI does not reinterpret or expand it.
usage and credits
All four reads require an Organization admin. Use a human admin login, or an Organization-bound admin service credential with the minimum scopes needed:
| Command | Required scopes | Behavior |
|---|---|---|
| castia usage [--days 1-365] | billing:read, credits:read | Read a bounded usage summary. Omitting --days uses the server's current-period default. |
| castia usage history [--cursor ...] [--limit 1-100] | credits:read | Page through the Organization credit ledger using an opaque cursor. |
| castia credits | credits:read | Read the current balance and safe billing-state projection. |
| castia credits controls | credits:read | Read whether server-side credit controls are available; currently reports read-only/unavailable. |
These commands do not mutate balances, purchase or top up credits, open a Stripe portal, change a subscription, or issue/revoke credit grants. The server remains the authority for tenant, role, scope, period, ledger, and balance calculations.
action inputs
Every mutation should use a stable idempotency key. Actions marked with an exact revision also require --expected-revision.
| Action | Target | Required JSON input |
|---|---|---|
| campaign.audience.create@v1 | segment-playbook-version:VERSION_ID | name, relationship (cold or warm), targets (1–20 exact objects with companyId and optional companyContactId) |
| campaign.audience.freeze@v1 | campaign-run:RUN_ID | {} |
| campaign.drafts.generate@v1 | campaign-run:RUN_ID | targetId, subject, body |
| campaign.hold@v1 | campaign-run:RUN_ID | reason |
| campaign.launch@v1 | campaign-run:RUN_ID | {} |
| campaign.outcome.record@v1 | campaign-run:RUN_ID | targetId, kind (delivered, replied, meeting_booked, or converted) |
| campaign.prepare@v1 | campaign-run:RUN_ID | {} |
| campaign.resume@v1 | campaign-run:RUN_ID | {} |
| campaign.run.create@v1 | campaign-audience:AUDIENCE_ID | name, channel (manual or personal_draft), and 1–2 exact variants with key, subjectTemplate (1–500 characters), bodyTemplate (1–3,500 characters); optional routingMode, angle; personal_draft also requires senderMailboxId and accepts dailyDraftLimit, draftTimeZone |
| company.archive@v1 | company:COMPANY_ID | {} |
| company.followup.schedule@v1 | company:COMPANY_ID | followUpDate; optional followUpReason, temperature, draftMessage |
| company.import@v1 | none | exactly one of url or domain; optional Company/contact fields |
| company.research@v1 | company:COMPANY_ID | optional campaignPlayId |
| draft.approve@v1 | campaign-run:RUN_ID | targetId, revisionId, revision, contentHash |
| draft.reject@v1 | campaign-run:RUN_ID | approval fields plus reason |
| draft.revise@v1 | campaign-run:RUN_ID | targetId, previousRevisionId, previousRevision, subject, body |
castia do campaign.audience.create@v1 \
segment-playbook-version:PLAYBOOK_VERSION_ID \
--input @audience.json \
--idempotency-key audience-PLAYBOOK_VERSION_ID-1 \
--wait --json
castia do campaign.run.create@v1 campaign-audience:AUDIENCE_ID \
--input @run.json \
--idempotency-key run-AUDIENCE_ID-1 \
--wait --json
castia do company.followup.schedule@v1 company:COMPANY_ID \
--input @follow-up.json \
--expected-revision 2026-08-12T08:00:00.000Z \
--idempotency-key followup-COMPANY_ID-20260812 \
--wait --jsonExample creation files use only caller-selectable fields; Organization, actor, role, playbook pin, run relationship, mailbox owner, delivery policy, provider fields, and internal revisions remain server authority:
{"name":"Founder audience","relationship":"cold","targets":[{"companyId":"COMPANY_ID"}]}{"name":"Founder campaign","channel":"manual","variants":[{"key":"control","subjectTemplate":"Hello","bodyTemplate":"Body"}]}Manual creation is bound to draft_only; personal draft creation is bound to mailbox_draft_only. Neither action sends a message or starts delivery.
approval, rejection, cancellation
Approval is a separate human command bound to the receipt's current fingerprint:
castia approve OPERATION_ID \
--fingerprint 64_CHARACTER_LOWERCASE_HEX \
--expected-revision 1 \
--idempotency-key approve-OPERATION_ID-1 \
--json
castia reject OPERATION_ID --reason "Scope is not approved" --json
castia operation cancel OPERATION_ID --jsonIf approve omits --expected-revision, the CLI first reads the safe operation projection and derives the revision only when the fingerprint still matches exactly. Reject and cancel also inspect before executing and bind to the current revision and fingerprint.