Skip to content

Organization API key scopes ​

An organization API key carries a list of scopes. Every runtime call checks for the scope it needs. A call made without that scope returns 403 with This API key is missing the <scope> scope. Creating a key with a scope name that does not exist returns 400 Invalid scopes: ....

Give each key only the scopes its backend needs. Send the key in the X-TenancyEngine-Api-Key header; the SDKs do this for you.

Get the list from the API ​

The same catalog is served without authentication, so you can read it before you create your first key:

bash
curl https://api.saasruntime.com/api/v1/public/api-key-scopes
jsonc
{
  "apiKeyHeader": "X-TenancyEngine-Api-Key",
  "scopes": [
    {
      "scope": "webhooks.manage",
      "label": "Manage webhooks",
      "description": "List, create, update, rotate and delete the application's outbound webhook endpoints. Returns signing secrets.",
      "group": "Integrations",
      "sensitive": true,
      "restriction": "none",          // none | org-wide-keys-only | platform-trusted-organizations-only | app-level-keys-only
      "grantedBy": ["admin"],          // other scopes that also satisfy this one
      "deprecated": false              // true: existing keys keep working, new keys cannot use it
    }
  ]
}

grantedBy is computed from the platform's own authorization check, so it is always accurate:

  • Scopes are exact. A scope satisfies only its own check. The only overlaps are the two legacy scopes below, and they are listed in grantedBy.
  • admin (legacy) satisfies every pre-existing scope that does not spend money or reveal credentials, but none of the exact-only scopes: not the management scopes (for example offerings.write, environments.settings.write, apikeys.rotate.self) and not the spend and credential scopes listed below. Only org-wide keys can hold it; never give it to an application backend. Existing keys keep working; new keys cannot be created with it.
  • mcp.full (legacy) is a composite for the TenancyEngine CLI and MCP server. It satisfies the application, tenant, entitlement, billing and analytics scopes listed below, and nothing that spends money, reads credentials or manages an application. Existing keys keep working; new keys cannot be created with it.
  • Scopes that spend money or return credentials are exact-only: sms.send, ai.extract, ai.credits.grant, secrets.read, config.read, config.write, cache.read, cache.manage, custom-domains.write, storage.write, webhooks.manage, scim.provision, setup-links.write, automation.execute, applications.resolve.platform, search.query and oauth.introspect. Neither admin nor mcp.full satisfies them. A key needs that exact scope.

If an admin key now gets 403 scope_exact_required ​

