# API keys

> Create a personal access token for a script or agent. Tokens use your current permissions and can be expired or revoked independently.

Source: https://docs.onedoor.team/api-keys/
All docs in one file: https://docs.onedoor.team/llms-full.txt

## Personal access tokens

OneDoor API keys are personal access tokens (PATs). A token authenticates as you
and uses your current permissions in the company targeted by each request.
Tokens have no permission or tool-selection settings of their own. To limit
what an agent reaches, connect it through a
[scoped connection](/mcp#scoped-connections) instead.

Tokens belong to your account, not to a company. They live under
**Account settings → Tokens** (`/account/tokens`), reached from your avatar menu,
and the same list shows every token you own across all your companies.

1. Open **Account settings → Tokens** and select **Create token**.
2. Give the token a name.
3. Choose a scope: one company, or **Full account**.
4. Optionally set an expiry.
5. Copy the token into your script's secret manager. It is shown only once.

A token limited to one company only works there. Requests that target another
company return `403`, even if you belong to it. A full-account token works in
every company you belong to, including ones you join later. Choose the
narrowest option the script needs. The company cannot be changed after creation;
create a new token instead.

Use a separate token for each script so you can revoke access independently.
Keep tokens out of browser code and source control.

## Use a token

Each company's **Connections** page has a **Personal access token** tab with
the MCP and HTTP addresses for that company. For example:

```sh
curl 'https://app.onedoor.team/api/organizations/<organization-id>/inventory' \
  --header "Authorization: Bearer $EXECUTOR_API_KEY"
```

A full-account token can access your other companies. Each request checks your
current membership and role. Changing the company URL does not grant access
to a company you do not belong to. Tool approval rules still apply.

For `GET /api/context`, pass `?organization=<organization-id-or-slug>` instead. A token
limited to one company can omit it.
Invalid, expired, or revoked tokens return `401`. Insufficient access returns `403`.

## Expiry and revocation

Signing out does not revoke tokens. Removing a company membership stops
access to that company, and role changes apply to subsequent requests.

To replace a token, create another, update your script, then revoke the old one.
Revocation prevents new requests. Requests already running may finish. Revoking
one token does not affect other tokens. The built-in `executor` app's saved
credential uses the same key system. Revoking that key also stops the saved
connection. Revoked tokens are removed from the list.

## Connect an MCP client

Use your PAT as the bearer token. The company URL names where calls run.
`<company>` is your company's short name (the company slug); the
company ID works there too:

```json
{
  "mcpServers": {
    "onedoor": {
      "type": "http",
      "url": "https://app.onedoor.team/org/<company>/mcp",
      "headers": { "Authorization": "Bearer <YOUR_PAT>" }
    }
  }
}
```

The **Connections** page fills in your server URL and the company you are
viewing, and links to your tokens with that company preselected. For
self-host, use your own origin. Keep the token in your client's private config
or secret store.

A token limited to one company also works on the bare `/mcp` URL with no
extra configuration. A full-account token on `/mcp` must say which company
to use with an `X-Executor-Organization` header. A token limited to one
company is rejected on any other company's URL.

The same token works with model, native, browser, and automatic approval
delivery. The plain MCP URL uses model mode; add `?elicitation_mode=native`,
`?elicitation_mode=browser`, or `?elicitation_mode=automatic` when needed. Tool approval rules still apply. Browser approvals require the token
owner to sign in. Revocation or expiry stops new MCP calls and continuations,
including on already-connected clients.

PATs do not require an OAuth sign-in flow. The existing [browser OAuth flow](/mcp-clients)
remains available. PATs do not create browser sessions; manage them from your
signed-in browser. Both methods use the same authorization checks and current
company roles.
