Reference
alter policy
See where access is controlled, manage policy rules and read the app-level policy posture from the command line.
See every place access to an app is controlled and what applies to one agent or connection, manage policy rules — rules that restrict or gate what requests are allowed (deny a request, rate-limit it, or hold it for human approval) — at the app, OAuth provider, managed-secret provider, group, user, agent, or grant level, apply one rule at several of those places, and summarize an app’s app-level rules at a glance. App-level policy is rules-based: IP and time-of-day restrictions are ordinary policy rules (the ip_allowlist and time_window rule types below), per-agent rate limits are the quota rule type, operation- and parameter-level content rules (deny, redact, or step-up a specific provider operation by its parameters) are the content_match rule type, “allow only these operations and nothing else” is the operation_allowlist rule type, “allow these requests only when they meet these conditions” is the request_allowlist rule type, and “require human approval” is the require_approval rule type, all managed with the same commands as every other rule.
alter policy show-accessalter policy check-accessalter policy show-appalter policy simulatealter policy validatealter policy exportalter policy testalter policy planalter policy show-planalter policy applyalter policy rules createalter policy rules listalter policy rules getalter policy rules updatealter policy rules deletealter policy rules bindalter policy rules unbindCommands are app-scoped. Interactive rule commands and show-plan accept --app <id> (or the app’s name), a linked workspace, or ALTER_APP_ID. File commands take the app UUID from bindings. apply takes it exclusively from the saved plan and has no --app flag.
Policy files
Section titled “Policy files”The policy-as-code guide contains complete manifest, binding and before/after test examples, ownership rules and protected CI guidance.
alter policy validate --manifest @policy.json --bindings @bindings.jsonalter policy export --manifest @export-targets.json --bindings @bindings.json --adopt-existingalter policy test --manifest @policy.json --bindings @bindings.json --tests @tests.jsonalter policy plan --manifest @policy.json --bindings @bindings.json --tests @tests.json --save reviewed-plan.jsonalter policy show-plan --app <app-id> --plan-id <plan-id>alter policy apply --plan @reviewed-plan.json --yesIn bindings.json, a managed_secret target may name the managed-secret
provider’s slug or its id, and a provider target an OAuth provider id or its
config UUID. Before any call the CLI resolves every slug to its provider’s id
(matched exactly among the app’s active providers, in one walk of the app’s
managed-secret provider list, read in pages of 1,000, however many slugs the
file names) and every provider id to its config UUID (one read of the app’s
providers), so the server plans and diffs UUIDs. The same walk checks every
managed_secret id: one that an active provider holds as its slug is refused as
ambiguous (exit 2). An unknown slug exits 4 with
no provider with slug "<slug>" in this app (run alter managed-secrets list)
and nothing is sent; a malformed one exits 2. Resolving slugs needs
dashboard_secrets:read and resolving provider ids dashboard_providers:read;
a refused read exits 7 naming the scope. A provider config UUID needs no extra
read, and a managed-secret provider id is used as written when the token cannot
read the provider list.
File operations require dashboard_app_policy:read. plan also requires
dashboard_app_policy:rules_create, because it saves a reviewed artifact that a
later apply executes. apply additionally checks the saved plan’s current
mutation permissions, even on a replay. For
validate/export/test/plan, optional --app must match the bindings.
Source flags accept @file or - (only one stdin input). --save
creates a private new file and refuses overwrite. --adopt-existing is opt-in;
export itself never adopts or applies. Apply prompts unless --yes is supplied.
All six file commands accept --output json|jsonl|table (default json).
plan emits the exact plan_id field for show-plan --plan-id; the saved file
also contains app_id and digest required by apply. If saving fails, the new
plan remains on stdout and stderr names its recovery command; the existing file
is untouched. test exits 1 for failed fixtures or uncovered changes and 0
for passing evidence. Human review on stderr shows each fixture’s pass/fail and
uncovered rule keys; it does not attest live authorization.
For each refusal in the table below, a refused apply names its code on
stderr, followed by the remedy, and does not print the server’s own error text.
plan names policy_plan_busy the same way. For policy_plan_stale the CLI
also prints the server’s reason, for example
(reason: preserved_layers_changed). apply compares the saved digest with the
server plan itself, so policy_plan_digest_mismatch is reported before any
apply is sent. Nothing is saved or applied in any of these cases:
| Code | Exit | Meaning and remedy |
|---|---|---|
policy_plan_stale | 5 | Policy state changed after the plan was reviewed. The reason is bound_rules_changed, preserved_layers_changed (a personal rule on a bound target) or ownership_changed. Run plan again and review the new plan. |
policy_plan_conflict | 5 | Policy state changed while applying. Run plan again and review the new plan. |
policy_plan_busy | 75 | Another policy change held a lock. Retry the same command, plan or apply, unchanged, with backoff. A retried plan is safe because the refused one saved nothing, and --save writes the file only after a success. A retried apply is safe because a plan that already committed returns its committed result; after a busy apply, do not re-plan or edit the saved file. |
policy_plan_digest_mismatch | 5 | The plan file was modified, or is not the file plan --save wrote. Apply the unmodified saved file, or run plan again and review the new plan. |
policy_plan_expired | 1 | The plan expired. Run plan again and review the new plan. |
policy_manager_changed | 5 | The plan’s policy manager changed while applying. Run plan again and review the new plan. |
policy_tests_failed | 5 | The plan has no passing fixture results. Fix the manifest or tests, then run plan again. |
Where access is controlled
Section titled “Where access is controlled”# Every check a request passes, in order, with what is configured at eachalter policy show-accessalter policy show-access --app <app-id-or-name> --rules-per-level 100 --output json
# One provider: its requested scopes and whether each agent's allowlist covers themalter policy show-access --provider <provider-id> --output json
# What applies to one agent on one connection, with the runtime's verdictalter policy check-access --agent <agent-id> --grant <grant-id>
# Add a key's scopes, or one app user's account and group rulesalter policy check-access --agent <agent-id> --grant <grant-id> --key <api-key-id>alter policy check-access --grant <grant-id> --user <app-user-id> --output jsonA request is checked in this order: the calling API key’s scopes, the calling agent’s capability allowlist (which providers and scopes the agent may use, whatever is delegated to it), provider scope narrowing (a delegated or narrowed connection carries only the scopes its scope_constraint leaves), then the runtime policies at every level (organization, application, provider, managed secret, group, agent, account and connection), any approval a rule requires, and finally the provider call. A capability limit is set on the key or the agent; a runtime policy is a rule. Either one can refuse a request. The allowlist binds only calls made with an agent’s own key: a call made with an application key, including one acting as an agent (app.get_agent()), is not checked against it. Allowlists are enforced for the whole Alter deployment, not per application.
show-access prints that map for one app: the unrevoked API keys and their scopes (the name, prefix and id, never a secret), each agent’s capability allowlist per provider, each provider’s requested scopes, the managed-secret count, and the runtime policies at every level with their full counts. A key’s expires_at is its expiry, and the table form marks a key whose expiry has passed as expired; revoked keys are not listed. An agent whose allowlist names a provider but leaves some of the scopes that provider requests uncovered is refused a delegation of all of them, and every call the agent makes with its own key through such a delegation is refused; a delegation narrowed to scopes on its allowlist is allowed. The table form warns about each one on stderr, and the JSON form lists them in each agent provider entry’s uncovered_scopes field. agent_scope_enforcement_active is false when allowlists are not enforced on the deployment yet, in which case nothing is refused; alter policy check-access gives the exact verdict for one connection. One read lists at most 1,000 agents and 1,000 API keys, the newest first: agents_truncated and api_keys_truncated are true when the app has more, so an agent or key missing from the list may still exist; every output form says so on stderr (alter: Showing the newest N keys; …) and points at alter agents list / alter keys list for the full lists. --rules-per-level (1–103, default 25) sets how many rules each level lists; every level still reports its enabled and disabled counts, and has_more is true when some are not listed. --provider <provider-id> limits the map to one OAuth provider’s capability limits: the response’s provider_id names it, providers holds that provider only and each agent’s providers only its entry for it, and keys, the managed-secret count and runtime policies are not read (api_keys and runtime_policy_levels are empty, managed_secret_count is 0), so combining it with --rules-per-level is a usage error. --provider naming a provider the app does not configure prints alter: <provider-id> is not an OAuth provider configured on this app on stderr (alter providers list lists them) and exits 4. --output json emits the whole map. In the providers table, NOTES says when a provider’s saved scopes need attention: re-select scopes: folded into … when the saved selection names only scopes the provider folded into a broader one (Connect refuses new connections for it until an administrator re-selects; the JSON form lists the broader scopes in the provider entry’s scope_reselection_required field), and some saved scopes were folded into …; re-select to keep them when only part of the selection was (the JSON field scope_selection_folded_into, which lists the broader scopes in both cases). For each provider with a note, the table form also names the fix on stderr: re-select the provider’s scopes in the Developer Portal, or headless with alter providers update --app <app> --provider <provider-id> --scopes <list>. An agent allowlist saved before the provider folded some of its scopes into a broader one still names the retired scopes, which no connection holds, so the agent is refused (agent_allowlist_exceeded) for a connection holding the broader scope: the JSON form lists the broader scopes in the agent provider entry’s allowlist_folded_into field, and the table form says so on stderr with the fix, allowlisting the broader scope in the Developer Portal or with alter agents update --app <app> --agent <agent-id> --scopes <json> --expected-version <n>. STATUS is always the provider configuration’s status alone.
check-access runs one subject through the same checks without contacting a provider. Give at least one of --agent, --grant and --key; --user needs --grant, because a user’s rules apply through a connection. Every id is a UUID from this app, and a key id is never the secret; a revoked key is reported as not found. An agent’s key implies its agent, so --key alone checks that agent. The table form prints three steps: the key’s scopes, the agent’s allowlist with the runtime’s verdict against the connection, and every runtime policy that composes for the connection, with the binding it applies through. It also prints the connection’s state (grant.status in the JSON form) and whether it serves requests (grant.serving): a connection that does not serve requests refuses every call whatever the other checks say. An OAuth connection serves only while active; a managed-secret connection also serves in contract_repair, a state a provider update can leave it in until its next use repairs it. A connection whose expiry has passed does not serve, even while its status still reads active: a request on it is refused as expired. grant.label is the connection’s label, and null for an agent’s delegation. In the JSON form the verdict is the capability.verdict field, one of covered, scopes_not_allowlisted, provider_not_allowlisted, ceiling_empty, grant_scopes_malformed, chain_unresolvable, managed_secret_not_allowlisted, not_bound (the connection is not delegated to this agent), agent_inactive (the agent is suspended or revoked; reported whichever key is named, because no call can act as such an agent), enforcement_off or app_key_caller (--key names an application key, which no allowlist binds, including when it acts as an agent); capability.allowed is true only for covered, enforcement_off and app_key_caller. capability.missing_scopes lists the connection scopes the allowlist does not cover — for a managed secret, the secret’s slug when the allowlist does not name it. capability.connection_scopes is what the connection lets the agent wield: the credential’s scopes, or, when a scope_constraint in its delegation chain narrows it, the narrowed set, with capability.narrowed then true; it is null for a managed secret and for a verdict reached without comparing the scopes (provider_not_allowlisted, not_bound, agent_inactive, enforcement_off, app_key_caller, chain_unresolvable, grant_scopes_malformed). In the table form, a refused verdict lists what the allowlist misses (Missing N scopes: …, or for a managed secret Managed secret not on the allowlist: <slug>) and ends with a Fix: line: the allowlist edit, or for ceiling_empty, chain_unresolvable and grant_scopes_malformed that check’s own fix, since no allowlist edit fixes them; the agent’s allowlist (Allowlist …) is printed only when it decided the verdict. When --key names an agent’s key and --agent names a different agent, the command fails with api_key_agent_mismatch (HTTP 422). When the token lacks a scope a flag needs, the insufficient_scope error is followed by a stderr line naming it: dashboard_grants:read for --grant, dashboard_keys:read for --key. The runtime policies are in runtime_rules.rules; runtime_rules.chain_unresolvable is true when the delegation chain cannot be resolved, which refuses every request on the connection.
Both commands need dashboard_app_policy:read, dashboard_agents:read, dashboard_providers:read and dashboard_keys:read, because the map shows rules, agents, providers and keys; check-access --grant also needs dashboard_grants:read, because it shows the connection’s scopes, state and holder. All five are in the default alter auth login scope set. Organization-level policies appear only in the dashboard, which shows the same map on the application’s Runtime Policies → Overview tab.
Reading app policy
Section titled “Reading app policy”alter policy show-appalter policy show-app --app <app-id-or-name> --output jsonSummarizes the app-level policy rules — the rules that apply to every request in the app — as a table of id, type, enabled, and name (--output json emits the full rows). It is the read-only posture view of the same rules alter policy rules list manages; needs dashboard_app_policy:read.
Rules that apply across an entire organization are dashboard-only by design — like org-wide key policy (where even reading is dashboard-only), a single scripted call should never see or weaken org-wide security, so there is deliberately no CLI surface for them.
Simulating a request
Section titled “Simulating a request”# "If a request used this grant, what gates it?" — verdict + per-rule tracealter policy simulate --grant <grant-id>
# Method + endpoint, so method/endpoint restriction rules are evaluatedalter policy simulate --grant <grant-id> --method GET --endpoint /repos/octo/hello
# As a specific agent, from a specific IP, at a specific timealter policy simulate --grant <grant-id> --agent <agent-id> \ --client-ip 203.0.113.7 --at 2026-05-21T09:00:00Z
# As one app user, so that user's rules and their groups' rules are explainedalter policy simulate --grant <grant-id> --user <app-user-id>
# Match key-specific conditions with an ID from this app, never the secretalter policy simulate --grant <grant-id> --api-key-id <key-id> --method POST
# Content rules: name the operation explicitly and supply a simulated parameter bagalter policy simulate --grant <grant-id> --operation gmail.users.messages.send \ --params '{"recipients": ["bob@example.org"]}'
# Raw-form request allowlist: supply the simulated request body and headers# (a form body here, because the rule below reads form fields)alter policy simulate --grant <grant-id> --method POST --endpoint /v1/refunds \ --params '{"@headers": {"Content-Type": "application/x-www-form-urlencoded"}, "@body": {"amount": 60000, "charge": "ch_123", "metadata[source]": "support_tool"}}'
# Full composed verdict (effect + deny attribution + per-rule trace) as JSONalter policy simulate --grant <grant-id> --endpoint /repos/octo/hello --output json
# Test an app-wide rule before creating it (full create object, never stored)cat > candidate-rule.json <<'JSON'{"rule_type":"json_match","rule_body":{"when":{"method":"POST"},"effect":"deny"},"name":"Block POST"}JSONalter policy simulate --grant <grant-id> --method POST \ --candidate @candidate-rule.jsonA route Alter refuses on every connection reports deny with reason provider_route_refused, as the live call would, and no rule can change it.
Dry-runs the app’s custom policy rules for one request shape. The headline distinguishes a block, human approval, redaction, recent sign-in, unevaluated runtime review, and incomplete evidence. “No policy block found” is not authorization: ownership, key/agent scopes, grant validity, and runtime conditions can still refuse the call. The per-rule trace retains each independent outcome; approval never overrides a block. The JSON effect remains the deterministic chain’s permit/deny, not a guarantee of execution. An AI rule skipped for a dry run has evidence_status: "runtime_review"; its canonical outcome: "pass" means the dry-run evaluator added no block, not that live AI review passed. No request is executed, quota consumed, approval created, or AI model contacted. It needs dashboard_app_policy:read (the same permission as the read commands), and with --api-key-id also dashboard_keys:read, because the key can determine which agent the request runs as; without it the command fails with insufficient_scope.
Rules needing unsupplied API-key identity, client IP, or endpoint have evidence_status: "context_required" and context_gaps identifying the missing inputs. Supply --api-key-id, --client-ip, or --endpoint where prompted. A key ID must name an unrevoked key of the selected app; a revoked or deleted key is reported as not found. It supplies policy context, and for an agent’s key the calling agent, without checking the key’s scopes, expiry or authentication. Missing input is not flagged when another known condition already proves the rule cannot apply, or a known method restriction already proves denial. The canonical JSON effect and six-value outcome contract are preserved for existing clients; evidence annotations are additive. Do not treat the supplied-context result as a prediction for missing context.
When run with a PAT (or otherwise outside an authenticated operator session), the simulation excludes organization-level policy definitions from the verdict — org rules are dashboard-only — and the command prints a warning to that effect on stderr. Use the operator dashboard’s Explain a request for a verdict that includes org rules.
It mirrors the dashboard’s policy explorer inputs: --grant (required) is the credential the simulated request uses; --method defaults to GET and accepts 1–16 letters (normalized to uppercase); --endpoint is a 1–512-character provider API path, required to evaluate method/endpoint restriction rules; --agent; --user is the app user the request runs as (the id field of alter end-users list --output json; it defaults to the grant’s own user), so that user’s rules and the rules of every group they are an active member of are evaluated; --client-ip is a bare IPv4/IPv6 address, not a CIDR, for ip_allowlist rules; --at is an ISO 8601 instant for time_window rules; --operation is a non-empty operation id of at most 255 characters for content_match rules (omit it to classify from --endpoint, exactly like the live gate; for a provider whose catalog classifies a GraphQL endpoint by root field, name the root field, for example --operation mutation.<field>, because the simulator takes no request document: a bare GraphQL endpoint reports classification_reason graphql_method_refused under the default --method GET, and graphql_body_invalid with the endpoint’s own method, usually --method POST); and --params is the simulated parameter bag for content_match rules, as a JSON object of up to 20 entries and 8,192 UTF-8 bytes when compact JSON-encoded. Arrays and scalars are rejected locally; values are used only for the dry-run and never stored. For a raw-form request_allowlist rule, two reserved keys of the same object supply the request it reads: @body (the simulated request body) and @headers (an object of header name to text); query parameters are read from --endpoint. @body is a JSON object sent as a JSON body, or, when @headers sets Content-Type to application/x-www-form-urlencoded, a flat object of text, number or boolean values (a list repeats the key) sent form-encoded. Any other Content-Type is refused, and so is a --params object that repeats a key at any depth (rejected locally, exit code 2), because the live request would be refused the same way. --candidate @file.json (or --candidate - for stdin) accepts one complete app-level create object — rule_type, rule_body, and optional name, description, and enabled — validates it locally, overlays it on the existing chain for this request only, and marks it candidate in the trace. Setting enabled to false is accepted but the rule is not overlaid and gets no trace row, because a disabled rule is never enforced once saved either; the command says so on stderr. It never calls the create route. The table form prints the verdict summary and per-rule trace; --output json emits the full composed object. The trace’s VIA column names the place each rule reached the request through ([home] marks the rule’s home); a rule an exclusion carved out of this request shows RESULT excluded and VIA names the exclusion (not agent:…, not user:…, or not group:…), and took no part in the verdict. In the JSON form these are each row’s matched_bindings and excluded_by. With --user, the table form prints an EFFECTIVE USER line on stderr naming the user the simulation ran for: the grant’s own user, else its consenting user, else --user, flagged when it is not the --user you passed; in the JSON form this is the verdict’s effective_app_user_id field. The table form also prints a GROUPS CONSIDERED line on stderr naming the effective user’s groups whose rules matched the request (none when no group rule matched); in the JSON form this is the verdict’s groups_considered field.
When capability allowlists are enforced on the deployment, the dry-run checks the calling agent’s allowlist first, exactly as the live request does. The caller is the agent holding the delegation for a delegated grant; otherwise the agent whose key --api-key-id names, else the --agent you pass. When --api-key-id names an application key the check is skipped, as the live gate skips it for an application key, including one acting as an agent; when it names one agent’s key and --agent another agent, the command fails with api_key_agent_mismatch (HTTP 422), as it does when an agent’s key is named with a delegated grant that a different agent holds, because that key cannot use it. The table form prints an AGENT CAPABILITY line on stderr saying whether the allowlist covers the connection and, when it does not, what it misses (AGENT CAPABILITY: <agent> NOT allowed — missing N scopes: …, or for a managed secret — managed secret not on the allowlist: <slug>) and how to widen it without dropping the agent’s other entries: take the agent’s full allowlist (the scopes field) and its version from alter agents show --app <app> --agent <agent-id> --output json, add the missing scopes under their provider (for a managed secret, the secret’s slug to managed_secret_slugs), and pass the whole allowlist to alter agents update --app <app> --agent <agent-id> --scopes '<full json>' --expected-version <version> (--scopes replaces the whole allowlist, so a JSON with only the missing entries would remove every other one). When the token lacks dashboard_grants:read, the line says an OAuth connection’s missing scope names were withheld; a managed secret’s missing slug is always named, because it is the application’s configuration, not the connection’s. A refusal here returns the verdict with deny_kind agent_scope before any rule runs. An agent caller that is suspended or revoked is refused before that check, as the live request is: deny_kind is agent_inactive, deny_reason is the code the live request gets (agent_inactive for a suspended agent, agent_revoked for a revoked one, or caller_agent_unresolved when --api-key-id names an application key acting as the agent), and agent_capability is null. The table form then prints Blocked: the calling agent is not active on stderr with the agent’s state and, when deny_reason is agent_inactive (a suspended agent called with its own key), the command that resumes it (alter agents resume --app <app> --agent <agent-id>). The verdict’s rules_evaluated field is then false, as it is when a chain fault or provider scope narrowing decides the request first: an empty rules list means no rule ran, not that no rule applies. In the JSON form the allowlist check is the verdict’s agent_capability object: agent_id, agent_name, provider_id, allowed, check, missing_scopes, and missing_scopes_withheld. missing_scopes lists the OAuth scopes the allowlist does not cover, or for a managed secret (managed_secret_not_allowlisted) the secret’s slug. It is null when the request has no agent caller, when --api-key-id names an application key, when the agent is not active, or when allowlists are not enforced on the deployment. With a PAT that lacks dashboard_grants:read, an OAuth verdict that names missing scopes returns missing_scopes empty and missing_scopes_withheld true, because the scope names come from the connection; otherwise missing_scopes_withheld is false.
A request naming a provider operation that would leave the caller holding a provider credential (such as a token exchange, a new or rotated API key, or a password the caller changes) is refused, exactly as the live request is, unless a credential_minting allowance that applies to the request names it (see Allow an operation that hands over a credential). A refusal has deny_kind policy, deny_layer credential_minting, deny_reason credential_minting_refused, and deny_rule_id null, and the table form prints Blocked: this operation would leave the caller holding a provider credential on stderr. In the JSON form the verdict’s credential_minting object describes the operation on a refusal and on a permit alike (it is null when the request names no such operation): provider_id; operation_id, which is null when the request path could not be read well enough to name the operation, so no allowance can cover it; operation_ids, every such operation the path could be, all of which must be allowed for the refusal to lift; allowed_by, the ids of the allowances that lifted it (empty on a refusal); needs_allowance, the operations no applicable allowance covers (empty on a permit); and omitted_levels_may_allow, true when the request was refused but policy levels this token cannot read were left out of the dry run, so an allowance there may permit the live request. On a refusal the table form prints the command that creates the missing allowance on the grant, naming the provider and every operation in needs_allowance (echo '<body>' | alter policy rules create --app <app> --grant <grant-id> --type credential_minting --body - --yes), says when levels were left out, and, when operation_id is null, says that no allowance can cover the request instead.
When a content_match classification ran, the verdict also names the operation the request classified to (or warns that the request is unclassified — content rules targeting the provider deny unclassified traffic), exactly as the dashboard’s explorer shows it; in the JSON form this is the classified_operation / classification_reason pair.
The dry-run covers the agent’s capability allowlist, the custom policy-rule chain, including rules that emit approval/redaction/sign-in obligations, and provider scope-narrowing for delegated or narrowed grants. It does not check the API key’s own scopes. It does not execute those obligations or apply the grant-validity floor. When the selected grant is terminal or a delegated chain is resolved structure-only, the command prints a “grant liveness not verified” caveat: the grant or an ancestor could deny the live request.
Policy rules
Section titled “Policy rules”A policy rule is evaluated on every request, on top of a default-deny base: a request already needs ownership of the grant, the right scope, and a valid grant before any rule runs. When a rule’s conditions match, it either denies the request or holds it for human approval (require_approval). Rules can only restrict that base — creating one never grants or widens access — with one exception: a credential_minting rule is an operator’s allowance that lifts Alter’s built-in refusal of named operations that would leave the caller holding a provider credential (see Allow an operation that hands over a credential). Every other rule still applies to a call it allows.
Targeting
Section titled “Targeting”Each rule is created at one home target, picked by a flag (the flags are mutually exclusive):
| Flags | Rule applies to |
|---|---|
| (none) | every request in the app |
--provider <provider> | every grant on one OAuth provider (e.g. --provider google) |
--secret <provider> | every request that uses one managed-secret provider (named by its slug or its id), directly or through a delegated grant |
--group <group-id> | every request an active member of one identity-provider group makes through the app, whichever grant or agent they use |
--user <app-user-id> | every request one app user makes through the app, including through a grant their group holds |
--agent <agent-id> | one agent only |
--grant <grant-id> | one grant (credential) only |
The target flag is part of the rule’s address: get, update, delete, bind, and unbind must repeat the flag for the rule’s home (or for any other place the rule applies) — a rule created with --agent is only found with the same --agent <agent-id>, and without it the command reports the rule as not found. Provider rules cover OAuth providers only; a managed-secret credential is covered by --secret (every grant of that provider) or --grant (one grant). --secret takes the managed-secret provider’s slug or id (the slug or id field of alter managed-secrets list --output json), resolved exactly as alter managed-secrets resolves <provider>. A slug is 1–50 lowercase letters, digits and hyphens; anything else that is not a UUID exits 2 before any request. A UUID is read as the id, and refused as ambiguous (exit 2) when an active provider holds it as its slug. A slug is looked up among the app’s active providers with an exact, case-sensitive match. That lookup also needs dashboard_secrets:read. A slug no active provider in the app has is refused with exit 4 and alter: no provider with slug "<slug>" in this app (run alter managed-secrets list), before any change. create and update check every other input (the body, the name, the bindings) before that lookup. Read an app user’s id from the id field of alter end-users list --output json, and a group’s from the id field of alter managed-secrets groups list --output json.
One rule can also apply at more places in the same app (its bindings), and can exclude agents, users, and groups that would otherwise fall under it: pass --also and --exclude to create, or use bind and unbind on an existing rule. See Where a rule applies.
Each side edits only its own rules. The CLI, the dashboard, and policy files create and change developer rules; the limits an end user sets on their own account from the Wallet stay theirs. list --user <app-user-id> shows both (the table’s OWNER column reads end user (wallet) for the user’s own; in JSON, created_by_kind is app_user), but update, delete, bind, and unbind refuse the user’s own limits before any change (exit 4, and the server answers 404 as for a rule it does not show). The user sees the application’s rules in the Wallet as Set by the application, and cannot change them.
A user-owned managed-secret grant takes no developer rule at all: an end user’s own key (the grant it creates and every delegation under it), and any delegation a user consented to, are governed by the limits the user sets, as with their OAuth connections. create --grant <grant-id> or --also grant:<grant-id> naming one, bind --target grant:<grant-id>, and an update that sends a new --body or --enable for a rule that applies to one, are refused with grant_user_owned (exit 7), and nothing changes. update --disable, --name, --description, and delete stay allowed, so an application can still switch off or remove a rule written before the grant became the user’s. A rule on its managed-secret provider (--secret), its user (--user), an agent (--agent), or the app still applies to it. list --grant <grant-id> on such a grant still prints its rules and says on stderr that the grant is user-owned; in --output json, each rule homed on it carries display.user_owned: true.
A group rule follows the membership the identity provider last reported. Memberships are refreshed at each sign-in, by the provider’s group webhooks where it sends them, and by directory import; a member removed from the group at the provider who never signs in again keeps the restriction until one of those runs. That over-restricts, which is the safe direction.
Permissions
Section titled “Permissions”Token permissions are split by what the operation can do:
| Command | Needs | Notes |
|---|---|---|
rules list / rules get | dashboard_app_policy:read | |
rules create | dashboard_app_policy:rules_create | Creating a rule only ever restricts access — a routine automation permission |
rules create --type credential_minting | dashboard_app_policy:rules_create and dashboard_app_policy:rules_allow_minting | An allowance widens access, so it also needs its own permission, which is never granted by a wildcard, and the token’s owner must be an organization admin; asks for confirmation (--yes in scripts) |
rules create / update / delete / bind / unbind of a rule that admits an unreviewed operation | The scope the change needs above, plus dashboard_app_policy:rules_admit_unreviewed | A rule that admits an operation Alter has not reviewed by its provider-qualified name (<provider>:<operation-id>: an operation allowlist entry, or a require_approval rule whose every condition names it) lifts the refusal every other operation, family or content rule applies to it. The permission is never granted by a wildcard, and the token’s owner must be an organization admin. The CLI cannot tell locally which names are unreviewed, so the refusal comes from the server: exit 7, naming the missing scope or the admin requirement. A label-only update needs neither |
rules update | dashboard_app_policy:read and dashboard_app_policy:rules_update | Read is needed for the before/after review. Disabling a rule loosens enforcement, so the update permission is never granted by a wildcard — select it explicitly when creating the token |
rules delete | dashboard_app_policy:read and dashboard_app_policy:rules_delete | Read is needed for the before/after review. Removing a deny rule loosens enforcement — delete is also never granted by a wildcard |
rules bind | dashboard_app_policy:read and dashboard_app_policy:rules_create | Applying a rule at one more place only narrows access |
rules bind --exclude | dashboard_app_policy:read and dashboard_app_policy:rules_delete | Excluding an agent, user, or group loosens the rule |
rules unbind | dashboard_app_policy:read and dashboard_app_policy:rules_delete | Removing a place loosens the rule |
rules unbind --exclude | dashboard_app_policy:read and dashboard_app_policy:rules_create | Removing an exclusion narrows the rule |
For a credential_minting allowance the binding directions flip, because the rule widens rather than restricts: rules bind (one more place the allowance applies) and rules unbind --exclude widen access and need dashboard_app_policy:rules_allow_minting and an organization admin (and ask for confirmation), while rules bind --exclude and rules unbind narrow it and need dashboard_app_policy:rules_create. rules update of an allowance that changes its body or enables it needs rules_allow_minting and an organization admin as well as rules_update; disabling it or renaming it does not. Deleting one needs rules_delete.
rules create needs only dashboard_app_policy:rules_create, even with --exclude: a new rule cannot loosen any access that exists today, so its exclusions only limit how far the new restriction reaches. The exception is --type credential_minting, which needs dashboard_app_policy:rules_allow_minting and an organization admin as well, wherever it applies. Adding an exclusion to a rule that already exists does loosen it, which is why rules bind --exclude needs rules_delete.
Create
Section titled “Create”Every change prints a review to stderr; JSON results stay on stdout. It starts
with What this change does: one line per change and, where the rule’s
meaning settles it, a rating (More restrictive, Less restrictive, Mixed, or
Impact uncertain), plus a warning for any less-restrictive change. The complete
Before / After definitions follow. Creating a rule only narrows access, so it proceeds without a
prompt; updates and deletes ask for confirmation (see below), and so does creating
a credential_minting allowance, which widens access (pass --yes in scripts;
--yes is refused for any other rule type, which has nothing to confirm). Creating a disabled
rule does not enforce it.
# App-wide, body from stdin (json_match is the default --type)echo '{"when": {"method": ["POST", "DELETE"]}, "effect": "deny"}' | \ alter policy rules create --body - --name "Read-only app"
# Agent-scoped, body from a file; create disabled and enable lateralter policy rules create --agent <agent-id> --body @rule.json --disabled
# Provider-scopedecho '{"when": {"method": "DELETE"}, "effect": "deny"}' | \ alter policy rules create --provider google --body -
# Managed-secret-provider-scoped: every request that uses this providerecho '{"allowed_methods": ["GET"]}' | \ alter policy rules create --secret <provider> --type restriction --body - --name "Read-only secret"
# One rule for two agents and a managed-secret provider, homed at the first agentecho '{"when": {"method": ["DELETE"]}, "effect": "deny"}' | \ alter policy rules create --agent <agent-a-id> --also agent:<agent-b-id> \ --also secret:<provider> --body - --name "No deletes"
# A Google provider rule that also covers one managed-secret providerecho '{"when": {"method": ["DELETE"]}, "effect": "deny"}' | \ alter policy rules create --provider google --also secret:<provider> --body -
# App-wide, except for one maintenance agentecho '{"when": {"method": ["DELETE"]}, "effect": "deny"}' | \ alter policy rules create --exclude agent:<maintenance-agent-id> --body - --name "No deletes"
# One identity-provider group, except its leadecho '{"allowed_methods": ["GET"]}' | \ alter policy rules create --group <group-id> --exclude user:<lead-app-user-id> \ --type restriction --body - --name "Contractors read-only"
# One rule on three app users, homed at the firstecho '{"when": {"method": ["DELETE"]}, "effect": "deny"}' | \ alter policy rules create --user <app-user-a-id> --also user:<app-user-b-id> \ --also user:<app-user-c-id> --body - --name "No deletes"
# App-wide, except for everyone in one groupecho '{"when": {"method": ["DELETE"]}, "effect": "deny"}' | \ alter policy rules create --exclude group:<group-id> --body - --name "No deletes"
# IP allowlist: deny every request NOT from these addresses / rangesecho '{"allow": ["203.0.113.5", "10.0.0.0/8"]}' | \ alter policy rules create --type ip_allowlist --body - --name "Office egress only"
# Time window: deny requests outside business hours in the given timezoneecho '{"windows": [{"days": ["mon","tue","wed","thu","fri"], "start": "09:00", "end": "17:00"}], "timezone": "America/New_York"}' | \ alter policy rules create --type time_window --body - --name "Business hours"
# Human in the loop (HITL): hold matching requests for human approval (does not deny)echo '{"effect": "require_approval", "when": {"method": ["POST", "DELETE"]}, "approval": {"approvers": ["lead@example.com"], "channels": ["email"]}}' | \ alter policy rules create --type require_approval --body - --name "Approve writes"
# Parameter-conditional approval: only payments over 1,000 need sign-offecho '{"effect": "require_approval", "when": {"match": {"families": ["payment"]}, "params": [{"name": "amount", "op": "gt", "value": 1000}]}, "approval": {"approvers": ["cfo@example.com"]}}' | \ alter policy rules create --type require_approval --body - --name "Approve large payments"
# Restriction: method/endpoint allowlist — deny anything NOT on it (read-only repos)echo '{"allowed_methods": ["GET"], "allowed_endpoints": ["/repos/**"]}' | \ alter policy rules create --type restriction --body - --name "Read-only repos"
# Quota: at most N calls per fixed window (per agent) — deny with a retry-after over the limitecho '{"limit": 1000, "period": "hour"}' | \ alter policy rules create --type quota --body - --name "1000/hour per agent"
# Restriction with a segment wildcard: refunds of any one charge, nothing elseecho '{"allowed_methods": ["POST"], "allowed_endpoints": ["/v1/charges/*/refunds"]}' | \ alter policy rules create --type restriction --body - --name "Charge refunds only"
# Content match: deny (or redact / step-up) specific provider operations by their parametersecho '{"match": {"families": ["send"]}, "params": [{"name": "recipients", "op": "not_subset_of", "value": ["*@example.com"]}], "effect": "deny"}' | \ alter policy rules create --type content_match --body - --name "Internal recipients only"--also <ref> applies the rule at one more place and --exclude <ref> excludes one agent, user, or group from it; both are repeatable. A <ref> is app, provider:<provider>, secret:<provider>, group:<group-id>, user:<app-user-id>, agent:<agent-id>, or grant:<grant-id>. A provider ref takes the same provider id as --provider (provider:google) or the provider configuration’s UUID (the id field of alter providers list --output json). The CLI resolves a provider id to its configuration by reading the app’s providers, which needs dashboard_providers:read; an id not configured for the app is refused (exit 4) before any change. The UUID form needs no extra permission. A secret ref takes the managed-secret provider’s slug or id, as --secret does (secret:stripe-2), and is looked up the same way: the home’s --secret and every secret ref resolve together, in one walk of the app’s managed-secret provider list. The home and every --also and --exclude ref must be distinct, at most 100 in total. Only agents, users, and groups can be excluded, and an exclusion must fall under a broader place the rule applies to: an excluded group under an app, OAuth provider, or managed-secret provider; an excluded user under one of those or a group; an excluded agent under any of those or a user. The CLI checks all of this before it creates anything; the only calls it makes first are the reads that resolve a provider id (the app’s providers) and a managed-secret provider’s slug or id (the app’s managed-secret providers). Excluding a group also needs the same identity provider a group-bound grant needs (membership changes reported in real time, with webhooks enabled); otherwise the server refuses the create with group_exclusion_unsupported and the reason, and nothing is created. For a credential_minting allowance the requirement is reversed: a group it applies to (--group or --also group:<group-id>) needs that identity provider, and a group it excludes does not.
--body takes @<file> or - for stdin (the same intake convention as every other JSON-accepting alter flag). --type picks the rule’s evaluator and the body shape that goes with it (default json_match):
--type | Body shape (generated from the policy-language spec) | Effect on matching requests |
|---|---|---|
ai_review | {"effect": "require_approval", "review": {"threshold_level": <int 1-4>, "tail_mass"?: <value>, "confidence_floor"?: <value>, "families"?: ["write"/"send"/"delete"/"admin"/"payment", ...], "triggers"?: [{...}, ...]}, "approval": {...}} | Ask an AI model to rate how risky a provider call is and require human approval above a threshold. Never denies on its rating (only a request that repeats an argument is refused), never runs on reads. |
content_match | {"match": {"operations"?: ["<string>", ...], "families"?: ["admin"/"delete"/"payment"/"read"/"send"/"write", ...]} (at least one), "params"?: [{...}, ...], "effect": "deny"/"redact"/"step_up", "redact"?: {"fields": ["<string>", ...]}, "step_up"?: {"max_session_age_seconds": <int 1-86,400>}} | Bind cataloged operations/families (a provider’s attested catalog, or a custom integration’s mapped operations) and (optionally) their projected parameters; on a match, deny the request, redact fields from it, or require a fresh (step-up) user session. |
credential_minting | {"mode": "allow"/"require_approval", "provider": "<string>", "operations": ["<string>", ...], "expires_at"?: "<string>", "caller_type"?: "api_key"/"agent", "caller_id"?: "<string>", "reason"?: "<string>", "approval"?: {"approvers"?: ["<string>", ...], "expires_in_seconds"?: <int 60-86,400>, "channels"?: ["email", ...], "step_up_max_session_age_seconds"?: <value>, "max_pending"?: <value>, "result_retention_seconds"?: <value>}} | Allow named operations that create credentials or change account security or privileges; outright or only after a human approves each call. |
ip_allowlist | {"allow": ["<string>", ...]} | Restrict the request’s source IP to an allowlist of addresses / CIDR ranges (narrowing; requests from any other IP are denied). |
json_match (default) | {"when": {...}, "effect": "deny"} | Deny the request when a flat set of request-metadata conditions all match (string equality or list membership, ANDed). |
operation_allowlist | {"operations"?: ["<string>", ...], "families"?: ["admin"/"delete"/"payment"/"read"/"send"/"write", ...]} (at least one) | Allow only the listed cataloged operations and/or families at the target; any other classified operation — and any request the catalog cannot classify — is denied. |
quota | {"limit": <int 1-1,000,000>, "period": "minute"/"hour"/"day"/"month"} | Admit at most ‘limit’ requests per fixed UTC calendar window per caller principal; beyond the limit the request is denied with 429 + Retry-After. |
request_allowlist | {"match": {"operations"?: ["<string>", ...], "families"?: ["admin"/"delete"/"payment"/"read"/"send"/"write", ...]} (at least one), "require": [{...}, ...], "strict"?: <value>} or {"match": {"methods"?: ["DELETE"/"GET"/"HEAD"/"OPTIONS"/"PATCH"/"POST"/…, ...], "endpoints": ["<string>", ...]}, "require": [{...}, ...], "strict"?: <value>} | Allow the requests it selects only when every listed condition holds; a selected request that fails one — or, under ‘strict’, carries a field the rule does not name — is denied. |
require_approval | {"effect": "require_approval", "when"?: {...}, "approval": {"approvers"?: ["<string>", ...], "expires_in_seconds"?: <int 60-86,400>, "channels"?: ["email", ...], "step_up_max_session_age_seconds"?: <value>, "max_pending"?: <value>, "result_retention_seconds"?: <value>}} | Require human approval before the request executes (a 202 + approval flow), always or only when an optional condition matches. |
restriction | {"allowed_methods"?: ["DELETE"/"GET"/"HEAD"/"OPTIONS"/"PATCH"/"POST"/…, ...], "allowed_endpoints"?: ["<string>", ...]} (at least one) | Allowlist the HTTP methods and/or provider endpoint paths the target’s traffic may use; everything outside the allowlist is denied. |
tag_match | {"keys": ["<string>", ...]} | Allow an agent to use or receive a grant only when, for every listed tag key, the agent and the grant carry the same value. |
time_window | {"windows": [{...}, ...], "timezone": "<string>"} | Deny the request when it falls outside the UNION of the configured day/time windows, evaluated in the rule’s IANA timezone. |
The CLI validates ai_review bodies locally: the threshold is an integer from
1 to 4; probabilities are bounded; eligible families exclude reads; triggers
have unique lowercase IDs, bounded questions and labels, and valid probability
thresholds. The rule also requires a valid human-approval block. See the
AI review setup and example.
For json_match, when is a map of request attribute → expected value or list of values; ALL conditions must match for the rule to fire, and effect is always "deny". The full matchable-attribute list is in the generated Authoring limits block below. Beyond plain metadata, operation and family match the request’s classified catalog operation (by id, or by semantic family — send, read, write, delete, admin, payment) and also fire on requests that cannot be classified (fail closed); client_ip is exact-IP only (CIDR ranges belong in an ip_allowlist rule); a method condition also gates raw-token retrievals, which confer every method. Every body is validated locally before any network call. Optional: --name, --description, --disabled.
For require_approval, the matching request is held for a human to approve rather than denied. The when map is OPTIONAL (omit it to require approval on every request at the target); it accepts the same attribute matcher as json_match plus the content_match vocabulary — a match object (operations and/or families) and a params condition list — so an approval can be operation- and parameter-conditional: {"effect": "require_approval", "when": {"match": {"families": ["payment"]}, "params": [{"name": "amount", "op": "gt", "value": 1000}]}, "approval": {...}} requires sign-off only for payments over 1,000. An operation-scoped condition on a request that cannot be classified is denied (never approved around). The approval object accepts: approvers (up to 10 approver emails — empty/omitted means the connection’s own owner approves: the end user who connected the account, including when an agent calls through a grant that user delegated to it. A connection no end user connected has no owner, so a gated call on it is refused with approval_config_error until the rule names an approver; a rule targeting a managed-secret grant must name at least one explicit approver, because a managed-secret provider has no owner to default to — an approver-less save on one is rejected with a structured 400 naming the fix, rather than denying every gated call at runtime), expires_in_seconds (60–86400, default 600), channels (["email"], or [] for a single-gate approval that sends no email and surfaces only the approval link), and the advanced overrides step_up_max_session_age_seconds (-1 disables step-up, 0 forces a fresh sign-in for every decision, up to 3600), max_pending (1–1,000), and result_retention_seconds (3600–31,536,000 — one hour to one year). Multi-gate approvals require email delivery for every gate so each required approver receives their own link. Authorable at the app / provider / managed-secret provider / group / user / agent / grant level here; an end user’s own approval rules on their account are authored by that user in the Wallet.
For restriction, a request is denied unless its HTTP method is in allowed_methods (when set) AND its provider API path matches allowed_endpoints (when set); at least one of the two must be present. Each endpoint is an exact path (/user), a path in which * stands for exactly one whole, non-empty segment (/v1/charges/*/refunds matches /v1/charges/ch_1/refunds, never /v1/charges/refunds or /v1/charges/a/b/refunds), or a trailing /** prefix wildcard that matches that prefix and anything below it (/repos/** matches /repos, /repos/, and /repos/octo/hello). Exact entries are byte-exact including the trailing slash — /user does not admit /user/ (a distinct request at the provider); list both forms, or use /user/**, when both should pass. Requests spelled as non-canonical aliases — duplicate slashes (/user//), . segments, backslashes, or percent-encoded separators (%2F) — are denied outright under an endpoint allowlist, and patterns spelled that way are rejected at authoring: their provider-side resolution is ambiguous, so no exact rule could be held to what it names. Those are the only wildcard forms: a * that is part of a segment (/re*, /repos/v*) or a ** anywhere but the end is rejected (a 400 invalid_rule), not treated as a literal or a wildcard. Methods must be one of GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS. This is the same method/endpoint allowlist a grant can carry; authoring it as a rule lets you apply it at the app / provider / managed-secret provider / group / user / agent / grant level (e.g. an app-wide “GET only”). Methods are upper-cased; the backend rejects a path containing a .. traversal segment.
For time_window, the request is denied unless its local time (in the required timezone) falls inside one of the windows. Each window is a non-empty set of days (mon…sun, unique) plus a start/end time ("HH:MM", 24-hour). The window is [start, end) — start inclusive, end exclusive; end may be "24:00" for end-of-day. A start later than end is a valid overnight window anchored to the named day (e.g. fri 22:00 → sat 06:00). Up to 20 windows; timezone is required (no implicit default).
For quota, a request is admitted only while fewer than limit requests have been made in the current fixed window (top of the minute/hour, UTC midnight, or the first of the month), counted per caller principal (the agent when the request runs as one, otherwise the connection). Over the limit, the call is denied with a retry-after until the window resets — this is the only rule type that denies with a rate-limit response rather than a plain policy denial. Not usable as a per-request rule.
For content_match, the rule binds specific provider operations rather than raw paths: match names catalog operation ids ("operations", e.g. gmail.users.messages.send) and/or operation families ("families" — one of send, read, write, delete, admin, payment), and at least one of the two must be present. The optional params list adds parameter conditions that must ALL hold for the rule to fire; each condition is exactly {"name", "op", "value"}, where op is one of equals (scalar equality, case-insensitive for strings), any_in (fires when any projected value matches one of the listed patterns), not_subset_of (fires when the projected values are NOT fully covered by the listed patterns — the recipient-allowlist shape), their literal twins in (fires when any projected value is literally one of the listed values — the literal mirror of any_in) and not_all_in (fires when not all projected values are literally in the list — the literal-allowlist shape, the mirror of not_subset_of; on a set-shaped parameter it is therefore not the negation of in), exists (its value is a boolean: true fires when the request carries the parameter at all, false when it does not — the one operator for which an absent parameter is a judgement rather than a denial; presence is judged on what the operation’s catalog projects for that operation — a declared parameter, a query-string parameter the request carries, or a body key the operation accepts — so a parameter name nothing projects never fires an exists: true deny; a rule whose exists condition names a parameter no selected operation declares or accepts is saved with a catalog_warnings caveat naming it, exactly as for an operation id no catalog maps), the numeric comparisons gt/gte/lt/lte, outside_windows (fires when a time-range parameter such as a calendar event’s event_time is not wholly inside the windows, back-to-back occurrences counting as one stretch; its value is a time-window body, {"windows": [{"days": [...], "start": "HH:MM", "end": "HH:MM"}], "timezone": "<IANA zone>"}, validated locally like --type time_window), or the location pair under / not_under (judge a file store’s path parameter by folder: value is a non-empty list of /-rooted folders, each covering itself and everything below it at a folder boundary — /Clients covers /Clients/VC, not /ClientsX — both sides canonicalized and compared ignoring case where the provider does; not_under is the folder allowlist and fires when not every location the request names is under a listed folder, under the folder blocklist and fires when any is; under also fires on a folder above a listed one — an operation on / reaches every folder; the CLI refuses an entry the evaluator could never compare — one that is not /-rooted (an id: or rev: addressing form, a bare name), or that carries a backslash, a ., .. or empty segment, a trailing separator or leading or trailing whitespace — with exit 2 before any network call, naming the problem as the backend does; the same forms fail closed on the request side, and a request that addresses a file by id: / rev: instead of by path is denied under either operator because it names no location the rule can see; the backend refuses, exit 1, a location condition on an operation that a provider the rule applies to declares without that path parameter, naming <provider>:<operation>.<parameter> — for example a rule naming files/upload set on an agent or the app, because Druid declares the same id; set it on the Dropbox provider (--provider dropbox) or a Dropbox grant instead; a rule is judged where it is set whether it is created with --disabled or not, and an enabled one is judged on the operation families it selects too). While a rule whose verdict depends on where the request runs (a content or approval condition on the operation) applies, a request that switches the provider namespace with a provider context header (listed on the provider’s reference page with its parameter name) is refused with policy_violation reason context_header_ungoverned, the 403’s denied_by.context_parameters naming the ungoverned parameters, unless a stored content_match rule with effect deny — or a require_approval rule — bound to the operation names that header’s parameter. Every content_match rule fires to deny, so {"name": "<parameter>", "op": "exists", "value": true} forbids the header and {"name": "<parameter>", "op": "not_all_in", "value": [...]} admits only the listed values (a JSON-object header value is compared as compact, key-sorted JSON on both sides; every value ignores case and surrounding whitespace); a per-request rule never governs a header. alter policy simulate and alter audit explain word the fix with the parameter names the verdict or audit row carries. A condition’s name references a parameter from the operation’s catalog entry or any query-string parameter the live request carries (evaluated identically whether the caller embeds it in the URL or passes it through the SDK’s separate query-parameters argument); the numeric operators require a cataloged numeric parameter — an ad-hoc query value projects as a string and a numeric condition on it denies. List values for any_in/not_subset_of are per-entry glob patterns (*@example.com): *, ? and [...] are wildcards. in/not_all_in take the same list but compare literally — a * is a star — so use them for literal statements, ids and channel names (a SQL statement or a Slack channel id that happens to contain * or ? is matched as written). Numeric ops take a number, equals a string or number, exists a boolean. A few providers canonicalize a path parameter so that equivalent spellings of the same key match one rule (SAP S/4HANA, where '0000500001' and '500001' are the same sales order). A glob cannot be compared against a canonicalized value, so an any_in/not_subset_of pattern on one of those parameters is rejected when the rule is saved — use equals, in, or not_all_in with the exact key values. String comparisons are normalized: equals, in/not_all_in and the any_in/not_subset_of pattern matching compare case-insensitively with surrounding whitespace trimmed (internal whitespace is significant) — deliberate anti-bypass semantics, so a condition cannot be dodged by a case or padding variant, and so a provider whose identifiers differ only by case cannot be told apart by in/not_all_in; number-typed parameters compare numerically (a string-typed parameter compares as normalized text). On a set-shaped parameter (for example recipients), equals matches only an exact single value — a multi-member set never matches; use any_in to match a member. effect picks what happens on a match: "deny" blocks the request; "redact" lets it through but removes the named redactable fields from the outbound request body before forwarding — nothing is written in their place, so a redacted email subject is sent as no subject at all (requires the redact object); "step_up" requires the end user to have re-authenticated within max_session_age_seconds (1–86400, requires the step_up object). The redact/step_up objects are only valid with their matching effect. Content rules fail closed: a request that cannot be classified as a known operation (or whose parameters cannot be read) is denied while a content rule targets it — it is never let through, and never converted into a redaction or step-up for a request that can’t be named. An unreviewed operation is refused the same way (operation_unreviewed) unless an operation allowlist entry, or a require_approval rule whose every condition (operation and match) names it by its provider-qualified name (<provider>:<operation-id>, such as zoom:deleteRole), admits it; a content rule naming it judges it but never lets it through. Admitted, it still needs a credential_minting allowance with that provider naming the same qualified name, with caller_type, caller_id, expires_at and reason, because it may create credentials or change account security (credential_minting_refused until one does). Ambiguous query spellings fail closed: an uncataloged query key repeated with distinct values, or a query key shadowing a differently-sourced cataloged parameter, denies any condition naming that parameter rather than guessing which value the provider would honor — conditions on other parameters are unaffected. A cataloged scalar query parameter repeated with distinct values cannot be projected at all, so every parameter condition on that operation denies.
For operation_allowlist, the body is the match selector of content_match used as the whole rule — a flat {"operations": [...], "families": [...]} naming catalog operation ids and/or operation families (one of send, read, write, delete, admin, payment), at least one of the two, with no match wrapper, effect, params, or when. It says what the target may do: a request whose classified operation is named (by id, by a kept alias, or by the provider-qualified <provider>:<operation-id> name its route kept when Alter reviewed it, which names every operation sharing that route and nothing else), or every family it belongs to is listed, passes (["read"] admits neither an operation that also writes nor one that also sends — the list states least privilege); any other classified operation is denied (policy_violation, reason operation_not_allowed); and a request the catalog cannot classify — an uncataloged route, an ambiguous match — is denied too (operation_unclassified), because an allowlist cannot admit what the gate cannot name, so adding one also closes every uncataloged route. An unreviewed operation (one alter providers operations list shows as UNREVIEWED) is admitted only when the list names its provider-qualified name (<provider>:<operation-id>, the policy_operation_id field of alter providers operations list; a bare id Alter has reviewed nowhere is refused at save with the qualified names to use); otherwise it is denied with operation_unreviewed, and a family never admits it, because its families are unknown. Admitting one also needs a scoped credential_minting allowance naming it, and saving the allowlist needs an organization admin and dashboard_app_policy:rules_admit_unreviewed. A compound request must be allowed at every level: a GraphQL document’s every root field, and a batch’s envelope operation (batch) as well as each item’s operation. Several allowlists that apply to one request intersect — a delegate’s list can only be narrower than its delegator’s — and the rule can never widen access, so it needs only dashboard_app_policy:rules_create and asks for no confirmation. On a custom integration whose developer-mapped send, payment and admin families an organization administrator has not trusted, an organization-level or end-user allowlist admits by operation id only — no family of such an operation is evidence that it does not also send, pay or administer — so a body naming families and no operation ids is refused when it is saved if it can reach such an integration. A families-only body from any author is also refused when it can reach a custom integration with no operations mapped (or whose operations were all removed), because every request to one is unclassified (operation_unclassified) and no family admits it. The check runs when the rule is created, when its body changes and when it is re-enabled (alter policy rules update with an unchanged body, or a policy-file re-apply, is not judged again); a refusal exits 1 and names the ways out: name operation ids; or map the integration’s operations and have an organization administrator trust its families; or target the rule at specific grants or managed secrets that do not reach that integration. It always applies at its target (there is no when; narrow the selection with the operation ids instead), an end user may author one on their own connection from the Wallet or the Connect page as a personal limit (it only narrows, like a content rule), and a connection carrying one is proxy-only: a raw token could not be held to it, so raw credential release on that connection is refused with restricted_grant_requires_proxy and calls go through the SDK’s proxy request instead. The same body also works as a per-request rule through the SDKs’ withConstraints / with_constraints. The CLI checks the shape and caps locally (the same 100 combined entries and 255-character ids as content_match); an operation id absent from every attested catalog saves, with a catalog warning on stderr, exactly as for content_match.
echo '{"operations": ["query", "generalledger/query_a_report"]}' | \ alter policy rules create --type operation_allowlist --grant <grant-id> --body - --name "Only reads the close needs"For tag_match, the body is {"keys": [<1-10 tag keys>]}. For every listed key, the acting agent and the grant (connection) it uses must carry the same tag value, or the request is refused with policy_violation reason tag_mismatch; a key missing on either side is refused too. The acting agent is the agent whose key made the call or the agent an app key acts as; a call from the app key acting as the application’s own backend (no acting agent) is not checked. The same check refuses handing a grant to an agent whose value differs (agent.delegate, a Connect consent, a Wallet delegation; denied_by.keys names the keys), and agent.delegate by an agent whose own value no longer matches the grant it holds; a delegated grant inherits its parent’s tags. While a rule names a key, setting, changing or removing that key with alter agents update --tag or alter grants tag is refused with 409 tag_in_use when the agent holds active grants or the grant has active delegations (revoke them first); an API key without agents:admin / grants:admin, and a CLI or dashboard caller who is not an organization admin, gets 403 tag_operator_only. The CLI refuses a body with no keys, a repeated key or a key outside the tag-key grammar with exit 2 before any network call. A run that must cross the boundary is excluded with --exclude on its agent. It cannot be sent as a per-request rule, and an end user or a delegating agent cannot author it.
echo '{"keys": ["client"]}' | \ alter policy rules create --type tag_match --app <app-id> --body - --name "Agents use only their own client's connections"For request_allowlist, the requests the rule selects are allowed only when every condition in require holds; a request it does not select is not judged by it. It is the positive counterpart of content_match, which can only say which values to block. The body is {"match": {...}, "require": [...], "strict": <boolean>} in one of two forms, never mixed in one rule:
- Catalog form.
matchis thecontent_matchselector ("operations"and/or"families"), and each condition names a parameter Alter projects for those operations:{"name": "<parameter>", "op": "<operator>", "value": ...}. Text compares ascontent_matchcompares it (ignoring case and surrounding whitespace). A request the catalog cannot classify is denied. - Raw form.
matchselects by method and path —"endpoints"(required, therestrictionpattern grammar above) and optionally"methods"— and each condition addresses the request as sent:{"at": "body:<path>" | "query:<name>" | "header:<name>", "op": "<operator>", "value": ...}. It needs no cataloged operation, so it can read any field, and it works on a custom integration. A JSON body path separates keys with.and visits every array element with[*](body:items[*].price); a form-encoded field is named whole, brackets included (body:metadata[source]), and in a form name[*]stands for any bracketed index (body:items[*][price]readsitems[0][price],items[][price], …, every one of which must satisfy the condition). The body is read in the encoding the provider receives. A JSON key containing.,[or], or an empty key, cannot be addressed: it never satisfies a condition and is an unlisted field understrict. Values compare exactly, case and whitespace included. A JSON number compares exactly as a number; text that spells a number (ortrue/false) counts as that number (or boolean) only in a form field, a query value or a header, so a JSON string never equals a number or a boolean and never meetsgt/gte/lt/lte. A rawlikepattern’s*and?never match a,, a;or a line break, and[...]is a character class (a negated[!...]class never matches one of those separators either). To select, a request path that is exactly one of theendpointsis selected, and so are the routing variants common servers accept: ignoring case, a trailing/,;…parameters and a.<suffix>on a segment (so/api/filesalso selects/api/files.upload), and percent-escaped letters; a_methodquery or form field is judged as the method it names. A selected request is judged; selecting more only adds requests that must meet the conditions. Nothing in a raw rule is reviewed by Alter: the rule states what the provider’s fields mean.
require lists 1–20 conditions. The operators each read “the value must …”, and when a field carries several values every one must satisfy it: equals, in (literal values), like (glob patterns such as *@example.com), gt / gte / lt / lte (numbers), exists (true present, false absent), and in the catalog form only inside (a location parameter inside one of the listed /-rooted folders) and within_windows (a time-range parameter within a time_window body). In the raw form equals and in also accept numbers and booleans. A selected request that does not carry a required field fails, unless the condition sets "optional": true (“if it is sent, it must …”); optional is not accepted with exists. A failed condition denies the request with policy_violation request_condition_not_met.
"strict": true also denies a selected request that carries anything the rule does not name (policy_violation request_field_not_listed): in the catalog form any other projected parameter (the route’s own path parameters aside), in the raw form any other body field or query parameter. Headers are not counted, and {"op": "exists", "value": true} on an object covers everything beneath it. A path whose shape does not match the address (an object where [*] expects an array) does not meet a condition, even an optional one, and exists true on a [*] path needs the key on every element. A request that cannot be judged is denied: when a condition reads the body, or under strict, a body that is neither JSON nor a form or whose JSON root is not an object; a JSON key or header sent twice; a field a raw condition reads that is sent in both the query string and the body, or an unencoded ; in a form or query field it reads (duplicate_argument); a field name a common parser reads as a checked one, in place of or beside it or in the other of the query string and the body: other letter case or surrounding spaces (Amount), . or a space for _ (amount.total for amount_total), or a bracketed form (amount[]); and a path with .., //, an encoded separator or double encoding (request_ambiguous). End users can author a request_allowlist on their own connections in the Wallet or on the Connect page, as a personal limit that only narrows. A connection carrying a request_allowlist is proxy-only, exactly as with restriction, content_match and operation_allowlist, and the same body works as a per-request rule through the SDKs’ withConstraints / with_constraints. The CLI checks the form, the operators, each operand’s type, the address grammar and the caps locally (exit code 2, before any network call); whether a named parameter exists for the selected operations is reported by the server.
# Catalog form: a payment may run only when its amount is at most 500.00echo '{"match": {"families": ["payment"]}, "require": [{"name": "amount", "op": "lte", "value": 50000}]}' | \ alter policy rules create --type request_allowlist --grant <grant-id> --body - --name "Payments up to 500"
# Raw form: a refund must come from the support tool, be at most 500.00, and carry nothing elseecho '{"match": {"methods": ["POST"], "endpoints": ["/v1/refunds"]}, "require": [{"at": "body:metadata[source]", "op": "equals", "value": "support_tool"}, {"at": "body:amount", "op": "lte", "value": 50000}, {"at": "body:charge", "op": "exists", "value": true}], "strict": true}' | \ alter policy rules create --type request_allowlist --grant <grant-id> --body - --name "Support refunds up to 500"For ip_allowlist, each entry is a bare IPv4/IPv6 address or a CIDR range, and a request is denied unless its source IP matches one of them. A /0 catch-all entry — any base with a /0 prefix, including zero-padded forms like /00 or /000 — is rejected locally (exit code 2, before any network call): a rule that matches every source IP is an allow-all, not a restriction, so use a concrete address or a narrower prefix. A split-range set whose entries together cover the whole address space (for example 0.0.0.0/1 + 128.0.0.0/1, or ::/1 + 8000::/1) is rejected the same way, even though no single entry is a /0 — as is an entry covering the entire IPv4-mapped-IPv6 block (::ffff:0.0.0.0/96), which would admit every IPv4 source in mapped form on a dual-stack listener. Each entry’s IP/CIDR shape is validated locally too, so a malformed entry fails fast rather than at the backend.
Authoring limits (generated from the policy-language spec — the same source the policy engine enforces):
| Rule type | Limits |
|---|---|
ai_review | max trigger label chars: 60 · max trigger question chars: 500 · max triggers: 8 · risk levels: 5 |
content_match | max match entries: 100 · max operation id len: 255 · max param conditions: 20 · max param name len: 120 · max redact field len: 120 · max redact fields: 50 · max value entries: 200 · max value len: 512 · step up max seconds: 86,400 · step up min seconds: 1 |
credential_minting | max operations: 100 |
ip_allowlist | max allow entries: 100 · max entry len: 49 |
json_match | max when list values: 100 · max when value len: 512 |
operation_allowlist | max match entries: 100 · max operation id len: 255 |
quota | max limit: 1,000,000 |
request_allowlist | max conditions: 20 · max endpoints: 50 · max raw path len: 256 · max value entries: 200 · max value len: 512 |
require_approval | default expiry seconds: 600 · max approvers: 10 · max expiry seconds: 86,400 · max pending max: 1,000 · max pending min: 1 · min expiry seconds: 60 · result retention max seconds: 31,536,000 · result retention min seconds: 3,600 · step up max seconds: 3,600 · step up min seconds: -1 |
restriction | max endpoint pattern len: 512 · max endpoints: 50 · max methods: 7 |
tag_match | max key len: 128 · max keys: 10 |
time_window | max windows: 20 |
Every serialized rule body is at most 16,384 bytes; --name is at most 120 characters and --description 2,000. Each target holds at most 100 rules authored through this command; a target may additionally carry the rules DERIVED from its settings block (an agent’s approval configuration, a managed-secret grant’s restrictions and approval configuration), which are managed from that surface and do not count against the 100.
json_match matchable attributes: agent_id, api_key_id, app_id, client_ip, environment, family, method, operation, provider_id, resource_kind.
json_match semantics (from the spec’s notes):
- method matches case-insensitively; a request with NO method (a raw-token retrieval) SATISFIES a method condition — the raw token confers every method
- an operation/family condition on an UNCLASSIFIED request is SATISFIED (fail closed — an unnameable request is a capability superset of anything the rule could deny)
- client_ip is an EXACT-IP match (IPv6-canonicalized); CIDR ranges belong to the ip_allowlist rule type and are rejected here
- an attribute absent on the request (e.g. agent_id for a non-agent caller) never matches — quiet no-fire, except method/operation/family above
Allow an operation that hands over a credential
Section titled “Allow an operation that hands over a credential”A credential_minting body names one provider and the exact operations to allow, each one that provider’s reference page marks refused by default (no wildcard, no family, 1–100 unique ids), with mode "allow" (the call runs) or "require_approval" (the call runs once a person approves it; approval is then required and takes the same fields as a require_approval rule’s, and is refused with "allow"). The CLI checks that shape locally; whether each operation is a credential operation or exact unknown GraphQL mutation is checked by the server (a 400 with the reason, exit 1). Creating one needs dashboard_app_policy:rules_allow_minting as well as rules_create (the token’s owner must be an organization admin) and asks for confirmation (--yes in scripts). An allowance for a provider covers both its OAuth and its managed-secret connections, and one that applies to an agent also covers calls delegated through that agent. When a request path could be more than one operation that hands out a credential, every one of them must be allowed. Historical exact unknown-root allowance entries remain accepted, but they do not authorize unknown GraphQL through an operation/family rule or authorize a root newly classified as credential-bearing. Unknown/uninspectable GraphQL forwards when no operation/family rule applies; otherwise it fails closed until the request can be classified. Every other rule still applies.
echo '{"mode": "allow", "provider": "neon", "operations": ["getProjectBranchRolePassword"]}' | \ alter policy rules create --type credential_minting --agent <agent-id> --body - --yesalter policy simulate reports a refused operation with the command that allows it, and a permitted one on stderr with permitted by a credential_minting allowance (mode "allow") or allowed after a human approves each call, under a credential_minting allowance (mode "require_approval"), naming the rule and the operation; the allowance’s trace row reads allows-operation. The audit record of a live call an allowance lets through carries credential_minting (operation_id, operation_ids and allowed_by, the allowing rule ids) in its policy context, and its decision_basis is credential_minting_allowance for mode "allow", or approval when the call ran after a person approved it. alter audit explain names the operation and the allowance in both cases, with the command that deletes the allowance at its home target.
List / get
Section titled “List / get”alter policy rules listalter policy rules list --agent <agent-id> --output jsonalter policy rules list --limit 103 --offset 0alter policy rules get --rule <rule-id> --grant <grant-id>list returns every rule that applies at the target, including rules homed elsewhere and attached to it. The table’s APPLIES TO column lists where each rule applies, home first, then the agents, users, and groups it excludes (for example group:1234abcd, secret:stripe-production; not user:9abc0123, with ids shortened and a managed-secret provider shown by its slug). With --output json, each rule’s bindings field lists every place with its id, mode (include or exclude), level, target_id, target_label, target_slug (a managed-secret provider’s slug, which tells apart providers that share a target_label; null for every other level), and home (true for the home), and the rule’s home field names its home level and target_id. The get --output table Bindings block prints each full target_id with its label and, for a managed-secret provider, its slug: secret:<id> (Stripe, stripe-production).
list accepts --limit (1–103 — the 100 authored rules plus the derived rules: the settings layers and a delegation’s method limit, so one page always holds a complete target) and --offset, and renders a table by default (--output json|jsonl|table). Every format emits the rule rows themselves — json is the array, matching every other list command (the one exception is managed-secrets access, whose JSON keeps its summary envelope with the per-via counts). When more rules remain, the command prints the next --offset to run on stderr, so a | jq pipeline keeps clean data on stdout.
get preserves JSON as its backward-compatible default. Pass --output table for the complete human-readable explanation: type, effect, status, target/source context, operations, every parameter condition, rule-specific configuration, and a Bindings list naming each place the rule applies or excludes with its full target id and binding id. --output jsonl remains available for streaming pipelines.
Update
Section titled “Update”alter policy rules update --rule <rule-id> --disablealter policy rules update --rule <rule-id> --enablealter policy rules update --agent <agent-id> --rule <rule-id> --name "New name" --description "Why"alter policy rules update --rule <rule-id> --body @new-rule.jsonPartial update — only the flags you pass change (--enable and --disable are mutually exclusive; pass at least one change flag). A rule’s evaluator type is fixed at creation; everything else — body, name, description, enabled — is editable in place, and a replacement --body must keep the shape of the rule’s type (an ip_allowlist rule takes a new {"allow": [...]} body, and so on). Remember to repeat the rule’s target flag (--agent / --grant / --provider / --secret / --user / --group) for non-app-level rules.
Editing a disabled rule preserves its disabled state. Both enable and disable
require review. In automation, --yes also requires --expected-version from the
rule you inspected; the CLI never silently substitutes a newer version. For example,
after reviewing version 7:
alter policy rules update --rule <rule-id> --disable --yes \ --expected-version 7 --idempotency-key <unique-change-key>Capture the exact version field from alter policy rules get --rule <rule-id> --output json (for example, jq -r '.version') along with the definition being
reviewed. Do not substitute a fresh version immediately before applying an old review.
The table’s OWNER column reads agent (delegation) for a rule a delegating agent attached. A rule owned by a policy file (code_owner on rules list / rules get; the table’s OWNER column and the text view’s “Managed by” line) cannot be changed here: rules update and rules delete stop before the review prompt with exit 5, and the server answers 409 policy_rule_managed to any other client. Change it through alter policy plan / apply, or release it from its manifest first (see the policy-as-code guide).
One exception: a rule whose origin is grant_settings or agent_settings (visible on rules list / rules get) is owned by its settings surface — the managed-secret grant editor’s approval/restrictions block or the agent’s approval settings — which replaces it wholesale on every settings save. Every rules update on such a rule (body, name, description, --enable / --disable) is rejected with a 400 pointing at the owning surface: an edit would be silently overwritten by the next settings save, and a toggle would desynchronize the two views. rules delete works on a grant_settings rule (it is exactly “turn the setting off”, and the grant’s settings read-back reflects it immediately); an agent_settings rule rejects delete too — manage it entirely through the agent’s approval settings.
Delete
Section titled “Delete”alter policy rules delete --rule <rule-id>alter policy rules delete --provider google --rule <rule-id> --yes --expected-version 7Deleting or disabling an active rule removes that restriction; it does not grant
access. All other policy layers and access checks still apply. The CLI asks for
confirmation on a terminal; scripts require --yes --expected-version <reviewed-version>.
As with update, repeat the target flag for non-app-level rules.
Apply a rule in several places
Section titled “Apply a rule in several places”# Also apply an existing rule to another agent (narrows access: no prompt)alter policy rules bind --rule <rule-id> --target agent:<agent-c-id>
# ...or to every grant on a provider, by provider id or configuration UUIDalter policy rules bind --rule <rule-id> --target provider:google
# Exclude an agent from an app-wide rule (loosens it: confirm with --yes in scripts)alter policy rules bind --rule <rule-id> --target agent:<agent-d-id> --exclude --yes
# Apply a group rule to one more group, and exclude one of its membersalter policy rules bind --group <group-id> --rule <rule-id> --target group:<other-group-id>alter policy rules bind --group <group-id> --rule <rule-id> --target user:<app-user-id> --exclude --yes
# Stop applying the rule to that agent (loosens it)alter policy rules unbind --rule <rule-id> --target agent:<agent-c-id> --yes
# Remove the exclusion again (narrows access: no prompt)alter policy rules unbind --rule <rule-id> --target agent:<agent-d-id> --exclude
# Or name the binding by the id in the rule's bindings fieldalter policy rules unbind --agent <agent-a-id> --rule <rule-id> --binding <binding-id> --yesAddress the rule with its home target flag, as for get (none for an app-level rule). bind --target <ref> takes the same refs as create --also; with --exclude it takes agent:<agent-id>, user:<app-user-id>, or group:<group-id>. unbind names the binding by --target <ref> (add --exclude to remove an exclusion rather than a place) or by --binding <binding-id>, the id of an entry in the rule’s bindings field. The home cannot be removed: delete the rule instead.
An exclusion follows delegation exactly as an attachment does. An excluded user or group is carved out of every request that user (or a member of that group) makes, whichever grant or agent carries it. An excluded agent is carved out whenever it is anywhere in the request’s delegation chain, which includes the agents that agent delegates to, and it is carved out even when a more specific attachment of the same rule also matched. A delegate never has more access than the agent it delegates from, so exempting an agent cannot give its delegates anything that agent lacks.
Attachments are removed automatically when the agent is revoked, the provider configuration is deleted, the managed-secret provider is deleted, or the rule itself is deleted; a rule homed at such a target is re-homed to the most specific place it is still attached to (deleted only when none remains). Deprovisioning an app user removes nothing: the rules homed at that user and the user’s attachments and exclusions on other rules stay (inert while the user has no active connection, and in force again if the user is re-provisioned), and create, bind and --also/--exclude naming a deprovisioned user fail as not found (exit 4). When the identity provider deletes a group, by its webhook or when the identity provider itself is deleted, the group’s attachments and exclusions on other rules are removed and a rule homed at the group is re-homed to one of its remaining attachments (deleted only when none remains); each of these changes is recorded in the audit log, one entry per rule. Deleting the app deletes all of its rules, recorded as one count on the app-deletion audit entry. Revoking a grant does not remove an attachment to it: a revoked grant can never be used again, so the attachment has no effect, and it stays listed in the rule’s bindings until you unbind it.
Applying a rule at another place, or removing an exclusion, narrows access and proceeds after the printed review. Removing a place, or excluding an agent, user, or group, loosens the rule: the command asks for confirmation on a terminal, and scripts pass --yes. Before any call the CLI refuses a place the rule already names, an exclusion nothing covers, an unbind that would leave an exclusion covering nothing, the home binding, a file-managed rule, and an end user’s own limit.
Each change reads the rule, sends its current version as the reviewed version, and prints the new version and the updated applies to list on stderr; stdout carries the updated rule with its bindings and home. When an unbind leaves an operation id the rule names mapped by no custom integration the rule still applies to, the unbind succeeds and the CLI prints a catalog warning on stderr saying the id now matches no request (the response’s catalog_warnings). A refusal the server returns names its code on stderr, and nothing changes (a refusal the CLI detects first exits 2, 4, or 5 with its own message):
| Code | Exit | Meaning |
|---|---|---|
binding_exists | 5 | The rule already names that target. |
home_binding | 5 | That binding is the rule’s home. Delete the rule instead. |
binding_not_allowed | 5 | The rule applies only at its home: a settings-owned, organization, or end-user rule (a limit a user set on their own account). |
binding_limit | 5 | The rule already has 100 bindings. |
rule_limit | 5 | The target already has 100 rules applied to it. On a user, only the application’s rules count: the user’s own limits have a separate budget. On a group, the app may also have reached its ceiling of 1,000 distinct rules applied to its identity-provider groups together; the message names which limit was hit. |
binding_not_found | 4 | The rule has no such binding. |
target_gone | 4 | The target is not in the rule’s app, or was deleted while the change was in flight. |
exclude_without_include | 1 | An excluded agent, user, or group must fall under a broader place the rule applies to. |
group_exclusion_unsupported | 1 | A group can be excluded from a restriction, or given a credential_minting allowance (applied to it or created on it), only when its identity provider reports membership changes in real time with webhooks enabled (Clerk, Okta, or WorkOS), the same requirement as a group-bound grant; excluding a group from an allowance has no such requirement. The response’s reason names the precondition that failed (idp_not_group_capable, webhooks_not_enabled, or idp_inactive). |
stale_policy_rule | 5 | The rule changed after it was read. Run the command again. |
grant_user_owned | 7 | The target is a user-owned managed-secret grant (an end user’s own key, or a delegation the user consented to). Only the user sets its limits; put the rule on its managed-secret provider, user, agent, or the app instead. create answers the same refusal for a --grant home or an --also grant: place. |
Stale changes and retries
Section titled “Stale changes and retries”Every create, update, delete, bind, and unbind carries a retry key (--idempotency-key,
generated when omitted); updates, deletes, binds, and unbinds also carry the reviewed version
(--expected-version; bind and unbind default it to the version they just read). A retry of
an unbind that named its binding by --target names it by --binding <binding-id>
instead, as the printed retry command says, because the binding is gone once the first
attempt committed. A stale version fails with HTTP 412 without changing
the rule. Both a locally detected stale revision and an
HTTP 412 response exit with code 5 (conflict). Read and review the current rule before making
a new change. Missing preconditions fail with 428; reusing a key for different
work fails with 422.
If a response is lost, retry the same command, payload, target, reviewed version,
and --idempotency-key printed on stderr, including --yes to confirm that exact
previously reviewed change even if the first attempt already advanced its version
or deleted the rule. Within 24 hours the same currently
authorized principal receives the original committed response (a rotated or
re-issued token in between does not create a second rule), without
another mutation or success audit. This also works after a successful delete has
removed the row. Do not reuse the key for a different change. After 24 hours, inspect
current state before acting: an expired key no longer guarantees deduplication.
Authorization is checked on every retry; the receipt cannot restore revoked access.
Recipes
Section titled “Recipes”Snapshot the app-level rules for review or diffing in CI
alter policy show-app --output json > app-policy-rules.jsonReview and apply a managed ruleset
alter policy test --manifest @policy.json --bindings @bindings.json --tests @tests.jsonalter policy plan --manifest @policy.json --bindings @bindings.json --tests @tests.json --save reviewed-plan.jsonalter policy apply --plan @reviewed-plan.jsonUse the complete three-file example. A loop of creates does not reconcile ownership, removals or reviewed drift.
Audit which rules are currently disabled
alter policy rules list --output json | jq '.[] | select(.enabled == false)'This lists the rules that apply at the app level only — repeat it with --agent / --grant / --provider / --secret / --user / --group (or loop over the targets) to cover each rule family.
Related
Section titled “Related”- Policies — the policy model
alter audit— see policy decisions on real calls (alter audit list --policy-decision DENY)
Rules for SDK functions
Section titled “Rules for SDK functions”Policy operation fields also accept the published SDK function IDs listed by
alter integrations operations <provider>. Use when.operation for a
json_match or conditional require_approval rule, match.operations for
content_match (including redaction and step-up) or a catalog-form
request_allowlist, or the top-level operations list of an
operation_allowlist. Conditional approval can also
use when.match.operations with parameter conditions. alter policy simulate --operation <function-id> previews its catalog shape; without request-body proof, shared shapes include sibling rules.
Managed calls carry a server-verified function identity. Alter narrows to that function only when the compiled body cannot satisfy a sibling. Otherwise every sibling rule applies, just as for a raw call. Create calls containing read-only update identifiers are refused with invalid_operation_input. Alter evaluates
policy against the actual method, URL and body after building the request from
the authorized connection. Existing endpoint, method, host, catalog-operation
and family rules continue to apply unchanged.
A raw call can share an endpoint with several SDK functions. It matches all
of those function IDs: a deny or approval rule naming any one of them applies.
A function name never grants permission or bypasses existing restrictions;
Alter’s policy rules only narrow access and do not accept an allow effect.
The portal’s operation picker lists searchable SDK names grouped by product,
alongside the existing catalog operations. alter providers operations list
shows the functions covered by each catalog operation.
For function-specific approval, put the full function ID in the existing
--body JSON field when.operation; there is no separate stored rule format.
The CLI checks function-shaped names against the backend’s published contract
and reports unknown names before saving. The backend remains authoritative.
GraphQL operation allowlists accept exact root IDs or complete family sets. Saving a new allowlist with a legacy route-wide GraphQL ID is refused with exact replacement IDs in the error. Parameter-scoped REST rules bind mapped GraphQL resources only; the CLI displays a catalog warning when a REST ID has no GraphQL mapping, matching the dashboard.