Skip to content

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.

Terminal window
npm install -g @alter-ai/cli
alter --version

Requires 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.

Sign in

Opens the dashboard in the browser for the Authorize step, and the CLI receives a freshly-minted PAT.

Terminal window
alter auth login

Confirm 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:

Terminal window
alter apps list # existing app: copy its id
alter link <app-id>
# or create a new app and pin it
APP_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

Terminal window
alter apps list
alter keys list
alter audit list --since 24h

The CLI mirrors the dashboard’s resource model. Each namespace maps to a concept you already know from the docs:

NamespaceManagesConcept
authSign in / out, inspect the active PAT—
appsApplicationsApps
keysRuntime API keysAPI keys
agentsManaged-agent identities + their keysAgents
providersOAuth provider configurationProviders
managed-secretsManaged-secret providers, their credentials, grants, and accessManaged secrets
identity-providersEnd-user identity provider setup + webhook lifecycleIdentity providers
policyApp-level policy reads + policy-rule managementPolicies
auditThe audit logAudit logs
analyticsRead-only usage analytics—
grantsEnd-user OAuth + managed-secret grants—
end-usersRead-only end-user list/detail—
brandingConnect-widget theming—
approvalsHITL approvals: reads and deployment defaults, plus deciding on a person’s behalf through the approvals APIHuman-in-the-loop approvals
webhooksOutbound webhook endpoints for approval lifecycle eventsOutbound webhooks
connectCreate a Connect session (runtime key)—
sdk-passthroughOne-off runtime provider requests and identity resolution—

The remaining top-level commands cover CLI and project operations:

CommandPurpose
pats whoamiInspect the active PAT.
link / unlinkManage the current directory’s app pin.
design / verifyValidate the integration design and implementation.
init / doctorConfigure onboarding guidance and diagnose the integration.
completionPrint or install static shell completion.
self-updateUpdate 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.

Commander provides these program-level or shared output controls:

FlagEffect
--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.
--helpShow help for the selected command or subcommand.
--versionProgram-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.

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.

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand how our website, product, and documentation are used.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

Advertising

Shares visits and sign-ups with Meta, Reddit, and X so we can measure which of our ads work.

You can change these choices at any time from Cookie settings.