Before this change admin satisfied the scopes above even though their documentation said no composite did. It no longer does. A call that an admin key used to make returns 403 with an error message naming the scope you need. Most routes also return "code": "scope_exact_required" and "requiredScope"; automation routes return automation_scope_required and SCIM routes return the SCIM error body, with the scope named in the message. To fix it, create a new key that lists the exact scope (new keys cannot carry admin, so list the scopes the key actually needs), switch the caller to it, then revoke the old key. A key that never held admin and lacks the scope gets "code": "scope_missing". The console marks keys that carry a legacy scope with a "Legacy scope" badge so you can find the ones to replace, and the tenancyengine-mcp key tools explain the code.

  • tenants.read and analytics:write no longer satisfy each other (#788). If your backend needs both, give the key both scopes.

All scopes ​

The tables below are generated from the platform's scope catalog. A unit test fails if they drift from it.

Applications ​

ScopeWhat it allowsAlso granted byNotes
applications.readList and view this organization's applications and their configuration.mcp.full, admin
applications.writeUpdate an application's own record (name, description, logo, website). Also accepted, alongside tenants.write, by the runtime create-tenant route. Environments, features, offerings, roles and claims have their own scopes.mcp.full, admin
applications.createCreate a new application in the organization. Organization-wide keys only.NoneSensitive; Org-wide keys only
applications.deleteReserved. Delete an application and its data. Organization-wide keys only; no route accepts it yet.NoneSensitive; Org-wide keys only
environments.readList an application's environments (kind, active flag, whether a server OAuth client is provisioned). Never returns secrets, client ids or redirect URIs.admin
environments.settings.readRead an environment's non-secret settings: client id, authority, API base URL, redirect URIs, post-logout URIs, webhook URL and allowed origins. Never returns secrets.None
environments.settings.writeCreate an environment and update its non-secret settings. Does not read or rotate secrets.None
environments.secrets.rotateReserved. Rotate an environment's server or webhook secret, which reveals the new secret once. No route accepts it yet.NoneSensitive
features.readList and view an application's feature definitions.None
features.writeCreate, update and delete an application's feature definitions.None
offerings.readList an application's product offerings. The runtime route returns active offerings only; management routes also return inactive ones.admin
offerings.writeCreate, update and delete an application's product offerings. Read access is the separate offerings.read scope.None
email-branding.readRead an application's email branding.None
email-branding.writeUpdate an application's email branding.None
contract.readRead the difference between an application's declared product contract and what is configured.None
roles.readList and view an application's roles.None
roles.writeCreate, update and delete an application's roles.None
claims.readList and view an application's claims.None
claims.writeCreate, update and delete an application's claims.None
payments.readRead whether an application's payments are set up. Status only; it cannot provision or change anything.None
configascode.readExport an application environment's features, offerings, roles, claims and webhooks as a configuration file. Never returns a secret.None
configascode.planPreview what applying a configuration file would change, without changing anything. Never returns a secret.None
configascode.writeApply a configuration file to an application environment. A key cannot confirm billing changes or change webhook destinations; those need a signed-in person.NoneSensitive
readiness.readCheck an application's own environment and configuration status through the platform readiness endpoint.admin
applications.resolve.platformResolve any application by slug across organizations through the narrow platform-resolve endpoint. Reserved for TenancyEngine's own services. Held only by this exact scope.NoneSensitive; TenancyEngine services only

Tenants ​

ScopeWhat it allowsAlso granted byNotes
tenants.readList and view tenants (your customers) of this organization's applications, including their usage.mcp.full, admin
tenants.writeCreate tenants and change tenant data and usage: record and release usage, edit tenant branding, record onboarding progress, run bulk data imports, manage inbox categories and preferences, and delete a tenant user's inbox data. Does not change tenant core fields.mcp.full, admin

Users ​

ScopeWhat it allowsAlso granted byNotes
users.readList and view end users of this organization's applications.admin
users.writeCreate, update and manage end user records.admin

Billing and entitlements ​

ScopeWhat it allowsAlso granted byNotes
entitlements.readCheck plan and feature entitlements for an organization, application or tenant.mcp.full, admin
billing.readView billing and subscription status.mcp.full, admin
billing.writeChange plans and manage billing and subscription state.mcp.full, admin

Storage ​

ScopeWhat it allowsAlso granted byNotes
storage.readIssue short-lived download URLs for app-owned private storage objects.admin
storage.writeCreate and confirm platform storage objects (upload URLs). Uploads cost storage. Held only by this exact scope.NoneSensitive
storage.grants.readList persisted storage access grants without being able to change them.admin
storage.grants.writeCreate and revoke storage access grants, which change who can download a private object.admin
storage.entitlements.readIssue a 60-second download URL for a paid (entitlement-bound) storage object to the buyer who holds a valid entitlement, and read its metadata. Held only by this exact scope: neither the legacy admin tier, any composite nor the other storage scopes grant it. Application-level keys only.NoneSensitive; Application-level keys only
storage.entitlements.writeCreate entitlement-bound objects and mint, renew and revoke the entitlements that decide who may download them. Held only by this exact scope. Application-level keys only.NoneSensitive; Application-level keys only

Integrations ​

ScopeWhat it allowsAlso granted byNotes
webhooks.manageList, create, update, rotate and delete the application's outbound webhook endpoints. Returns signing secrets.NoneSensitive
analytics:writeRecord analytics and usage events for this organization's applications.mcp.full, admin
analytics:readRead aggregated per-object page-view counts for this organization's applications. Counts only; no visitor data.admin

Automation ​

ScopeWhat it allowsAlso granted byNotes
automation.readView tenant-scoped automation definitions and run state.admin
automation.writePublish immutable, tenant-scoped automation definition versions.admin
automation.executePublish tenant-scoped events and request durable automation execution.NoneSensitive

AI and MCP ​

ScopeWhat it allowsAlso granted byNotes
mcp.fullLegacy composite scope for the TenancyEngine CLI and MCP server: grants the applications, tenants, entitlements and billing scopes listed as granted by mcp.full. Never grants a spend or credential scope or any management scope. Existing keys keep working; new keys cannot be created with it. Use the exact scopes instead.admin
mcp.connectLets an external MCP client connect to one application's own data through the MCP gateway.admin
ai.extractCall the AI extraction pass-through. Every call spends the organization's AI budget.NoneSensitive
ai.chatCall the private AI chat route from your server (not a browser): the platform's rules come first, the conversation is never stored and no knowledge base is read. Every call spends the organization's AI budget. Application-level keys only. Held only by this exact scope.NoneSensitive; Application-level keys only
ai.structuredCall the private structured-inference route from your server (not a browser): your data is never treated as instructions, the answer is validated against your schema before it is returned, and nothing is stored beyond one audit record. Every call spends the organization's AI budget. Application-level keys only. Held only by this exact scope.NoneSensitive; Application-level keys only
ai.credits.readRead an account's current AI credit balance. Read-only.admin
ai.credits.grantGrant a prepaid AI credit balance to an account. Moves money-equivalent balance. Reserved for TenancyEngine's own billing service.NoneSensitive; TenancyEngine services only

Cache ​

ScopeWhat it allowsAlso granted byNotes
cache.readRead the application's cache status, usage and live connection credential.NoneSensitive
cache.manageProvision or deprovision the application's dedicated cache database. Deprovisioning deletes it.NoneSensitive

Messaging ​

ScopeWhat it allowsAlso granted byNotes
sms.sendSend SMS through the platform's messaging pass-through. Every message costs money. Held only by this exact scope: neither the legacy admin tier nor any composite grants it.NoneSensitive
inbox.sendSend an in-app inbox message, and optionally an email, to one of your end users. Emails go from the platform sender, are capped per application per day and skip suppressed addresses. Held only by this exact scope.NoneSensitive
ScopeWhat it allowsAlso granted byNotes
search.queryRun a web search through the platform's search route. Every query costs money and is limited by per-key, per-application and platform caps. Application-level keys only. Held only by this exact scope; first-party pilot only.NoneSensitive; Application-level keys only

OAuth ​

ScopeWhat it allowsAlso granted byNotes
oauth.introspectAsk whether an access token issued for this application's own resource is still active (revoked, member removed, role narrowed), through the platform introspection route. Answers only for tokens whose audience is this application's registered resource. Application-level keys only. Held only by this exact scope.NoneSensitive; Application-level keys only

Custom domains ​

ScopeWhat it allowsAlso granted byNotes
custom-domains.readList the application's tenant-owned custom domains and check their status.admin
custom-domains.writeRegister, verify and delete the application's tenant-owned custom domains. Can trigger real certificate provisioning.NoneSensitive

Enterprise identity ​

ScopeWhat it allowsAlso granted byNotes
scim.provisionLets a customer's identity provider (Okta, Entra) create, update and deactivate that tenant's users over SCIM 2.0. Deactivating a user signs them out.NoneSensitive
setup-links.writeCreate and revoke the one-time link a customer IT admin uses to set up single sign-on, SCIM and domains.NoneSensitive

Secrets and config ​

ScopeWhat it allowsAlso granted byNotes
config.readRead the application's encrypted key-value config entries for one environment. Returns real credential values.NoneSensitive
config.writeCreate, overwrite and delete the application's encrypted config entries.NoneSensitive
secrets.readRead the decrypted current value of every secret the application's environment owns or has been granted. Held only by this exact scope: neither the legacy admin tier nor any composite grants it.NoneSensitive

Administration ​

ScopeWhat it allowsAlso granted byNotes
apikeys.rotate.selfLets the key rotate itself, and only itself, when the organization and application policy allow it. It can never name another key and never gains scopes.NoneSensitive
adminLegacy. Grants every pre-existing non-sensitive scope, but none of the exact-only scopes: not the management scopes added in TE #803 (offerings.write, environments.settings.write and the like) and not the spend and credential scopes (sms.send, ai.extract, secrets.read, config.read and write, cache.read and manage, custom-domains.write, storage.write, webhooks.manage and the like). A denied call returns scope_exact_required. Org-wide keys only. Existing keys keep working; new keys cannot be created with it. Use the exact scopes instead.NoneSensitive; Org-wide keys only

Sensitive scopes spend money, return credentials or have a destructive side effect. TenancyEngine services only means key creation rejects the scope for any organization other than TenancyEngine's own.

TenancyEngine platform documentation