Apps and OAuth
Delegate account access through explicit consent, S256 PKCE, resource-bound tokens and revocable installations without sharing an API key.
On this page
Register an app
Use OAuth clients in the console, one of the developer tools, to register a client with exact redirect URIs and the permissions it may request. Registration is not an installation and grants no access to another account. Public clients use none; a server that can keep a secret may use client_secret_post. A client name is a label, not proof of a verified developer.
A developer can keep 25 active apps, with up to 10 redirects each. A redirect uses HTTPS, or HTTP on the client's own machine: http://localhost, http://127.0.0.1 or http://[::1]. Nothing else over plain HTTP is a redirect, and private-use URI schemes are not accepted. Wildcards, fragments and embedded credentials are refused.
At the authorization endpoint a loopback redirect matches a registered one when the host, the path and the query are equal. The port may differ, because a native client listens on whichever port is free. The three loopback names are not interchangeable, and every other redirect matches exactly. The code remembers the redirect it was sent to, port included, and the token endpoint requires exactly that one.
The app operations and installation management require the person's console session. Neither API keys nor app access tokens can create apps, approve consent or revoke someone else's grants. Confidential client secrets appear only on creation or rotation; store them outside source code and logs.
In an organization, the apps and the installations belong to the organization's account and every member can list them. Registering or changing an app takes the member's apps:manage; opening a consent request, deciding it and revoking an installation take agents:connect.
An agent host does not need this step: it registers itself or names itself by a document it publishes, as the next section describes. A person connects one with the steps in Connect your agent.
Clients that register or identify themselves
A client nobody registered in the console is known in one of two ways. Neither grants access by itself: the person still approves in the browser, and the approval screen shows what was and was not checked about the client.
Dynamic registration
POST /oauth/register registers a public client without a credential. It reads client_name, redirect_uris, grant_types, response_types, token_endpoint_auth_method and scope, and ignores every other field a host sends. A field set to null counts as left out, and so does a blank scope: some serializers write a field they mean to leave out that way.
- It always registers a public client with both grants,
authorization_codeandrefresh_token, whatever method was asked for. It issues neither a secret nor a registration-management credential. - Of the redirects it keeps the ones it can use and drops the others. With none left it answers
invalid_redirect_uri. - Grants that leave out
authorization_code, or response types that leave outcode, answerinvalid_client_metadata. - A missing name becomes
Unnamed app. A name is stored as one line of at most 100 characters, without control, invisible or direction-changing characters. - A registration that names no
scopemay later ask for any permission an app can hold. What it gets is decided at approval. - The answer states what was registered, not what was sent: the redirects that were kept,
token_endpoint_auth_methodasnone, both grants, the scope andclient_id_expires_at.
A self-registered client lapses 30 days after it was registered or last exchanged a token. Every exchange or refresh that succeeds moves that date forward, so a client in use stays registered. A lapsed client answers 401 invalid_client at the token endpoint, which is what tells a host to register again.
Registration is anonymous and rate-limited, so the clients nobody has approved are bounded, at 2,000. A client stops counting once an account approves it. When the bound is reached, the oldest unapproved client that nobody is being asked about gives way to the new one; only when every such client has an approval waiting does registration answer 429.
Nothing about a self-registered client is checked, its name included. The approval screen says so, and the consent request and the installation report it as dynamic.
Client ID Metadata Documents
A client may instead send the URL of a Client ID Metadata Document as its client_id: a JSON document it publishes about itself. Discovery advertises this with client_id_metadata_document_supported. The URL is canonical https on a public DNS name and the default port, with a path and no credentials, query or fragment, and at most 512 characters. A URL that is not in that form is a malformed client_id, which answers invalid_request.
- A document cannot be served from the API's own host.
- The API fetches the document with one
GETthat follows no redirect and carries no credential, within 5 seconds and 8 KiB. - The document must be a JSON object whose
client_idis that URL, with at least one usable redirect inredirect_uris. The usable ones are kept, up to 20, and the others dropped. - A
client_nameis optional. A client that gives no name goes by the host that serves its document. - The client is always public. A document that carries a secret or asks for any client authentication is refused, since the API would not be checking what the client believes it is.
- Fields the API does not read are ignored and a field set to null counts as left out, as in a registration.
grant_typesandresponse_types, where the document states them, must includeauthorization_codeandcode. - The identity is stored and read again after 24 hours. If that read fails, authorization fails: the stored copy is not trusted in its place.
- A failure at any of these answers
invalid_client_metadata. - A changed document updates the name and the redirects for future requests and leaves existing installations alone. A person approved them, and the host that published the document then is the host publishing it now.
- The token endpoint never fetches. It uses the stored identity, and grants are compared by the stored client, not by the string a client sent.
- Reading a document is work done for a stranger, so documents that are not stored yet have a rate limit of their own. Over it the request answers
429 temporarily_unavailable. - Stored identities nobody has approved are bounded as self-registered clients are, at 2,000, and the oldest gives way to a new one in the same way.
What was verified is the domain that serves the document, and that is what the person is shown. The name in the document is still only what that domain says about itself. The consent request and the installation carry the URL as metadataUrl.
At most 100 approvals may wait for one client at a time, and 10,000 for all clients together. One published identity stands for every person who uses that host, so only the second bound applies to it.
Permissions and account boundaries
| Scope | Permission |
|---|---|
account:read | Read account identity, plan, usage and aggregate activity. |
inboxes:read | Read inbox addresses, metadata and activity summaries. |
inboxes:write | Create, update and delete inboxes. |
mail:read | Read messages, threads, attachments and mail-bearing events, and the services and verification codes found in mail. |
mail:write | Change thread read state, metadata and labels, trash threads, record the services an address signs up for, and start a sign-in the owner allows. |
mail:send | Send mail and replies from the account's inboxes. |
mail:draft | Write drafts for the owner to send. It sends nothing. |
events:read | Read and stream the event log, including message content. |
webhooks:manage | Manage this installation's webhook endpoints and deliveries. |
rules:manage | Manage this installation's durable inbound rules. |
The default agent permissions are account:read, inboxes:read, mail:read, mail:write, mail:send: what an agent needs to read, file and answer mail. A request without a scope asks for these, limited to what the client is registered for. Creating and deleting inboxes, webhooks, rules and the event log stay available to a client that asks for them by name.
Every reference operation lists all required scopes and whether it allows delegated access. Scopes limit actions across the consenting account; they are not an inbox allowlist. Existing account and inbox API keys retain their capabilities.
- Events and streams require both
events:readandmail:read, because events can contain full message text. - Webhook management requires
webhooks:manage,events:readandmail:read. Apps manage installation-owned endpoints, not legacy inbox webhooks. - Rules require
rules:manage,mail:read,mail:writeandmail:send, even for a label-only rule, because editing a rule can authorize future sends. - Apps cannot obtain
keys:manage, mint unrestricted keys, or provision an inline key or legacy webhook when creating an inbox. - Apps cannot manage custom domains or create an inbox on one: no permission covers them. Inboxes that already live on a custom domain stay reachable through the inbox and mail permissions.
- Endpoints, rules, delivery histories and delivery-failure events are filtered to the calling installation. Revocation is checked again before background work runs.
Refresh and revocation
Access tokens last up to 15 minutes. A connection, the chain of refresh tokens that follows one approval, ends 30 days after its last refresh or 365 days after it was approved, whichever comes first. A connection in use is never interrupted inside that year, and one that goes unused ends on its own. Near the end an access token answers for no longer than what is left of its connection. Pass the access token as the SDK's apiKey or api_key value. It is not a dm_ API key.
Refresh with grant_type=refresh_token, the current refresh token, client ID and the original resource. A refresh can keep or narrow scopes, never widen them. Serialize refreshes per grant and atomically replace the stored token pair on success.
A used refresh token is remembered until it would have expired anyway. Presented after that, it is an expired token, not evidence of theft. A connection approved before these lifetimes were introduced keeps the 30 days from approval it was given; the new lifetimes apply from the next approval.
GET /v1/app-installs answers each grant as an AppInstall with what a person needs to see: lastUsedAt, when the client last used it, to the minute; expiresAt, when its connection ends unless the client uses it first, or null when no connection is alive; dynamic, true for a client that registered itself; and metadataUrl, the identity document of a client that published one.
Revoke an installation in the console: Apps lists everything connected to the account, each with Disconnect. Its tokens stop working, streams close, and future app-owned webhook deliveries and rule actions stop. App edits, deletion or secret rotation invalidate existing installations and pending consent. Already-sent mail and in-flight network requests cannot be recalled.
When a request is refused
An OAuth refusal is not the REST error envelope. It answers { "error": "<code>" }, and most refusals add an error_description: a fixed sentence written in the API, never text taken from the request. The description is for a person or a log; a program branches on error. An invalid authorization request never redirects.
| Code | Status | When |
|---|---|---|
invalid_request | 400 | A parameter the endpoint reads is missing, malformed, repeated or too long; the resource is not this API's origin or its MCP endpoint; the redirect is not one the client registered; or the body has the wrong content type. |
invalid_client | 400, 401 | The client is not registered here, its registration lapsed, or its authentication failed. The token endpoint answers 401, which tells a host to register or identify itself again. |
invalid_grant | 400 | The code or refresh token is unknown, expired or already used, or does not match the client, the redirect, the resource or the verifier. |
invalid_scope | 400 | An authorization or token request names a permission this API does not have or names one twice, the client is not registered for it, or a refresh asked for more than it holds. |
unsupported_grant_type | 400 | The grant is neither authorization_code nor refresh_token. |
temporarily_unavailable | 429 | A rate limit was reached, or too many approvals or unapproved clients are waiting. Retry-After says when to try again. |
invalid_redirect_uri | 400 | Registration only: none of the redirects is one this API can use. |
invalid_client_metadata | 400 | The registration is not a JSON object, a field the API reads has the wrong type or is too long, its grants leave out authorization_code, or its scope names a permission this API does not have or names one twice. Also a Client ID Metadata Document that could not be read or did not check out. |
Discovery and MCP authorization
The authorization server is https://api.doorman.fyi/.well-known/oauth-authorization-server. REST uses the resource https://api.doorman.fyi; MCP uses https://api.doorman.fyi/mcp. These are distinct audiences, so a token for one is refused by the other.
Hosts ask a person for whatever is advertised, so discovery advertises what an agent needs and no more. The authorization-server metadata lists the default agent permissions and offline_access under scopes_supported, and the MCP resource metadata lists the default agent permissions. The REST resource metadata still lists every app permission, and a client may ask for any of them by name.
An unauthenticated request returns a WWW-Authenticate challenge pointing to the matching protected-resource metadata; on the MCP endpoint the challenge also names the default agent permissions. An MCP host can discover it, register itself or name itself by its metadata document, then run the same browser consent flow with S256 PKCE.
The remote MCP server lists only tools allowed by the app's scopes. Each tool call is checked again against the registry, tenant and resource; hiding a tool is not the authorization boundary. Dynamic registration does not establish a trusted developer identity.

