API keys (TenancyEngine)
Organization-scoped developer keys for MCP integrations and automation. Plain-text keys are shown once at creation — copy them immediately.
Console: TenancyEngine console → API keys (/api-keys)
Available to organization-scoped vendor admins.
Organization keys and application keys
Every key has a level, chosen when you create it. The level cannot be changed later.
| Level | Where you create it | What it can reach |
|---|---|---|
| Organization | API keys (this page) | Every application in the organization, or only the applications you list as an allowlist. |
| Application | Inside one application | That one application only. It cannot carry an application allowlist and cannot hold the organization-wide scopes (such as creating or deleting applications). |
Use an application key for a backend that serves one app, and for AI assistant connections. Use an organization key only for tooling that really spans several applications. If you try to lock an organization key to one application, or create an application key from this page, the request is refused with a message pointing you to the right place.
Create a key
- Select the target organization (or open the application, for an application key).
- Set a name and the scopes the key needs. Give a key only what its job requires.
- Choose the environments the key can reach (see below).
- Choose an expiry (see below).
- Optionally add an IP allowlist.
- Submit. The plain key appears once in a banner. Store it in your secret manager.
Environments
When you create a key in the Console you choose the environments it is meant for: Development, Staging and/or Production. Only Development is ticked to start with. Add Staging or Production only when the integration needs them; ticking Production asks you to confirm that the key may reach live data. Outside the Console the same confirmation is required: send productionConfirmed: true with the create request (the CLI flag is --confirm-production, the MCP tool argument is productionConfirmed); without it a list that includes Production is refused with 400 production_not_confirmed. It guards against accidental grants; it is not a security boundary. Rotating a key keeps the same environments.
Important: the environments are not full isolation yet. A key limited to some environments is refused (403 environment_not_allowed) when it asks for another environment on the routes that read secrets and configuration values, create or look up tenants, meter usage, and handle imports, inbox, branding, SCIM, automation and tenant webhooks. Application webhook endpoints receive the events of every environment, so only a key that allows every environment can manage them. Creating a tenant or reading offerings without naming an environment means Production, so a Development key must name Development. Environments are not enforced on routes that belong to the whole application, so a Development key can still use them: sending SMS, AI extraction and AI credits, the MCP gateway, and the cache connection details. They are also not enforced on application cache management, caching mode, reading or changing an existing custom domain, storage requests that name no tenant, search, token introspection and the environment and readiness listings (#1371). Keys with no environment setting are never checked. Do not rely on environments alone to keep a key away from production data or production spend: give the key only the scopes it needs, and keep production credentials out of integrations that do not need them.
Keys created before environments could be chosen, and organization-level, system-issued and tenant-bound (SCIM) keys created without a choice, show No environment restriction in the key list. An application-level key created without a choice, from the Console, the API or a tool, is recorded as Development. They keep working unchanged. To give one a limit, create a replacement key with the environments you want, then revoke the old key. The key list can be filtered to show only these keys.
A key can never do more than you can
When you create or rotate a key, the scopes you can grant are capped by your own permissions. You cannot give a key a scope you could not use yourself. If you ask for more, the request is refused with a permission error and nothing is created.
Scopes
Scopes are exact: each one allows only its own actions. Scopes that spend money or reveal credentials (for example sms.send, ai.extract, secrets.read) are never bundled into another scope and must be added on purpose. The older admin and mcp.full scopes keep working on keys that already have them, but new keys cannot be created with them. The full list, with what each scope allows, is in the API key scopes reference. A connected AI assistant can ask a key what it is allowed to do (the whoami_api_key tool), which is the quickest way to see a key's exact scopes, level and expiry.
Expiry and keys that never expire
- Pick a date for the key to stop working. This is the default and the safest choice.
- Your organization can set a maximum lifetime. If you pick a later date, the key is created with the latest date allowed and you are told so.
- A key with no expiry needs two things: your organization must allow it, and you must tick the confirmation when you create the key. Your name is recorded as the person who accepted it. If your organization has a maximum lifetime, no-expiry keys are not available.
Ask an organization admin to change these rules; see Organization key rules. Developers can read and set the same rules through the API key policy reference.
MCP device approval
When an MCP client redirects here with a user_code query parameter, enter the code in Approve device to issue a key for that connection.
Rotate
Rotate creates a replacement for a key and lets the old key keep working for an overlap you choose (none, 15 minutes, 1 hour, 24 hours or 7 days). A confirmation appears first. The replacement has the same scopes, application and IP restrictions as the original, and keeps its expiry rule: it never outlives your organization's current maximum lifetime. The new key is shown once, so copy it right away, then switch your integrations to it before the overlap ends.
A key that rotates itself
A backend can replace its own key before it expires, without a person. This is off unless you turn it on, and it needs all of the following:
- the key holds the
apikeys.rotate.selfscope (it is never added automatically); - your organization allows self-rotation;
- the application has not switched it off (see below);
- the chain of replacements has not reached its limit.
Each replacement keeps the old key working for a short overlap, 15 minutes unless your organization sets another value between 1 minute and 24 hours. A self-rotating key can only replace itself and can never gain scopes. The chain limit (90 days by default, up to 365) counts from the first key in the chain, so a key cannot renew itself forever. After the limit, a person has to issue a new key.
Organization key rules
Organization admins set these under the organization's security policy:
| Rule | What it does |
|---|---|
| Maximum key lifetime | Longest life, in days (1 to 3650), for any new key. Clear it to remove the limit. |
| Allow keys with no expiry | Whether a key may be created without an expiry. |
| Allow self-rotation | Whether keys that hold apikeys.rotate.self may replace themselves. |
| Self-rotation overlap | How long the old key keeps working after it replaces itself (1 to 1440 minutes). |
| Chain limit | Most days a chain of self-replacements may run (up to 365). |
Each application can then choose Inherit, Allow or Deny for self-rotation. An application can only be stricter than its organization: Allow is refused while the organization has self-rotation off, and Deny always wins. Changes to these rules are written to the audit log with your name.
When the person who created a key loses access
A key is only as trusted as the person who made it. When that person's access shrinks, their keys are reviewed automatically:
- They are removed from the organization or the application team, leave, or their account is deleted or disabled: their keys are suspended (revoked) straight away.
- They stay but now have fewer permissions: their keys are narrowed to the scopes they can still grant. A key left with no scopes is suspended.
- They get their permissions back: nothing is widened and no suspended key comes back. Issue a new key.
Every affected key is flagged review required with the reason, shown in the key list, and the audit log records an apikey.creator_access_lost entry naming the person and each key. Rotating a flagged key carries the flag to the replacement, so the review is not lost. Keys issued to a machine (an environment's own credential, with no person behind it) are not affected.
Revoke
Revoke opens a confirmation dialog. Revoked keys stop working immediately; automation using them must be updated.
Keys can be revoked but not deleted. A key that is locked to one application is removed together with that application when the application is deleted; the audit log keeps an api_key.delete entry for each one.
Connecting an AI assistant (Claude, ChatGPT, etc.)
The AI Assistant / MCP Connector section further down this page is a separate, purpose-built flow for letting your own customers connect a personal AI client (Claude Desktop, Claude Code, ChatGPT, or any MCP-compatible client) to one application's own data — see Connect an AI assistant for full setup steps. It creates the same kind of API key as above (application-scoped, mcp.connect + whatever extra scopes your app's tools need), just with ready-to-copy config for each client.
Related
- Connect an AI assistant (MCP) — Claude/ChatGPT/other client setup
- Team — human members vs automation keys
- API key scopes — every scope and what it allows
- Chat for your app's users — chat keys and message limits
- Local development docs — SaaSRuntime API and MCP endpoints