Reference
alter managed-secrets
Manage managed-secret providers, the credentials they hold, their grants, and effective access.
Managed secrets are backend-only credentials (API keys, signing secrets) that Alter stores and injects into outbound requests — no OAuth user involved. These commands cover the full lifecycle: the providers themselves, the credentials (keys) each one holds, the grants that hand a credential to principals, and the helpers that answer “who can reach this provider.”
Each entry you create is a per-app provider (its template, injection rules, allowed hosts and delegation policy). It holds one or more credentials — a developer’s keys, such as separate production and staging keys for the same API, and the keys end users store for themselves. Every grant serves exactly one credential, and a delegation always uses its parent grant’s credential.
Every provider has an id and a slug, and several providers may share a display name or a template:
-
The commands on this page take the provider’s slug or id:
<provider>is theslugfield or theidfield (theSLUGandIDcolumns oflist). A slug is 1–50 lowercase letters, digits and hyphens; a value that is neither a slug nor a UUID exits2before any request. Alter never generates a UUID-shaped slug, so a UUID is read as the id. A slug is matched exactly, case included, among the app’s active providers. When no active provider in the app has that slug, the command changes nothing, exits4, and prints:alter: no provider with slug "stripe-2" in this app (run alter managed-secrets list)Looking up a slug reads the app’s providers, so it also needs
dashboard_secrets:read(without it the command exits7). A provider created before Alter stopped generating UUID-shaped slugs may still hold one, so an id is first checked against the same read: when an active provider has that value as its slug, the command refuses it as ambiguous, exits2, and names that provider’s id. A token withoutdashboard_secrets:readskips the check and passes the id. -
Runtime calls name a provider by its slug: the
slugfield, theSLUGcolumn oflist. It is what the SDK takes asprovider. It is generated from the name, unique among the app’s active providers, with-2,-3, … appended when the base slug is taken.delete --confirmalso takes the slug. -
A template id such as
openaionly picks the injection format, host rules and setup copy. It never names a provider.
alter managed-secrets templatesalter managed-secrets setup-guide --template <id>alter managed-secrets listalter managed-secrets show <provider>alter managed-secrets create (--input <path> | --name <name> [--credential-value <value> | --credentials <@file.json>] [--credential-label <label>]) [...]alter managed-secrets rotate <provider> (--input <path> | --credential-value <value> | --credentials <@file.json> | --credential-field <k=v> ...) [--credential-id <credential-id>] [--template <template-id>] [--skip-preflight] [--confirm-template-migration <slug>]alter managed-secrets credentials list | add [--in-portal] | rotate | rename | deletealter managed-secrets delete <provider> [--confirm <slug>]alter managed-secrets access <provider>alter managed-secrets set-delegation-policy <provider> [--allow-group-delegation | --no-allow-group-delegation] [--max-delegation-ttl-days <days>] [--delegable | --no-delegable] [--max-delegation-depth <n>]alter managed-secrets set-allowed-hosts <provider> --host <host> [--host ...] | --clearalter managed-secrets set-end-user-key-setup <provider> [--scope <scope> ...] [--instructions <text>] [--binding-host <host> ...] [--clear-scopes] [--clear-instructions] [--clear-binding-hosts] | --clearalter managed-secrets set-integration <provider> [--logo <file> | --clear-logo] [--preflight-host <host> --preflight-path <path> | --clear-preflight]alter managed-secrets operations list | set | delete | set-spec | syncalter managed-secrets usersalter managed-secrets groups list | show <group-id>alter managed-secrets grants list | list-for-agent | get | create | update | revokeAll commands are app-scoped — pass --app <id> (or the app’s name), or link a workspace / set ALTER_APP_ID. Reads need dashboard_secrets:read; create / rotate / set-delegation-policy / set-allowed-hosts / set-end-user-key-setup / set-integration / grant create + update need dashboard_secrets:write; grants revoke needs dashboard_secrets:admin (the revoke tier, matching grants revoke); operations set, operations delete, operations set-spec and operations sync need dashboard_secrets:operations, and so does create with --operation-spec-url (or an operation_spec_url in its --input body), because they change what policy rules bind to and a remap can stop a deny rule matching, so no wildcard grants it (dashboard_secrets:* and :admin included) and the scope must be typed at mint (operations list needs dashboard_secrets:read); a custom provider’s key check — --preflight-host and --preflight-path on create and set-integration, and set-integration --clear-preflight — also needs dashboard_secrets:preflight, because it decides where saved keys are sent to be checked, and is wildcard-excluded the same way. A token missing either exits 7, and the CLI names the scope and the flags that needed it on stderr. delete and credentials delete need dashboard_secrets:delete. credentials list needs dashboard_secrets:read; credentials add, rotate and rename need dashboard_secrets:write.
templates
Section titled “templates”List the managed-secret template catalog for the app (openai, aws, …). Templates pre-fill the credential type and injection rules.
alter managed-secrets templates--limit accepts 1–1000 (default 200); --offset defaults to 0.
The table’s CREDENTIAL FIELDS column is the authoritative mapping from a
template’s form_schema to CLI flags. A schema field named project_url, for
example, is entered unchanged as
--credential-field project_url=<PROJECT_URL>. Required fields have no suffix;
optional fields are marked (optional). The BINDING column names the form
field a bound template derives its allowed hosts from (Supabase Project APIs
shows project_url); — means the template declares no binding field. Most
— templates have an operator-editable allowlist — Supabase Management is the
exception: its allowlist is permanently bound to the fixed Supabase management
host with no form field, so it shows — yet is immutable, as described under
set-allowed-hosts below. --output json and --output jsonl retain the
complete form_schema and the binding field for scripts.
setup-guide
Section titled “setup-guide”Print how to get a key for a template, for a person to follow in the provider’s console: the console (console_name, console_url), its steps (steps), the console field that shows the key (key_field_name), the fields a key consists of (credential_fields, where secret marks a value to type only in the portal) and, for a template whose API host comes from the key, binding_field. next_commands creates the provider and stores the key with credentials add --in-portal, so the key never passes through the terminal.
| Flag | Default | Description |
|---|---|---|
--template <id> | required | A template id from templates. An unknown id exits 2. |
--output <format> | json | json or jsonl for scripts; table prints the guide as text for a person. |
alter managed-secrets setup-guide --template resend --output tableWhen each end user stores their own key instead, skip the credential: create the provider without one, then set what the hosted page asks for with set-end-user-key-setup.
list / show
Section titled “list / show”alter managed-secrets listalter managed-secrets show <provider> # never exposes a credential valuelist accepts --limit 1–1000 (default 100), --offset (default 0) and
--search <substring>, a case-insensitive match on the provider’s name or slug
(up to 255 characters), so one provider can be found by name in an app that
holds more providers than one page.
list prints ID (the id field) and SLUG (the slug field, which the
SDK takes as provider); the other commands on this page take either one as
<provider>. The slug is printed in full, never truncated. Two providers can
share a NAME; the slug and the id tell them apart.
list also prints CREDENTIALS, the number of developer credentials the
provider holds (the developer_credential_count field), and USER_KEYS, the
number of end users who stored their own key for it (the
end_user_credential_count field); each is — against a backend that does
not report it. show returns the same fields, and show and list --output json also carry the provider’s end-user key setup:
end_user_key_scopes, end_user_key_instructions, binding_host_patterns,
and the template’s scope catalog, template_api_key_scopes.
list also prints CUSTOM_LOGO: a custom provider’s uploaded logo, as its
logo_fingerprint field (the first 16 hex characters of the image’s SHA-256),
or — when it has none. A list never carries the image itself:
has_custom_logo says whether there is one, and logo_url is null for it.
show returns the image in logo_url, as a data image.
Both print UPDATED alongside CREATED. UPDATED is the last write to the
provider — a developer credential’s rotation, addition or deletion, or a metadata
edit such as the delegation policy or the allowed-host list (an end user’s own
key does not move it) — so it answers “when was this credential last changed?”
without reading the audit log. rotate returns the same field on its
response, which is how a script confirms the rotation it just issued landed.
create
Section titled “create”Create a provider. With a key (--credential-value, or a credential_value in --credentials), the same call stores it as the provider’s first developer credential and creates its base grant; the response carries the new credential’s credential_id and credential_label fields. Without a key, it creates a provider that holds no credential and no grant yet — see creating without a credential. --name is required unless you supply a full --input body.
The slug is server-generated from --name — the name is slugified (e.g. Stripe Production → stripe-production), with a -<N> suffix appended only if that slug is already taken among the app’s active providers. Names need not be unique: a second provider named Stripe gets the slug stripe-2, so read the slug from the response instead of deriving it from the name. The slug is the stable handle runtime calls use: the SDK’s provider, Connect sessions, and the SDK’s grant filters. A stale request body that still ships a slug field is silently ignored.
The new provider’s slug is the response’s slug field — pass it as provider in the SDK — and its id is the id field; the other commands on this page take either one. On stderr the CLI prints the generated slug and names both fields, for example:
alter: created provider "Stripe" with slug stripe-2. The slug is in the `slug` field: pass it as `provider` in the SDK. The managed-secrets commands take the slug or the `id` field.| Flag | Description |
|---|---|
--name <name> | Display name; need not be unique. The slug is generated from it. Required in per-field mode; omitted when --input supplies the body. |
--description <text> | Free-form description. |
--template <id> | Template ID (e.g. openai): the injection format and host rules, never the provider’s address. Omit for a custom provider. |
--credential-type <type> | bearer_token (default), header_key, basic_auth, or aws_sig_v4. |
--credential-value <value> | Primary credential. Omit it (with --credentials holding no credential_value) to create a provider with no credential. See credential intake. |
--credential-label <label> | Name of the first developer credential (default Default), up to 255 characters. Labels are unique, ignoring case, among the provider’s active developer credentials. Requires a key. |
--credentials <@file.json> | Multi-field credentials as a JSON object — preferred for multi-field types. |
--credential-field <k=v> | Repeatable; sets the matching form_schema.fields[].name exactly as printed by managed-secrets templates. |
--injection-header <name> | Header to inject into (default Authorization). |
--injection-format <template> | Header value template (default Bearer {token}). |
--injection-rule <@file.json> | Path-prefixed JSON array of up to 10 additional injection rules; see the shape below. |
--label <label> | Base-grant display label. |
--account-identifier <id> | Optional account identifier metadata stored on the base grant. |
--account-display-name <name> | Optional account display name metadata. |
--allow-group-delegation | Allow members of a group-typed grant on this provider to delegate it to an agent (default: off). |
--max-delegation-ttl-days <days> | Cap on a single delegation’s lifetime, 1–1825 days (default 90). |
--delegable | Developer ceiling: allow grants under this provider to be marked re-delegable, gating onward agent → agent delegation for the whole provider (default: off). |
--max-delegation-depth <n> | Max delegation-chain depth under this provider, 0–8 (global cap is 8). |
--skip-preflight | Save without the provider credential check (audited; use only when the provider endpoint is unavailable). The response’s preflight summary reports skipped so the unverified state is never silent. |
--allowed-host <host> | The provider’s proxy destination allowlist, as set-allowed-hosts --host sets it: exact or leading-wildcard, repeatable or comma-separated, checked locally with the same grammar (exit 2). A custom provider’s --preflight-host must be one of its exact hosts. |
--input <path> | JSON body from a file (@path) or stdin (-); replaces the per-field flags. |
# Single-field bearer token, value piped from stdinprintf '%s' "$OPENAI_KEY" | alter managed-secrets create \ --name "OpenAI" --template openai --credential-value -Creating without a credential
Section titled “Creating without a credential”Omit --credential-value to create the provider first and store keys later with credentials add. Such a provider has no grant, so nothing can use it until a credential is added and a grant is created for it. The flags that describe a key or its base grant (--credentials, --credential-field, --credential-label, --label, --account-identifier, --account-display-name, --skip-preflight) need a key; the CLI rejects them with a usage error (exit 2) instead of sending a body the backend would refuse.
alter managed-secrets create --name "OpenAI" --template openaiprintf '%s' "$OPENAI_PROD_KEY" | alter managed-secrets credentials add <provider> \ --label Production --credential-value -# or let the operator type the key in the Developer Portal:alter managed-secrets credentials add <provider> --label Production --in-portalCustom providers
Section titled “Custom providers”Omitting --template creates a custom provider for an API outside the provider catalog — the operator supplies the injection contract the catalog would otherwise provide (see Connect a custom API):
# Custom header-key API, value piped from stdin. Custom providers derive no# allowed hosts: set the egress allowlist explicitly, or proxied calls for the# provider are blocked (change it later with set-allowed-hosts below)printf '%s' "$BILLING_API_KEY" | alter managed-secrets create \ --name "Internal Billing API" \ --credential-type header_key \ --injection-header X-Api-Key \ --injection-format '{token}' \ --allowed-host billing.internal.example.com \ --credential-value -A custom provider’s --injection-rule entries each read a field (additional_credentials.<field>), and a rule sends nothing while its field has no value. A key saved without one is still accepted: create, credentials add and rotate exit 0, print alter: warning (injection_field_missing): … on stderr, and return the entry in the response’s warnings field (code, field, message; code is stable, branch on it). Set the field with a fields-only update. The dashboard shows the same warning. A template’s own rules are governed by its schema.
A custom provider with --credential-type aws_sig_v4 is for a SigV4 service outside AWS (for AWS itself, the aws template is the usual choice). Alter signs each request and sets the Authorization header, so it needs no --injection-header or --injection-format. A key needs its secret_key field, which the CLI checks before sending as the dashboard does; session_token (temporary STS credentials), region and service are optional, and region / service are checked the backend’s way.
A custom provider can also carry what a template would otherwise bring (see Connect a custom API), on create or later with set-integration and operations:
| Flag | Description |
|---|---|
--logo <file> | A PNG, JPEG or WebP logo end users see on the hosted Connect page and in their wallet. The type is read from the file’s bytes. The CLI does not resize: a file over 112,482 bytes (about 110 KB) is refused from its size, before it is read (exit 2); resize it to 128px, or upload it from the dashboard, which resizes it. Stored as the response’s logo_url field (a data image), with has_custom_logo true and its logo_fingerprint. |
--preflight-host <host> | With --preflight-path: the host every saved key is checked against. It must be one of the provider’s exact allowed hosts (an --allowed-host that is not a wildcard), because the check sends the key, and only where the proxy would. The preflight_host field. Needs dashboard_secrets:preflight. |
--preflight-path <path> | With --preflight-host: a path there that answers 401 to a bad key, such as /v1/me. Every saved key is checked with a GET to https://<preflight-host><path>. The preflight_path field. Needs dashboard_secrets:preflight. |
--operation-spec-url <url> | The https URL of the API’s OpenAPI document (up to 2 MB), with no user name, password or credential-shaped query parameter (such as token or key): the document is fetched without credentials, and the URL is shown to everyone who reads the provider. The create queues a pull and returns at once with operation_spec_status pending; the CLI prints the created provider, then waits for the pull and says on stderr how it went: the operations adopted (and what changed), the reason it failed, or that it is still pending. The command exits 0 in every case, because the provider was created; read the pull’s state later with operations list. The pull then repeats daily. Needs dashboard_secrets:operations. |
--no-wait | With --operation-spec-url: return once the pull is queued. |
--wait-timeout <seconds> | With --operation-spec-url: how long to wait for the pull, 1–1800 (default 180, enough for the slowest pull Alter allows); a pull still pending then is reported as a warning. Mutually exclusive with --no-wait. |
The custom flags (--logo, --preflight-host, --preflight-path, --operation-spec-url) apply to a custom provider only: with --template, the CLI refuses them (exit 2), as the backend does (custom_integration_only). An --input body gets the same checks: its logo, preflight_host, preflight_path and operation_spec_url are refused alongside a template_id, logo must be a base64 PNG, JPEG or WebP data image within the size cap, and preflight_host must be one of the body’s own exact allowed_hosts. Every value is checked locally first, with the rules the backend and the dashboard apply (surrounding spaces are trimmed, as the backend trims them): a key-check host that is not one of the exact allowed hosts, a host without a path, a path that does not start with /, a URL that is not https or carries credentials, an image that is not PNG, JPEG or WebP. A refusal is a usage error (exit 2) that names the flag or field and the reason.
The credential preflight checks a custom provider’s key only when it has a key check (--preflight-host and --preflight-path). Otherwise it reports skipped and the message says why — it has no key check; it sends its credential in more than one place (extra headers or query parameters); it uses AWS Signature V4, which signs each request and cannot be reproduced by one check request; or its check host is not one of its allowed hosts — and the credential is verified on first use. The same reason is the provider’s preflight_skip_reason field, which create and set-integration print on stderr.
Supabase Project and Management contracts
Section titled “Supabase Project and Management contracts”Supabase exposes separate project and account-management contracts. Use a project key (sb_publishable_, sb_secret_, or a legacy project JWT) with the Project APIs template and supply its exact Project URL:
alter managed-secrets create \ --name "Supabase Project APIs" \ --template supabase \ --credential-value @./supabase-project-key \ --credential-field project_url=https://PROJECT_REF.supabase.coUse an sbp_ personal access token with the Management API template:
alter managed-secrets create \ --name "Supabase Management" \ --template supabase-management \ --credential-value @./supabase-management-patThe CLI and backend reject unknown or cross-product credential shapes. Both templates own their injection contract, so --injection-rule, additional_injections, custom injection headers, and custom injection formats cannot override it. Project credentials are bound to exactly PROJECT_REF.supabase.co and Supabase’s documented /rest/v1, /auth/v1, /storage/v1, /functions/v1, /realtime/v1, and /graphql/v1 surfaces; Management credentials are bound to exactly api.supabase.com. set-allowed-hosts cannot widen or clear either binding.
Rotating a historical supabase row with an sbp_ PAT can atomically reclassify it as supabase-management, remove the project binding, and repoint every existing grant. This one-way action requires --confirm-template-migration <slug>, where <slug> exactly matches the target provider’s slug. An --input body may instead carry the same slug in the backend wire field "confirm_template_migration"; if both forms are supplied, they must match. Current v2 Project API providers cannot be converted in place; create a separate Management provider. The CLI normally reads the current template to mirror dashboard validation. Passing --template skips that lookup for ordinary rotations; a Data-template PAT migration still reads the target so it can verify the slug and eligibility before the mutating request. The server independently rechecks the exact slug, template, contract version, and credential class before storing anything and again under the mutation lock. When the reclassification happens, the response’s template_migration field names the old and new template (from_template_id, to_template_id), and the CLI prints alter: template corrected — <message> on stderr.
Credential preflight
Section titled “Credential preflight”Where the template supports it, the credential is verified against the provider at save time, and the CLI prints the verdict on stderr — exactly what the dashboard shows inline:
passed— the provider accepted the credential.inconclusive— verification couldn’t complete (for example a transient network issue). The save proceeds; verify the key with a test call.skipped— the credential type can’t be probed, or a custom provider’s key can’t be checked (it has no key check, or another reason the message names — see custom providers). The save proceeds unverified; the message names why.
A credential the provider definitively rejects fails the save with a structured error and nothing is stored. The same verdicts print on rotate.
Credential intake
Section titled “Credential intake”The primary credential value (--credential-value) accepts three forms, in decreasing order of safety:
| Form | Reads from |
|---|---|
--credential-value - | All stdin through EOF (preferred for CI). Surrounding whitespace is trimmed; embedded CR, LF, or null characters are rejected. |
--credential-value @/path/to/file | A file. |
--credential-value <value> | Inline — prints a shell-history warning. |
Multi-field credential types (such as aws_sig_v4, which needs an access key, secret key, and region) take either --credentials @file.json (a JSON object of string fields — it may also include a top-level credential_value to satisfy the primary value in one file) or repeated --credential-field key=value flags. If both are supplied, the file wins and the flags are ignored with a warning.
Run alter managed-secrets templates before create or rotation. Each
form_schema.fields[].name maps unchanged to the flag key. Required fields are
validated by the CLI and backend; provided optional fields must satisfy their
template pattern. Field values are trimmed, except a field whose template sets
trim_whitespace: false (a password whose edge spaces are part of it), which is
stored exactly as typed. A value of only whitespace is blank either way. For Twilio, for example, the Account SID is the primary value
and auth_token is the required secondary field:
alter managed-secrets create \ --name "Twilio" \ --template twilio \ --credential-value @./twilio-account-sid \ --credential-field 'auth_token=<AUTH_TOKEN>'The placeholder command shows the exact key mapping only. For shell-history
safety, put the real values in one protected JSON file and pass
--credentials @file.json; the object can contain credential_value plus
every printed secondary field.
The file form also reads the complete file and trims surrounding whitespace; embedded CR, LF, or null characters are rejected in every primary-credential input form.
Each --injection-rule entry is
{"target":"header|query_param","key":"<name>","value_source":"token|additional_credentials.<snake_case_field>"}.
key must start with a letter, contain only letters, digits, -, or _, and
be 1–100 characters. The file must begin with @, contain a JSON array, and
hold at most 10 entries.
On an aws_sig_v4 provider the rules are applied before the request is signed,
so the signature covers them. A rule that sets a header the signature sets
(Authorization, X-Amz-Date, X-Amz-Content-Sha256,
X-Amz-Security-Token), a header the proxy reserves (such as X-Api-Key or
Cookie) or the provider’s own injection header, a query parameter named
like a presigned-URL authentication field (X-Amz-Algorithm,
X-Amz-Credential, X-Amz-Date, X-Amz-Expires, X-Amz-SignedHeaders,
X-Amz-Signature, X-Amz-Security-Token, in any casing), or that reads
additional_credentials.secret_key or additional_credentials.session_token,
is refused: the create fails with managed_secret_credential_fields_invalid
and the response’s fields entry names the rule (additional_injections[<i>].key
or additional_injections[<i>].value_source).
Provider templates may make injection rules immutable. Supabase Project APIs and Management are header-only provider contracts and reject additional injection rules, including query-parameter injection.
rotate
Section titled “rotate”Swap a stored developer credential while the grants it serves keep working: the credential keeps its id, only its key changes. Same credential-intake forms and precedence as create: provide --credential-value, a credential_value in --credentials, or an --input body containing credential_value. To change only a template field and keep the key, leave the key out (see Update fields and keep the key).
Without --credential-id, rotate targets the provider’s only developer credential. Once a provider holds several, pass --credential-id <credential-id> (an id from credentials list); without it the backend refuses with credential_id_required and the CLI prints the choices, one <id> <label> per line, and exits 5. credentials rotate is the same operation with the credential named positionally. An end user’s own key is theirs, so rotating it is refused (credential_user_owned).
With --credential-id, --template remains a local precondition only (the per-credential request does not carry one), so an --input body that contains expected_template_id is rejected; pass --template instead.
The CLI reads the template catalog to apply the same required-field and pattern
checks as the dashboard. It also reads the target provider to discover its current
template unless you pass --template <template-id> (or
expected_template_id in --input) as an explicit optimistic precondition.
dashboard_secrets:write already implies read access. The explicit precondition
usually avoids reading the target provider (a Supabase Data-template PAT
migration still reads the target to verify the slug and eligibility), but the
catalog lookup remains so the template’s credential contract cannot drift
between CLI and dashboard. A provider bound to a template the catalog no longer
lists (a deprecated template) still rotates: the CLI notes that local field
validation was skipped and the server validates against the provider’s own
stored template.
With --input, --template is an allowed sideband precondition only when the
JSON body does not contain expected_template_id; supplying both is rejected
instead of silently weakening either value. The server verifies the
precondition atomically; a concurrent template change returns conflict instead
of applying validation for the wrong template.
For multi-field templates, rotation keeps every stored field that pairs with
nothing the new key replaces. Required secret (password) fields shown by
managed-secrets templates are the rotating credential and must be passed
again: Twilio’s auth_token, for example. Everything else is inherited from
the stored credential when omitted: text fields (subdomains, hosts, project
URLs) and optional secret fields, which are separate credentials the key works
without (Datadog’s application_key). Omitting Supabase’s project_url keeps
its current exact project host; omitting Shopify’s store_subdomain keeps the
stored store; omitting a bound template’s binding field (the deployment
endpoint or application ID named on the template) keeps the stored value and
its derived allowed hosts. Provide a field explicitly only to change it; for a
bound template, rotating with a new binding value is also how the derived
allowlist is retargeted.
A custom provider has no template, so its fields are the
ones its injection rules read (additional_credentials.<field>). A rotation
keeps each of them from the stored credential when omitted, so the rule keeps
sending its header or query parameter; pass --credential-field <field>=...
only to replace one.
An aws_sig_v4 provider (the aws template or a custom one) keeps a stored
region and service: they describe the destination rather than the key, and
the signer uses them when the request host names neither (a custom domain).
Set either with --credential-field region=<region> or
--credential-field service=<service> on create, credentials add or
rotate; the CLI checks them as the backend and the dashboard do (region an
AWS region such as us-east-1, service lowercase letters, digits and
hyphens) before sending. A stored value can be replaced but not cleared: a
region or service the request host names always wins, so a stored one only
ever applies where the host names neither, and clearing it would leave those
calls unable to sign. A
new access key ID needs its own secret_key, and the CLI refuses the rotation
without it, as the dashboard does; a stored STS session_token belongs to the
old key pair and is not kept, so pass the new one with the new key.
Pass --skip-preflight only when the provider verification endpoint is unavailable. It is an audited query-side escape hatch in both per-field and --input modes; the credential body is unchanged, and the response reports the preflight as skipped so the unverified rotation is explicit.
--confirm-template-migration <slug> is only for the historical Supabase Project APIs → Management API repair described above. The exact slug binds confirmation to one target and prevents a reused rotation command from reclassifying a different provider. It does not weaken the server’s template, contract-version, or credential-class checks.
printf '%s' "$NEW_KEY" | alter managed-secrets rotate <provider> --credential-value -Update fields and keep the key
Section titled “Update fields and keep the key”To change only a template field, such as an API user’s password, leave the key
out: pass the fields with --credential-field, with --credentials @file.json
holding no credential_value, or with an --input body that has
additional_credentials and no credential_value. The stored key is kept and
only the fields you pass change. Every field you leave out keeps its stored
value, secret fields included. credentials rotate and rotate --credential-id
do the same for one named credential.
The save runs the same preflight as a rotation, on the
stored key with the new fields, and prints the verdict on stderr, followed by
alter: kept the stored key; updated <field names>. The response has the same
shape as a rotation’s, including its preflight summary.
A field name the credential does not have is refused with
managed_secret_credential_fields_invalid, so a typo cannot save while the old
value keeps working. The CLI refuses a whitespace-only value before sending, and
refuses --confirm-template-migration, because only a new key can reclassify a
provider. A provider that holds no stored key has nothing to keep; store one
with credentials add first.
Pass a secret field through a file or stdin rather than --credential-field,
which leaves the value in shell history:
jq -n --arg pw "$NEW_PASSWORD" '{additional_credentials: {password: $pw}}' \ | alter managed-secrets rotate <provider> --input -credentials
Section titled “credentials”The credentials (keys) a provider holds. Each grant serves one of them.
alter managed-secrets credentials list <provider> [--kind <kind>] [--status <status>]alter managed-secrets credentials add <provider> --label <label> (--credential-value <value> | --credentials <@file.json>) [--credential-field <k=v> ...] [--skip-preflight]alter managed-secrets credentials rotate <provider> <credential-id> (--input <path> | --credential-value <value> | --credentials <@file.json> | --credential-field <k=v> ...) [...]alter managed-secrets credentials rename <provider> <credential-id> --label <label>alter managed-secrets credentials delete <provider> <credential-id> [--confirm <label>]credentials list
Section titled “credentials list”alter managed-secrets credentials list <provider>alter managed-secrets credentials list <provider> --kind end_user --output jsonLists metadata only — never a key. --kind is developer or end_user (the keys end users store for themselves); --status is active (the default), deleting or revoked. --limit accepts 1–200 (default 50); --offset defaults to 0.
| Column | JSON field | Meaning |
|---|---|---|
ID | id | The credential id that grants create --credential-id, rotate --credential-id and the other credentials commands take. |
KIND | kind | developer or end_user. |
LABEL | label | Operator-facing name. |
STATUS | status | active, deleting or revoked. |
PREVIEW | credential_preview | A masked preview of a developer key; — for an end user’s key. |
HOSTS | allowed_hosts | The key’s own hosts, for a provider that takes its host from the key (comma-separated); — otherwise. |
HEADERS | connection_headers | The non-secret headers Alter sends on every call with this key, taken from its fields (Header=value, comma-separated); — for a provider that declares none. |
OWNER | owner | The end user who owns the key (their email); — for a developer credential. |
USER_OWNED | user_owned | yes for an end user’s own key: you can delete it (credentials delete) and nothing else, since rotating or renaming it is refused with credential_user_owned (exit 7). ? means the backend did not report it. |
GRANTS | grant_count | Active grants served by the credential. |
PREFLIGHT | preflight_status | The last save-time preflight verdict. |
ROTATED / CREATED | rotated_at / created_at | Timestamps. |
--output json keeps the full envelope (credentials, total, limit, offset, has_more) and every field, including owner.app_user_id, requested_scopes, allowed_hosts, preflight_message, last_used_at, revoked_at, and a SigV4 developer credential’s stored region and service (null for any other credential). A credential’s allowed_hosts is set only for a template that derives its hosts from the key; for every other template it is null and the provider’s own allowed hosts apply to each credential. A credential’s connection_headers is a {header: value} object of the non-secret headers sent on every call, as recorded at the key’s last save, for a template that declares connection headers; for every other template it is null.
credentials add
Section titled “credentials add”Store an additional developer credential — a second key for the same API, such as a staging key next to production. It issues no grant: assign it with grants create --credential-id. The new id is the credential.id field of the response, and the CLI prints the follow-up command on stderr.
| Flag | Description |
|---|---|
--label <label> | Required. Up to 255 characters, no control characters, unique (ignoring case) among the provider’s active developer credentials; a duplicate is refused with credential_label_conflict. |
--credential-value <value> | The key, in any credential intake form. Required unless --credentials contains credential_value. |
--credentials <@file.json> | Multi-field credentials as a JSON object; takes precedence over --credential-field. |
--credential-field <k=v> | Repeatable; a form_schema field of the provider’s template. |
--skip-preflight | Store without the provider check (audited); the response’s preflight summary reports skipped. |
--in-portal | Store nothing here: print a Developer Portal link, the portal_url field, that opens the provider’s add-credential form with --label filled in, for the operator to type the key and save. Not with --credential-value, --credentials, --credential-field or --skip-preflight. |
--output <format> | json (default), jsonl, or table. |
The CLI reads the provider’s template and checks the key the way create does. A new credential inherits nothing, so every required template field must be supplied (unlike rotate, which keeps the stored fields that do not pair with the key). The preflight verdict prints on stderr. A Supabase or Twilio provider whose stored credential still needs its contract repaired refuses a second credential (provider_contract_repair_required); rotate the existing one first.
printf '%s' "$OPENAI_STAGING_KEY" | alter managed-secrets credentials add <provider> \ --label Staging --credential-value - --output json | jq -r '.credential.id'With --in-portal, the key is typed in the Developer Portal instead, so it never reaches the terminal, a file, or a coding agent driving the CLI:
alter managed-secrets credentials add <provider> --label Production --in-portal --output jsonThe portal_url field opens the provider’s page with the add-credential form open and the label filled in. The operator signs in, types the key and any template fields, and saves; the save runs the usual credential check. The link carries no secret and grants nothing without a Developer Portal sign-in to the app’s organization. Nothing is stored until the operator saves; credentials list shows the credential afterwards, and like any added credential it serves no grant until one is created.
credentials rotate
Section titled “credentials rotate”printf '%s' "$NEW_KEY" | alter managed-secrets credentials rotate <provider> <credential-id> --credential-value -The same operation, flags and checks as rotate --credential-id: the credential keeps its id and every grant it serves keeps working. Without a key it updates only the fields and keeps the stored one:
alter managed-secrets credentials rotate <provider> <credential-id> --credentials @./api-user-password.jsoncredentials rename
Section titled “credentials rename”alter managed-secrets credentials rename <provider> <credential-id> --label "Production (EU)"Renames a developer credential, with the same label rules as credentials add. An end user’s key cannot be renamed or rotated: the CLI prints credential <credential-id> is an end user's own key (credential_user_owned) with the credentials delete command you can run instead, and exits 7.
credentials delete
Section titled “credentials delete”Gated behind dashboard_secrets:delete and a type-to-confirm check against the credential’s label:
- Interactive: the CLI looks the credential up, prints how many grants the deletion revokes, and prompts for the label. This path also needs
dashboard_secrets:read. - Non-interactive (CI): pass
--confirm <label>. There is no--yesshortcut, so a script must name the credential it destroys. A wrong label is refused by the server (confirm_name_required, exit1).
alter managed-secrets credentials delete <provider> <credential-id> --confirm StagingPrints Deleted credential <id> (<label>); revoked <n> grant(s). — <n> is the response’s revoked_grant_count field.
delete
Section titled “delete”Like apps delete, it’s gated behind the separate dashboard_secrets:delete scope and a type-to-confirm check against the provider’s slug (<provider> is its slug or id; --confirm takes its slug, whichever form names the provider):
- Interactive: the CLI prompts for the slug. This path also needs
dashboard_secrets:read— it fetches the provider to show the slug in the prompt. - Non-interactive (CI): pass
--confirm <slug>. Adashboard_secrets:delete-only PAT (no:read) must use this form and name the provider by its id, since looking up a slug reads the app’s providers.
The explicit form is forwarded to the server without a read. A wrong slug is therefore rejected by the server as a generic server error (exit code 1), rather than as a local usage error.
alter managed-secrets delete <provider> --confirm openai-apiBefore the delete call the command prints Deleting provider <id> (<slug>) on
stderr, and on success Deleted provider <id>. on stdout. If the delete stops
part way (a server error such as a 503 while the stored credentials are
removed, or a lost connection), the provider is left marked for deletion: it no
longer appears in list, its slug no longer resolves, and a new provider may
take that slug. The error message says so; retry by the id from the
Deleting provider line, never by the slug:
alter managed-secrets delete <provider-id> --confirm openai-apiA slug that no active provider holds exits 4, and for delete the message
says to retry a part-way delete by that id.
access
Section titled “access”Compute the effective access for a provider — every principal that can reach it, whether directly, through a group, as a system principal, or via an agent. Use --output json to keep the full nested envelope with per-path counts.
--limit accepts 1–1000 (default 200); --offset defaults to 0.
The CREDENTIAL column is the credential each access path runs through (the entry’s credential_id field; --output json adds credential_kind). ? means the backend did not report it.
alter managed-secrets access <provider> --output jsonset-delegation-policy
Section titled “set-delegation-policy”Set the user → agent delegation policy on a provider — controls whether members of a group-typed grant may delegate it to an agent, caps a delegation’s lifetime, and sets the operator ceiling that gates onward agent → agent delegation chains. Needs dashboard_secrets:write.
| Flag | Description |
|---|---|
--allow-group-delegation | Allow members of a group-typed grant on this provider to delegate it to an agent. |
--no-allow-group-delegation | Stop members of a group-typed grant on this provider delegating it to an agent. Mutually exclusive with --allow-group-delegation. |
--max-delegation-ttl-days <days> | Cap on a single delegation’s lifetime, 1–1825 days. |
--delegable | Developer ceiling: allow grants under this provider to be marked re-delegable, gating onward agent → agent delegation for the whole provider. |
--no-delegable | Developer ceiling: refuse onward agent → agent delegation for the whole provider. Mutually exclusive with --delegable. |
--max-delegation-depth <n> | Max delegation-chain depth under this provider, 0–8 (global cap is 8). |
--output <format> | json (default), jsonl, or table. |
Pass at least one flag. The command sends only the flags passed, and Alter
keeps the stored value of every other setting, so nothing is turned off or
reset by omission, and two operators changing different settings at the same
time do not undo each other. A provider with no policy yet starts from group
delegation off, a 90-day TTL ceiling, onward delegation off, and the global
depth cap of 8. The CLI refuses conflicting flags, a run with nothing to
change, and an out-of-range number with a usage error (exit 2) before sending
anything. The command prints the updated provider; its delegation_policy field
is the stored policy. The OAuth provider counterpart is
alter providers set-delegation-policy.
# Enable group delegation with a 30-day capalter managed-secrets set-delegation-policy <provider> --allow-group-delegation --max-delegation-ttl-days 30
# Allow onward agent → agent delegation up to 3 hops deepalter managed-secrets set-delegation-policy <provider> --delegable --max-delegation-depth 3
# Change only the TTL ceiling (everything else stays as it is)alter managed-secrets set-delegation-policy <provider> --max-delegation-ttl-days 60
# Turn group delegation back offalter managed-secrets set-delegation-policy <provider> --no-allow-group-delegationset-allowed-hosts
Section titled “set-allowed-hosts”Restrict which destination hosts a provider’s credentials may be injected into when proxied — an egress allowlist that bounds where the credential can be sent. Needs dashboard_secrets:write.
| Flag | Description |
|---|---|
--host <host> | Allowed host: exact (api.stripe.com) or leading-wildcard subdomain (*.stripe.com). Repeatable, or comma-separated; both forms accumulate. Must be a bare host — no scheme, port, path, @, whitespace, or the URL delimiters ? # % \. Each label is limited to 63 characters and the whole name to 253 (251 for a wildcard suffix, since a wildcard always matches at least one more label). |
--clear | Remove all configured allowed hosts. With default enforcement, proxy calls for the provider are blocked until hosts are configured again. Mutually exclusive with --host. |
A custom provider whose saved keys are checked against one of its hosts (its preflight_host) cannot drop that host: the command changes nothing, exits 5 (preflight_host_in_use) and names the host on stderr. Move the key check to another exact host, or stop it, with set-integration first.
# Restrict to Stripe onlyalter managed-secrets set-allowed-hosts <provider> --host api.stripe.com --host '*.stripe.com'
# Clear all allowed hosts (proxy calls are blocked until hosts are configured)alter managed-secrets set-allowed-hosts <provider> --clearset-end-user-key-setup
Section titled “set-end-user-key-setup”Set what end users are shown when they store their own key for the provider on the hosted Connect page: the vendor scopes the key needs, instructions, and, for a bound template, the hosts the key may be bound to. Needs dashboard_secrets:write. The command changes configuration only and can be run again to change it back; no key, grant, or delegation is touched.
| Flag | Description |
|---|---|
--scope <scope> | A vendor scope the end user’s key needs. Repeat the flag for each scope (a value is never split on commas, because a vendor scope may contain one). Up to 100 scopes, each up to 128 printable characters with no whitespace, and together under 4,000 bytes as JSON; a repeat is ignored. When the template has a scope catalog (the provider’s template_api_key_scopes field), only its id values are accepted. The scopes are shown to the end user as guidance; Alter does not verify them against the vendor. |
--clear-scopes | Require no scopes. |
--instructions <text> | Plain-text instructions shown before the key field: the text itself, @/path/to/file, or - to read stdin. Newlines and tabs are kept (Windows and old Mac line endings are read as plain newlines), no other control character is accepted, and surrounding whitespace is trimmed; 1–4,000 characters. |
--clear-instructions | Show no instructions. An empty --instructions is refused instead, so an unset shell variable can never clear them. |
--binding-host <host> | Bound templates only (a template whose BINDING column in templates names a field, such as a deployment URL): a host the key’s derived host must match, exact (acme.example.com) or leading-wildcard (*.example.com), checked when a user stores a key and again on every call made with it. Repeatable or comma-separated, with the same grammar, normalization, and limits as set-allowed-hosts --host. |
--clear-binding-hosts | Bound templates only: remove the patterns. Users can then store no key, and keys already stored stop working until a pattern allows their host again. |
--clear | Clear the whole setup: no scopes, no instructions, no binding hosts. Cannot be combined with any other setup flag. |
--output <format> | json (default), jsonl, or table. |
Each flag replaces its whole field (a new --scope list replaces the stored list), and a field you do not name keeps its stored value: the command reads the provider first, as the dashboard’s setup card does before it saves, and sends the stored value back for every field you did not name. Pass at least one flag. The CLI refuses, with a usage error (exit 2) before saving anything, a run with nothing to change, a field flag combined with the flag that clears the same field, --clear combined with anything else, a scope outside the template’s catalog, a malformed host, and --binding-host or --clear-binding-hosts on a template that is not bound.
The server applies the same rules. When it refuses a field the template cannot take (end_user_key_setup_invalid, with unknown_scope for a scope outside the catalog and template_not_bound for binding hosts on a template that is not bound), the CLI prints the same message as its local check, names both codes, and also exits 2.
The command prints the updated provider. Its end_user_key_scopes, end_user_key_instructions, and binding_host_patterns fields are the stored setup (a cleared field reads null), and template_api_key_scopes lists the scopes the template’s keys offer (id and description; an empty list for a template with no catalog, whose scopes are free-form).
# Ask for two scopes and explain where the key is createdalter managed-secrets set-end-user-key-setup <provider> \ --scope employees:read --scope companies:read \ --instructions @./key-instructions.txt
# A bound template: only keys for the company's own deploymentsalter managed-secrets set-end-user-key-setup <provider> --binding-host '*.acme.example.com'
# Change the instructions only (scopes and binding hosts stay as they are)printf '%s' "$INSTRUCTIONS" | alter managed-secrets set-end-user-key-setup <provider> --instructions -
# Remove everythingalter managed-secrets set-end-user-key-setup <provider> --clearset-integration
Section titled “set-integration”Set or clear a custom provider’s logo and key check. Needs dashboard_secrets:write; the key-check flags (--preflight-host, --preflight-path, --clear-preflight) also need dashboard_secrets:preflight, which no wildcard grants. Only the flags given change; pass at least one.
| Flag | Description |
|---|---|
--logo <file> | A PNG, JPEG or WebP logo (about 110 KB at most; resize to 128px), as on create. |
--clear-logo | Remove the logo. Mutually exclusive with --logo. |
--preflight-host <host> | The host every saved key is checked against: one of the provider’s exact allowed hosts. Set together with --preflight-path. |
--preflight-path <path> | A path on --preflight-host that answers 401 to a bad key, checked whenever a key is saved. Set together with --preflight-host. |
--clear-preflight | Stop checking keys at save time: clears the host and the path. Mutually exclusive with --preflight-host and --preflight-path. |
--output <format> | json (default), jsonl, or table. |
The host and the path are set together; one without the other is a usage error (exit 2), as is a path that does not start with /. To check the host locally, the command first reads the provider: a host that is not one of its exact allowed hosts exits 2 and lists them (change them with set-allowed-hosts). A provider with a template exits 5 (custom_integration_only): a template brings its own logo and key check. The command prints the updated provider; its logo_url, has_custom_logo, logo_fingerprint, preflight_host and preflight_path fields are the stored values. When saved keys are not checked (no key check, or a reason such as a credential sent in more than one place), the reason is printed on stderr: the preflight_skip_reason field.
alter managed-secrets set-integration <provider> --logo ./logo.png \ --preflight-host api.example.com --preflight-path /v1/mealter managed-secrets set-integration <provider> --clear-logo --clear-preflightoperations
Section titled “operations”A custom provider’s API operations: what operation and family content rules name for it. They come from the API’s OpenAPI document (pulled when you set or sync it and then daily, and adopted on every pull) and from operations you author; an authored operation replaces a pulled one with the same id or the same route. A request that matches no operation is denied by any operation rule. On a provider with a template, every operations command exits 5 (custom_integration_only).
operations list
Section titled “operations list”alter managed-secrets operations list <provider> [--output table|json|jsonl]Lists every operation, reading every page: operation_id, method, path_template, families, summary, source (spec for a pulled operation, manual for an authored one), effective (false for a pulled operation an authored one replaces, and for every operation while the policy gate cannot use them) and aliases (the ids a renamed operation had before; rules naming them still bind it). The table shows them as OPERATION, METHOD, PATH, FAMILIES, SOURCE (pulled / authored) and IN_EFFECT, and prints on stderr the document’s URL and pull state (a pull is queued, a pull is running, pulled <time>, or the last pull failed: <reason>), how many operations the document in effect maps and how many it named that could not be classified, when the operations last changed and what changed (added, removed, renamed, re-familied, re-routed, with up to five ids each), how many operations are in effect, and why none is when the policy gate cannot use them or their state could not be read (the catalog_error field).
--output json returns the whole response, with every page’s operations in operations: spec (url, status — pending while a pull is queued or running, then ok or error —, error, synced_at, pull_requested_at, changed_at, last_change with the lists and counts of the last change a pull made, and pull_summary with spec_operations and skipped_operations), revision (advances whenever the operations change), trust (whether an organization admin trusted the family mapping, set in the dashboard), effective_count, catalog_error, max_operations (the most operations one provider may map), total, and offset / limit / has_more describing that single merged page (0, the count, false). If the operations change between two pages, the command reads them again; after three tries it exits 1. Needs dashboard_secrets:read.
operations set
Section titled “operations set”alter managed-secrets operations set <provider> <operation-id> --method <method> --path <template> --family <family> [--family ...] [--summary <text>]Authors (or replaces) one operation. <operation-id> is 1–128 characters: parts separated by /, each starting with a letter or digit and continuing with letters, digits and . _ : - — no empty part, no part starting with a dot, no leading or trailing / (the id becomes part of a URL path, where such parts would address another operation). --method is GET, PUT, POST, DELETE, PATCH, HEAD or OPTIONS; --path is an OpenAPI-style template such as /loans/{loanId} (no query, fragment or whitespace; at most two placeholders in one segment); --family is one or more of read, write, delete, send, admin, payment (repeatable or comma-separated) and must include the family the method implies (GET, HEAD, OPTIONS: read; POST, PUT, PATCH: write; DELETE: delete), with send, payment or admin added alongside it rather than instead of it. A request on / that is not a GET must include read, write, delete and admin, because its real action is in the body. --summary is at most 300 characters. The CLI checks each locally (exit 2) with the rules the backend applies; the backend also refuses, with exit 1, an operation whose route another authored operation already maps, or whose id is another operation’s id or a pulled operation’s former id (operation_invalid), or one past max_operations (operation_limit_exceeded; overriding a pulled operation never counts against it). Needs dashboard_secrets:operations.
# A pulled POST that sends disclosures, re-familied so a "send" rule binds italter managed-secrets operations set <provider> disclosures.send \ --method POST --path '/loans/{loanId}/disclosures' --family write,sendoperations delete
Section titled “operations delete”alter managed-secrets operations delete <provider> <operation-id> [--yes]Deletes one authored operation. Rules naming it stop matching, and a pulled operation it replaced applies again. A pulled operation leaves only with its document: deleting one exits 5 (operation_pulled), and the CLI says to override it with operations set and the same id instead. A delete that would restore a pulled operation whose id or former id clashes with another operation exits 1 (operation_invalid). An id the provider does not have exits 4. On a terminal it asks first; --yes skips the prompt, and off a terminal without --yes it cancels (exit 8). --output json prints {"operation_id": …, "status": "deleted"}. Needs dashboard_secrets:operations.
operations set-spec
Section titled “operations set-spec”alter managed-secrets operations set-spec <provider> (--url <url> [--no-wait | --wait-timeout <seconds>] | --clear [--yes])Names, replaces or clears the OpenAPI document (https, up to 2 MB, with no credentials in the URL, as on create). A new URL is saved and a pull of it queued; the operations pulled from the previous document stay in effect until the new one is adopted, and authored operations stay either way. The command then waits for the pull (up to --wait-timeout, 1–1800 seconds, default 180), says on stderr how it went, and prints the operations as operations list does. It exits 0 once the URL is saved, even when the pull fails (a warning gives the reason, the spec.error field) or is still pending when the wait ends; run operations sync to pull again. --no-wait returns once the pull is queued, printing the operations as they are (spec.status pending). The URL the provider already has changes nothing and queues no pull. --clear drops every pulled operation at once; it asks first, like the dashboard’s second dialog, and off a terminal without --yes it cancels (exit 8). Needs dashboard_secrets:operations.
operations sync
Section titled “operations sync”alter managed-secrets operations sync <provider> [--no-wait | --wait-timeout <seconds>]Queues a pull of the document now, waits for it like set-spec, and prints the operations. It exits 1 (after printing) when the pull fails, with the reason (the spec.error field) on stderr, and when the pull is still pending as --wait-timeout runs out; the pull keeps running, and a sync while a pull is queued or running queues nothing more, so running the command again waits for the same pull. Right after a pull finished, a sync is refused with exit 6 (operation_spec_sync_cooldown), and the CLI says how many seconds to wait (the retry_after_seconds field, also the Retry-After header). A provider with no document exits 5 (operation_spec_missing). --no-wait returns once the pull is queued and exits 0. Needs dashboard_secrets:operations.
users / groups
Section titled “users / groups”Picker helpers for building grants — list the app’s users and groups, with substring search.
alter managed-secrets users --search alicealter managed-secrets groups list --idp <idp-id>alter managed-secrets groups show <group-id>users and groups list accept --idp <uuid>, --search (up to 255
characters), --limit (1–200, default 50), and --offset (default 0). users
also accepts --group <uuid> to list only the active members of one group (the
id from groups list); pass one of them as --user to alter policy simulate
to explain a grant that is held by the group.
groups show paginates members and
grants independently with --member-limit / --member-offset and
--grant-limit / --grant-offset; both limits default to 100 and accept
1–500.
grants
Section titled “grants”Grants hand a provider’s credential to a principal. Revoking a grant is a soft-delete (recoverable by re-granting). Create and update need dashboard_secrets:write; revoke needs dashboard_secrets:admin — the same recoverable-revoke tier as API keys, agents, and OAuth grants, so a routine :write CI token can’t cut off live principals.
A grant can be user-owned: the grant of an end user’s own key and every delegation under it, and any delegation a user consented to (from a developer credential too). As with a user’s OAuth connection, you can revoke it and nothing else: grants update on it is refused with grant_user_owned (exit 7), and so is a grant-level policy rule on it (alter policy rules create --grant, bind --target grant:). The grant’s user_owned field says which.
Both grant list commands accept --limit 1–1000 (default 100) and --offset
(default 0). grants list also filters by credential: --credential-kind developer|end_user (a delegation follows its root’s credential) and
--credential-id <credential-id> (the grants one credential serves — what
credentials delete would revoke).
alter managed-secrets grants list <provider>alter managed-secrets grants list-for-agent <agent-id>alter managed-secrets grants get <grant-id>alter managed-secrets grants create <provider> --principal-type <type> [...]alter managed-secrets grants update <grant-id> [--label ...] [--expires-at ...]alter managed-secrets grants revoke <grant-id> [--yes]Both list commands show where each grant sits in the delegation tree, and whose it is:
| Column | Meaning |
|---|---|
CREDENTIAL | The credential the grant serves: its label, or its id when it has none. ? means the backend did not report it. In JSON the fields are credential_id, credential_kind and credential_label. |
DEPTH | Hop distance from the provider’s root grant: 0 is a root grant created directly on the provider (from the dashboard, this CLI, or the application’s own backend), 1 a first-hop delegation to an agent or another user, and 2+ an onward agent→agent delegation. ? means the backend did not report the field. |
PARENT | The grant a delegated one was minted under, or — for a root. Shown on list-for-agent only — see below. |
USER_OWNED | yes for a user-owned grant, which grants update refuses (JSON field user_owned). ? means the backend did not report it. |
Together these separate shared access from access the grant holds in its own
right. In --output json / jsonl the same data appears as the depth and
parent_grant_id fields on both commands — parent_grant_id (null for a
root) lets scripts reconstruct the whole delegation tree from the flat list.
list <provider> renders DEPTH but not PARENT. A parent on that listing
is normally another row of the same table, and a second full grant id beside
GRANT_ID pushes the row past a typical terminal width; use --output json
when you need the edge itself.
list-for-agent adds PARENT, because there it points to a grant that is
not one of the rows: the listing is scoped to a single agent, so the
parent — the delegating user’s grant on a first hop, or the delegating
agent’s on an onward hop — is never shown alongside it. Resolve the id with
alter managed-secrets grants get <id>. A parent that was already revoked
does not resolve (revoked grants are filtered from reads); a child still
listed under one means the revocation did not cascade, and the child should be
revoked directly.
grants create
Section titled “grants create”The principal type drives which flags are required:
--principal-type | Required flags |
|---|---|
user | --app-user-id <uuid>, --label <string> |
group | --idp-id <uuid>, --external-group-id <id>, --label <string> |
agent | --agent-id <uuid> |
system | — |
--credential-id <credential-id> names the developer credential the grant
serves. It may be omitted while the provider holds exactly one active developer
credential (end users’ own keys are not counted). Once it holds several, a create without it is refused with
credential_id_required, and the CLI lists the choices (<id> <label>) and
exits 5. The other credential refusals are no_developer_credential (the
provider holds no key yet — add one with credentials add),
end_user_credential_not_assignable (an end user’s key serves only its
owner’s grant), credential_not_found (no active credential with that id on
this provider) and sibling_label_conflict (the user already holds a grant with
that label on this provider).
Optional on every type: --description, --expires-at <iso>, and
--grant-policy <@file.json> for the full policy shape. The policy flag
requires a path-prefixed JSON object; when both policy input and --expires-at
specify an expiry, --expires-at wins. Or supply the whole body with
--input.
alter managed-secrets grants create <provider> \ --principal-type agent --agent-id <agent-id> --expires-at 2026-12-31T00:00:00Z--external-group-id takes the IDP’s stable group identifier, never a display name — an Okta group id (00g…), or a Clerk / WorkOS organization id (org_…):
# Okta groupalter managed-secrets grants create <provider> \ --principal-type group --idp-id <idp-id> \ --external-group-id 00g8xk2mnpQRS7Vw1697 --label "Data science team"
# WorkOS organizationalter managed-secrets grants create <provider> \ --principal-type group --idp-id <idp-id> \ --external-group-id org_01HXYZABCDEF123456789 --label "Acme Corp"Approver validation
Section titled “Approver validation”When a grant policy enables human-in-the-loop approval (--grant-policy on grants create / grants update, or a grant_policy in a create --input body), the approver list is validated at save time:
- An enabled
requires_approvalwith an emptyapproverslist is rejected locally (exit code2, before any network call): managed-secret grants have no default approver, so that configuration could only ever fail at first use. The backend enforces the same rule with a structured 422 (approval_config_error). - An approver the directory definitively does not contain fails the save with a structured 422 — fix the email and retry.
- An approver the directory couldn’t verify (no management credential configured, a transient directory error) allows the save and prints a warning on stderr:
alter: approver not verified — … (save was allowed). Confirm the address is correct — an unreachable approver silently stalls every approval it gates.
grants update
Section titled “grants update”Edit --label, --description, --expires-at, or --grant-policy (at least one required), or supply --input.
alter managed-secrets grants update <grant-id> --label "renamed"--grant-policy replaces the grant’s settings-owned policy block as a
whole — its TTL, approval requirement, and method/endpoint restrictions. It
never touches policy rules authored separately on the same grant (via
alter policy rules …, the dashboard’s Runtime policies section, or the wallet):
those are independent objects and survive every settings save. The read side
is symmetric: grants get, grants list, and update/create responses show
the currently enforced settings block on grant_policy
(requires_approval / restrictions), so what you read back is what the
gate enforces.
--expires-at without --grant-policy is a TTL-only edit: the CLI reads
the grant back (grants get), merges the new expiry into the currently
enforced block, and saves the merged block — the approval requirement and
restrictions are preserved, exactly like the dashboard editor. Combined with
--grant-policy, the expiry overrides that file’s expires_at and the file
otherwise replaces the block as described above.
A user-owned grant cannot be edited: the server refuses with grant_user_owned,
and the CLI prints grant <grant-id> is user-owned (grant_user_owned) with the
grants revoke command you can run instead, and exits 7. On the TTL-only
path, where the CLI has already read the grant, it refuses from the grant’s
user_owned field before sending anything, as the dashboard hides the edit
controls.
grants get
Section titled “grants get”alter managed-secrets grants get <grant-id>Fetches one grant. Requires dashboard_secrets:read. grant_policy carries
the currently enforced settings block, projected from the enforcing
rules — the read half that makes safe read-modify-write scripting possible.
grants revoke
Section titled “grants revoke”alter managed-secrets grants revoke <grant-id> # prompts y/Nalter managed-secrets grants revoke <grant-id> --yes # CITable output prints Revoked grant <id>.; JSON and JSONL output emit
{"grant_id":"<id>","status":"revoked"}.
Revoking is the one change you can make to a user-owned grant. Revoking the grant of an end user’s own key also revokes the key and destroys it, with every delegation under it; the user stores a key again through Connect.
On a terminal, before the y/N prompt, the CLI reads a user-owned grant and
prints what the revoke takes with it, as the dashboard’s revoke dialog does:
that the user’s key is destroyed (or, for a delegation the user consented to,
that the key is kept), and the id and label of every delegation made from it.
A grant it cannot read (not found, exit 4, or no dashboard_secrets scope,
exit 7) fails before the prompt, as the revoke would. With --yes, or off a
terminal, nothing is read first.
Recipes
Section titled “Recipes”Provision a backend credential in CI
printf '%s' "$OPENAI_KEY" | alter managed-secrets create \ --name "OpenAI" --template openai --credential-value -Run separate production and staging keys for one API
printf '%s' "$STAGING_KEY" | alter managed-secrets credentials add <provider> \ --label Staging --credential-value -alter managed-secrets credentials list <provider>alter managed-secrets grants create <provider> --credential-id <staging-credential-id> \ --principal-type agent --agent-id <staging-agent-id>Grant an agent access, then verify it resolved
alter managed-secrets grants create <provider> --principal-type agent --agent-id <agent-id>alter managed-secrets access <provider> --output json | jq '.entries'Related
Section titled “Related”alter agents— the agent principals you grant toalter audit grant-events— see grant lifecycle in the log- Managed secrets, Delegation