Skip to content

Concepts

Scopes

How a credential's reach is narrowed from what it could do to what this call needs.

A scope is a string that narrows what a credential can do. Scopes appear in two distinct contexts in Alter, and confusing them is the most common source of “why is this call failing 403.”

Scope kindLives onBounded byExample
Provider scopeAn OAuth credential and its grantsThe OAuth provider’s scope vocabularyhttps://www.googleapis.com/auth/calendar.readonly
Alter scopeAn Alter API keyThe Alter scope cataloggrants:read, agents:write

This page covers both.

When a user completes the OAuth flow at Google, the consent screen lists the scopes the app is requesting. The user approves a specific set; Alter records that set with the credential and makes it available through the resulting grant. At call time, the provider checks the access token against the scope set and rejects the call if the route requires a scope the user did not grant.

Provider scopes are managed two places:

  • Per-app default set — the operator picks the default scope set when configuring the provider in the developer portal. Users see this set on the consent screen.
  • Per-session narrowing — the SDK can request a subset of the configured scopes for a Connect session via required_scopes (Python) or requiredScopes (TypeScript). Useful when one product surface needs read-only access and another needs read-write.

Scope mismatch handling: if the operator changes the configured scopes after users have already connected, existing credentials are marked for reevaluation. On the next SDK call, Alter clears that marker when the stored grant still covers the current requirement; otherwise the call raises ScopeReauthRequiredError. The same error can surface when a provider reports insufficient scope. The application must start a new Connect session and direct the user to its URL; the SDK does not open the prompt automatically.

Alter API keys carry their own scope set, separate from any provider’s scopes. These are capability scopes on the Alter API itself — what the key is allowed to do against Alter’s own management surface:

The complete catalog below is generated from the backend’s current, versioned scope catalog and is the public source of truth.

Important AND-scope contracts:

  • connect:initiate authorizes session creation, but OAuth Connect also requires grants:write and managed-secret delegation also requires secrets:write. Completing either flow creates a grant or delegation.
  • tokens:retrieve authorizes direct SDK calls. Those calls report the provider outcome through audit:emit; without it, the provider call can still complete but its client-side outcome is not appended to the audit log.
  • proxy:execute authorizes provider calls executed by the Alter backend. The backend records those outcomes itself.
  • identity:resolve resolves verified identity contexts; identity:assert mints signed identity assertions. See Propagate identity to memory.

Catalog version: v13

These scopes are valid on app and agent runtime keys (alter_rk_… / alter_ak_…). They are rejected on Personal Access Tokens.

ScopeKind
agents:adminResource permission
agents:readResource permission
agents:writeResource permission
approvals:readResource permission
approvals:writeResource permission
audit_logs:readResource permission
grants:adminResource permission
grants:readResource permission
grants:writeResource permission
idp_users:readResource permission
idp_users:writeResource permission
idps:adminResource permission
idps:readResource permission
idps:writeResource permission
keys:adminResource permission
keys:readResource permission
keys:writeResource permission
policies:adminResource permission
policies:readResource permission
policies:writeResource permission
providers:adminResource permission
providers:readResource permission
providers:writeResource permission
secrets:adminResource permission
secrets:readResource permission
secrets:writeResource permission
usage:readResource permission
audit:emitAction permission
connect:initiateAction permission
identity:assertAction permission
identity:resolveAction permission
keys:deriveAction permission
proxy:executeAction permission
spans:emitAction permission
tokens:retrieveAction permission

These dashboard_* scopes are valid only on operator Personal Access Tokens (alter_pat_…). They are rejected on runtime keys.

ScopeKind
dashboard_agents:adminDashboard permission
dashboard_agents:readDashboard permission
dashboard_agents:writeDashboard permission
dashboard_analytics:readDashboard permission
dashboard_app_policy:readDashboard permission
dashboard_app_policy:rules_createDashboard permission
dashboard_app_policy:rules_deleteDashboard permission
dashboard_app_policy:rules_updateDashboard permission
dashboard_approvals:readDashboard permission
dashboard_apps:adminDashboard permission
dashboard_apps:deleteDashboard permission
dashboard_apps:readDashboard permission
dashboard_apps:writeDashboard permission
dashboard_audit:readDashboard permission
dashboard_branding:readDashboard permission
dashboard_branding:writeDashboard permission
dashboard_end_users:readDashboard permission
dashboard_grants:adminDashboard permission
dashboard_grants:readDashboard permission
dashboard_identity_providers:createDashboard permission
dashboard_identity_providers:webhooksDashboard permission
dashboard_keys:adminDashboard permission
dashboard_keys:readDashboard permission
dashboard_keys:writeDashboard permission
dashboard_pats:readDashboard permission
dashboard_providers:adminDashboard permission
dashboard_providers:deleteDashboard permission
dashboard_providers:readDashboard permission
dashboard_providers:writeDashboard permission
dashboard_secrets:adminDashboard permission
dashboard_secrets:deleteDashboard permission
dashboard_secrets:readDashboard permission
dashboard_secrets:writeDashboard permission

Every app-level key is minted with an explicit scope set. Managed-agent keys receive a bounded runtime set rather than a wildcard, and derived keys can narrow their parent’s scopes further — an agent that only needs to issue provider calls does not need permission to create other agents.

with_constraints(scopes=[...]) returns a sibling SDK instance whose narrowed scopes are surfaced through the SDK on every request. The constraint is the intersection of the key’s scopes and the supplied list — it can only narrow, never broaden. Useful for handing a derived SDK instance to a less-trusted component (a plugin, a tool call) without minting a new key. The same call also accepts an optional rule — a request rule, evaluated server-side, carried by every request the returned instance makes, that can only further restrict each one; pass scopes, rule, or both.

If the route requires a scope not in the intersection, the backend raises InsufficientScopeError with the missing scope listed.

  • ErrorsScopeReauthRequiredError, InsufficientScopeError.
  • API keys — minting keys with specific scope sets.
  • Connections — where provider scopes are first established.

Report an issue with this page

Necessary

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

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

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

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