Reference
Alter CLI
Manage apps, keys, agents, providers, secrets, grants, and audit logs from the command line.
alter is the command-line client for the Alter developer portal. The day-to-day dashboard operations — create apps, mint keys, configure providers, issue managed-secret grants, read the audit log — are available as scriptable commands, authenticated with a Personal Access Token (PAT). A few org-wide and destructive operations stay dashboard-only by design (see What’s not in the CLI).
It’s built for two audiences: operators who’d rather stay in the terminal than click through the dashboard, and CI pipelines that need to provision Alter resources as part of a deploy.
Install
Section titled “Install”npm install -g @alter-ai/clialter --versionRequires Node 20.10 or later. The binary is named alter.
The developer portal shows these first commands too — in the Coding agent tab of the dashboard’s Use it from your code card (open it if it is folded), and behind the CLI & MCP button in the header (inside an application it adds alter link pinned to that application) — alongside the Alter Docs MCP server setup, so a coding agent can run them for you.
Every create form in the developer portal (policy rules, API keys, agents, OAuth providers, managed secrets and their credentials and grants, webhooks, the identity provider and apps) also has a Do this with your coding agent section. Open it for a ready-to-paste prompt that has your coding agent (any coding agent with a shell, such as Claude Code, Cursor or Codex) run the exact alter command for what you have entered so far, so you can hand the step to your agent instead of clicking through the form. Or run the command yourself shows the same command to run directly. A secret never goes into the prompt: the command reads it from standard input (-) or from a file you fill in, and the prompt tells the agent never to ask for it in the chat. A webhook endpoint URL can carry a secret in its path, so the prompt has the agent read it from a file you fill in as well. A command that prints a key or signing secret once (alter keys mint, alter agents create, alter webhooks create) has its output sent to a new file in ~/alter-secrets/ in your home folder, such as ~/alter-secrets/api-key.json, and the prompt tells the agent not to read that file, so the secret stays out of the chat. The prompt runs that command in bash or zsh, in a subshell that makes ~/alter-secrets a folder only your user can open (chmod 700), creates the file empty with noclobber, so an existing file is never overwritten, and makes it readable only by your user (chmod 600) before the command writes to it. When a grant expires after a set time, its --expires-at is counted from when you copy the command, and the prompt tells the agent to check the current time before running it. Move the plain_key, api_key or signing_secret value from it into your secret store, then delete the file. When the prompt runs several commands, the agent stops at the first one that fails, so you can run the rest without creating anything twice. Organization-level policy rules and replacing an identity provider stay in the portal, and their forms say so.
Each setup page (identity provider, OAuth providers, managed secrets, agents, API keys, policies, users and webhooks) also has an Ask your coding agent about this section: a prompt to paste into your coding agent with your question. It tells the agent which app and page you are on, what the page is for and where these docs cover it, and, where the CLI can read it, the read-only alter command that shows your app’s current setup, so the answer is about your setup rather than a guess.
First commands
Section titled “First commands”Sign in
Opens the dashboard in the browser for the Authorize step, and the CLI receives a freshly-minted PAT.
alter auth loginConfirm it worked with alter auth status: it shows the active PAT, its scopes, and its expiry, and exits 3 when you are not signed in. The CLI keeps the token in the OS keychain, or in a fallback file when no keychain is available; see Credentials for every credential onboarding creates and where each belongs.
For CI and headless hosts, pass a pre-minted PAT instead.
Pin a default app
Most commands operate on one app. Pin it once per project so you don’t retype the ID. alter link takes the app’s UUID: find it in the id column of alter apps list, or create a new app and link it in one go:
alter apps list # existing app: copy its idalter link <app-id>
# or create a new app and pin itAPP_ID=$(alter apps create --name my-app --output json | node -p 'JSON.parse(require("fs").readFileSync(0, "utf8")).id')alter link "$APP_ID"Node is already required by the CLI; this command needs no JSON utility. Confirm the pin with alter link --status. If creation succeeded but linking failed, find the new app’s ID with alter apps list and run alter link <app-id>; do not create the app again.
From anywhere in that directory tree, --app becomes optional. See workspace linking.
--app also accepts the app’s name (resolved via alter apps list, so the PAT needs dashboard_apps:read); an ambiguous name errors with the candidate IDs. A UUID-shaped value is always treated as an ID — an app literally named like a UUID must be targeted by its ID. ALTER_APP_ID and the workspace pin are UUID-only.
Run a command
alter apps listalter keys listalter audit list --since 24hThe resource model
Section titled “The resource model”The CLI mirrors the dashboard’s resource model. Each namespace maps to a concept you already know from the docs:
| Namespace | Manages | Concept |
|---|---|---|
auth | Sign in / out, inspect the active PAT | — |
apps | Applications | Apps |
keys | Runtime API keys | API keys |
agents | Managed-agent identities + their keys | Agents |
providers | OAuth provider configuration | Providers |
managed-secrets | Managed-secret providers, their credentials, grants, and access | Managed secrets |
identity-providers | End-user identity provider setup + webhook lifecycle | Identity providers |
policy | App-level policy reads + policy-rule management | Policies |
audit | The audit log | Audit logs |
analytics | Read-only usage analytics | — |
grants | End-user OAuth + managed-secret grants | — |
end-users | Read-only end-user list/detail | — |
branding | Connect-widget theming | — |
approvals | HITL approvals: reads and deployment defaults, plus deciding on a person’s behalf through the approvals API | Human-in-the-loop approvals |
webhooks | Outbound webhook endpoints for approval lifecycle events | Outbound webhooks |
connect | Create a Connect session (runtime key) | — |
sdk-passthrough | One-off runtime provider requests and identity resolution | — |
The remaining top-level commands cover CLI and project operations:
| Command | Purpose |
|---|---|
pats whoami | Inspect the active PAT. |
link / unlink | Manage the current directory’s app pin. |
design / verify | Validate the integration design and implementation. |
init / doctor | Configure onboarding guidance and diagnose the integration. |
completion | Print or install static shell completion. |
self-update | Update an npm-installed CLI. |
Namespaces generally follow alter <namespace> <verb> [arguments] [flags];
root commands such as link, unlink, verify, init, doctor, and
self-update omit the verb. Run any command with --help for its full option
list.
Global flags
Section titled “Global flags”Commander provides these program-level or shared output controls:
| Flag | Effect |
|---|---|
--fields <a,b,c> | Global option. Narrow JSON / JSONL emitted through the shared formatter to specific top-level keys; inert for tables and commands that print confirmation text. |
--help | Show help for the selected command or subcommand. |
--version | Program-level version output. |
--output <format> | A per-command option on data-returning commands, not a global option. It accepts json, table, or jsonl. List commands normally default to table; object commands normally default to json. For a single-object response, jsonl falls back to pretty-printed JSON. |
See output & scripting for how to combine these in pipelines, plus the exit-code contract.
What’s not in the CLI
Section titled “What’s not in the CLI”A few dashboard operations are intentionally dashboard-only, because a single scripted call should never be able to weaken security for an entire organization:
- Minting or revoking PATs — a PAT can’t manage another PAT, including itself.
- Org-wide key policy — it affects every key and every grant in the org.
- Identity-provider re-pointing, deletion, and config reads — the CLI can create an app’s identity provider and manage its webhooks (both behind explicit, wildcard-excluded scopes), but changing or removing an already-trusted issuer, and reading the full config, stay dashboard-only.
- Org-level policy rules — rules that apply across every app in the organization are authored and read in the dashboard only. Per-app policy rules (including IP-allowlist and time-window rules) are the scriptable surface, behind their own explicit permissions.
This mirrors how GitHub keeps org-security settings web-only. The boundary is deliberate, not a missing feature.