---
title: "Account"
description: "The account, its plan and usage, and account-wide counts."
url: https://doorman.fyi/docs/reference/account
markdown: https://doorman.fyi/docs/reference/account.md
area: "API reference"
section: "API reference"
---

# Account

The account, its plan and usage, and account-wide counts.

Source: https://doorman.fyi/docs/reference/account

## Who am I

`GET /v1/me`

Access `any`: any API key, or a console session.

The account, its plan and this month's usage, the caller (a key with its scope, or a session) and the inbox domain every address ends with.

OAuth: allowed with all of `account:read`. [App permissions](https://doorman.fyi/docs/oauth.md#scopes) apply in addition to account and resource checks.

Also available as [`client.me`](https://doorman.fyi/docs/sdk/reference/account.md#me) in TypeScript, [`client.me`](https://doorman.fyi/docs/python/reference/account.md#me) in Python, the [`me`](https://doorman.fyi/docs/mcp/tools/account.md#me) tool and [`doorman me`](https://doorman.fyi/docs/cli/commands/account.md#me) on the command line.

Organizations: every member's console session may call it. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

Answers `200`: The account and the caller.

**Response 200: Me**
The account, its plan and usage, the caller, the organization the account belongs to, and the inbox domain of this deployment.
- `account` (Account)
- `plan` (PlanSummary)
- `usage` (Usage)
- `key` (object | null): The API key that made the call; null for a console session.
  - `id` (string): An API key identifier. Example: `key_01jc5c0z9y8x7w6v5t4t3s2r1q`
  - `scope` ("account" | "inbox")
  - `inboxId` (string | null)
- `session` (object | null): The console session that made the call; null for an API key.
  - `userId` (string): The identity provider's user id.
  - `role` (string | null, optional): The person's role in the organization as the identity provider names it (`org:admin` or `org:member`); null in a personal account. What the session may do follows `memberRole`, not this. Older deployments omit it. Example: `org:admin`
  - `memberRole` ("owner" | "admin" | "member" | "viewer" | null, optional): The role the API keeps for the person in the organization, which decides what the session may do: `owner`, `admin`, `member` or `viewer`. Null in a personal account. Older deployments omit it. Example: `owner`
  - `permissions` (("mail:read" | "mail:write" | "mail:send" | "inboxes:manage" | "security:manage" | "keys:manage" | "webhooks:manage" | "domains:manage" | "apps:manage" | "agents:connect" | "members:manage" | "billing:manage" | "account:manage" | "compliance:manage" | "phi:read")[], optional): What this session may do: every permission in a personal account, otherwise what the member's role holds. A person the identity provider names an admin holds at least what an admin holds. Older deployments omit it.
  - `personalAccountId` (string | null, optional): In an organization, the account `POST /v1/organization/adopt` would move, for as long as it can be moved: the person's own personal account, when the session holds `account:manage`, the organization's account has never been used and no account was moved into the organization before. Null otherwise. Older deployments omit it.
- `organization` (Organization | null, optional): The organization the account belongs to, whoever is calling; null for a personal account. Older deployments omit it.
- `oauth` (object, optional): Present only when a scoped app access token made the call.
  - `appId` (string): An OAuth client identifier. Example: `app_01jc5f1a2b3c4d5e6f7g8h9j0k`
  - `installationId` (string): An app installation identifier. Example: `ins_01jc5f1a2b3c4d5e6f7g8h9j0k`
  - `scopes` (("account:read" | "inboxes:read" | "inboxes:write" | "mail:read" | "mail:write" | "mail:send" | "mail:draft" | "events:read" | "webhooks:manage" | "rules:manage")[])
- `inbox` (Inbox | null): The inbox an inbox-scoped key reaches; null otherwise.
- `inboxDomain` (string): Every inbox address is a mailbox name at this domain. Example: `doorman.example`
- `features` (object, optional): Configured capabilities, independent of the plan. Missing flags mean unavailable.
  - `customDomains` (boolean)
  - `domainConnect` (boolean)
  - `signIn` (boolean, optional): Whether Sign in with Doorman is switched on for this deployment.
  - `billing` (boolean, optional): Whether an account can pay for a plan here. Where it cannot, plans are set by the operator.
  - `healthcare` (boolean, optional): Whether healthcare guardrails and the business associate agreement are switched on for this deployment (ADR-027).
  - `drafts` (boolean, optional): Whether an app or a key can write drafts for the owner to send here (ADR-028).
- `billing` (BillingSummary, optional): Present where billing is switched on and the caller is an account key or a console session.
- `healthcare` (object, optional): Present where healthcare guardrails are switched on and the caller is an account key or a console session.
  - `baa` ("not_signed" | "active" | "reacceptance_required" | "terminated"): Where the account stands with the business associate agreement.
  - `eligible` (boolean): Whether the account may sign and change guardrails now.
  - `guardrails` (boolean): Whether guardrails apply to the account's mail now.

Example 200 response:
```json
{
  "account": {
    "id": "acc_01jc4q3x6k9m2n8p4r7t5v1w3y",
    "email": "dana@example.com",
    "name": "Dana Ortiz",
    "plan": "free"
  },
  "plan": {
    "name": "free",
    "label": "Free",
    "priceUsd": 0,
    "inboxLimit": 3,
    "monthlySendLimit": 3000
  },
  "usage": {
    "inboxes": 1,
    "sendsThisMonth": 37,
    "monthResetsAt": "2026-12-01T00:00:00.000Z"
  },
  "key": {
    "id": "key_01jc5c0z9y8x7w6v5t4t3s2r1q",
    "scope": "account",
    "inboxId": null
  },
  "session": null,
  "inbox": null,
  "inboxDomain": "doorman.example"
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `insufficient_scope` | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s "https://api.doorman.fyi/v1/me" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/me", {
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.get(
    "https://api.doorman.fyi/v1/me",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Overview

`GET /v1/overview`

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`.

The console's first page: inboxes against the plan, active keys, mail in the last 7 days, webhook deliveries in the last 24 hours and the getting-started checklist. Mail counts cover every inbox the account has had; unread threads cover live inboxes and untrashed threads.

OAuth: allowed with all of `account:read`. [App permissions](https://doorman.fyi/docs/oauth.md#scopes) apply in addition to account and resource checks.

Also available as [`client.overview`](https://doorman.fyi/docs/sdk/reference/account.md#overview) in TypeScript, [`client.overview`](https://doorman.fyi/docs/python/reference/account.md#overview) in Python, the [`overview`](https://doorman.fyi/docs/mcp/tools/account.md#overview) tool and [`doorman overview`](https://doorman.fyi/docs/cli/commands/account.md#overview) on the command line.

Organizations: every member's console session may call it. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

Answers `200`: The account's counts.

**Response 200: Overview**
The console's first page: counts, recent activity and the getting-started checklist.
- `inboxes` (object)
  - `active` (integer)
  - `limit` (integer | null): The plan's allowance; null means unlimited.
- `keys` (object)
  - `account` (integer): Active account keys.
  - `inbox` (integer): Active inbox-scoped keys.
- `mail` (object)
  - `receivedLast7Days` (integer)
  - `sentLast7Days` (integer)
  - `unreadThreads` (integer): Across live inboxes, untrashed threads.
  - `lastReceivedAt` (string (date-time) | null)
  - `lastSentAt` (string (date-time) | null)
- `webhooks` (object)
  - `inboxWebhooks` (integer)
  - `endpoints` (integer)
  - `deliveredLast24Hours` (integer)
  - `failedLast24Hours` (integer)
- `checklist` (object): What has happened at least once.
  - `createdInbox` (boolean)
  - `createdKey` (boolean)
  - `receivedMessage` (boolean)
  - `connectedWebhook` (boolean): True while an inbox webhook or an endpoint exists.
  - `sentMessage` (boolean)
- `services` (object, optional): The account's passport: the outside services its addresses are signed up for. Older deployments omit it.
  - `total` (integer): Services the live inboxes are signed up for, archived ones left out.
  - `pending` (integer): Sign-ups not confirmed yet.
  - `paid` (integer): Services that have sent a receipt or an invoice.
  - `attention` (integer, optional): Services with an active warning (an unexplained code, a password reset, or a security notice). Older deployments omit it.
  - `signInsPending` (integer, optional): Sign-ins an agent asked for that wait for the owner to allow them. Omitted by older deployments and where Sign in with Doorman is not switched on.
- `security` (object, optional): Risk assessment counts (ADR-019). Older deployments omit it.
  - `held` (integer): Messages held for review across live inboxes.
  - `flaggedLast7Days` (integer): Inbound messages of the last 7 days assessed high or critical.
  - `heldSends` (integer, optional): Sends that wait for the owner's word across live inboxes. Older deployments omit it.
  - `scanning` (integer, optional): Messages that arrived and wait out of sight for the check of their files and links to finish, across live inboxes. They are in no list until it does. Older deployments omit it.

Example 200 response:
```json
{
  "inboxes": {
    "active": 1,
    "limit": 1
  },
  "keys": {
    "account": 2,
    "inbox": 1
  },
  "mail": {
    "receivedLast7Days": 1204,
    "sentLast7Days": 312,
    "unreadThreads": 3,
    "lastReceivedAt": "2026-11-05T10:05:00.000Z",
    "lastSentAt": "2026-11-05T10:05:00.000Z"
  },
  "webhooks": {
    "inboxWebhooks": 1,
    "endpoints": 2,
    "deliveredLast24Hours": 118,
    "failedLast24Hours": 2
  },
  "checklist": {
    "createdInbox": true,
    "createdKey": true,
    "receivedMessage": true,
    "connectedWebhook": true,
    "sentMessage": false
  },
  "services": {
    "total": 7,
    "pending": 1,
    "paid": 2
  }
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 403 | `insufficient_scope` | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s "https://api.doorman.fyi/v1/overview" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/overview", {
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.get(
    "https://api.doorman.fyi/v1/overview",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Metrics

`GET /v1/metrics`

Access `any`: any API key, or a console session.

Received, sent, delivered and failed per UTC bucket over a range, with message categories and verdicts over inbound mail. Buckets with no activity are present with zeros. A range may span 90 days, or 7 with hour buckets. Deliveries are counted in the bucket of their creation, which is when their event occurred. Inbox-scoped keys always get their own inbox.

OAuth: allowed with all of `account:read`. [App permissions](https://doorman.fyi/docs/oauth.md#scopes) apply in addition to account and resource checks.

Also available as [`client.metrics`](https://doorman.fyi/docs/sdk/reference/account.md#metrics) in TypeScript, [`client.metrics`](https://doorman.fyi/docs/python/reference/account.md#metrics) in Python, the [`metrics`](https://doorman.fyi/docs/mcp/tools/account.md#metrics) tool and [`doorman metrics`](https://doorman.fyi/docs/cli/commands/account.md#metrics) on the command line.

Organizations: every member's console session may call it. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `from` | query | `string (date-time)` | no | Start of the range. Defaults to 7 days before `to`. |
| `to` | query | `string (date-time)` | no | End of the range. Defaults to now. |
| `interval` | query | `"hour" \| "day"` | no | Bucket size. Defaults to day. |
| `inboxId` | query | `string` | no | Only this inbox; omit for the whole account. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`. |

Answers `200`: The series, totals, categories and verdicts.

**Response 200: Metrics**
Counts per UTC hour or day over a range, with message categories and verdicts over inbound mail.
- `from` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `to` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `interval` ("hour" | "day")
- `inboxId` (string | null): The inbox the counts are limited to; null for the whole account.
- `series` (MetricsBucket[]): One entry per bucket covering [from, to), zeros included.
- `totals` (MetricsCounters)
- `categories` (object): Inbound messages by category over the range.
  - `personal` (integer)
  - `automated` (integer)
  - `marketing` (integer)
  - `bounce` (integer)
  - `spam` (integer)
  - `malicious` (integer)
- `verdicts` (object): Inbound messages by verdict over the range.
  - `clean` (integer)
  - `unverified` (integer)
  - `suspicious` (integer)
- `risk` (object, optional): Assessed inbound messages by risk level over the range, held ones included. Older deployments omit it.
  - `low` (integer)
  - `medium` (integer)
  - `high` (integer)
  - `critical` (integer)
- `held` (integer, optional): Messages that were held over the range, whatever became of them. Older deployments omit it.

Example 200 response:
```json
{
  "from": "2026-10-30T00:00:00.000Z",
  "to": "2026-11-06T04:00:00.000Z",
  "interval": "day",
  "inboxId": null,
  "series": [
    {
      "at": "2026-10-30T00:00:00.000Z",
      "received": 140,
      "sent": 38,
      "webhookDelivered": 139,
      "webhookFailed": 1
    }
  ],
  "totals": {
    "received": 1204,
    "sent": 312,
    "webhookDelivered": 1192,
    "webhookFailed": 12
  },
  "categories": {
    "personal": 612,
    "automated": 341,
    "marketing": 188,
    "bounce": 19,
    "spam": 38,
    "malicious": 6
  },
  "verdicts": {
    "clean": 1071,
    "unverified": 112,
    "suspicious": 21
  }
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 400 | `validation_error` | A field is missing or invalid; the message names it. |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `insufficient_scope` | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s "https://api.doorman.fyi/v1/metrics" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/metrics", {
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.get(
    "https://api.doorman.fyi/v1/metrics",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Move a personal account into the organization

`POST /v1/organization/adopt`

Access `session`: a console session only; an API key gets 403 `session_required`.

Makes the signed-in person's personal account the account of the organization they are working in. Its inboxes, keys, domains, webhooks, apps and plan stay as they are and become the organization's, under the same account id. It works once for an organization, and only while the organization's own account has never been used: nothing was created in it and the operator has not changed it. Otherwise the answer is 409 `organization_not_empty`. It cannot be undone. `accountId` names the personal account, so that nothing is moved by mistake. The person starts a new, empty personal account the next time they work outside the organization.

OAuth: not available to delegated app tokens.

Also available as [`client.organization.adopt`](https://doorman.fyi/docs/sdk/reference/account.md#organization-adopt) in TypeScript and [`client.organization.adopt`](https://doorman.fyi/docs/python/reference/account.md#organization-adopt) in Python.

Organizations: a member's console session needs `account:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Request body (application/json): AdoptAccount**
The personal account to move into the organization the session is working in. It must be the signed-in person's own.
- `accountId` (string): An account identifier. Example: `acc_01jc4q3x6k9m2n8p4r7t5v1w3y`

Answers `200`: The organization's account, which is the one that was moved.

**Response 200: Account**
The account as its owner sees it: one person's, or the one an organization's members share.
- `id` (string): An account identifier. Example: `acc_01jc4q3x6k9m2n8p4r7t5v1w3y`
- `email` (string (email)): The person's verified address, or an organization's contact address. Example: `sam@example.com`
- `name` (string): The person's name, or the organization's. Example: `Dana Ortiz`
- `plan` ("free" | "pro" | "enterprise")
- `kind` ("personal" | "organization", optional): `personal` for one person's account, `organization` for the account a team shares. Older deployments omit it.

Example 200 response:
```json
{
  "id": "acc_01jc4q3x6k9m2n8p4r7t5v1w3y",
  "email": "dana@example.com",
  "name": "Dana Ortiz",
  "plan": "free"
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 400 | `validation_error` | A field is missing or invalid; the message names it. |
| 400 | `invalid_json` | The request body is not JSON. |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `organization_required` | The operation acts on an organization, and the session is in a personal account. Switch to the organization first. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `organization_not_empty` | The organization's account has been used, or an account was already moved into the organization, so another account cannot be moved in. Used means that an inbox, key, domain or app was created in it, even one since deleted, that it has a webhook endpoint, or that the operator changed it. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/organization/adopt" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "accountId": "acc_01jc4q3x6k9m2n8p4r7t5v1w3y"
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/organization/adopt", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "accountId": "acc_01jc4q3x6k9m2n8p4r7t5v1w3y"
  }),
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.post(
    "https://api.doorman.fyi/v1/organization/adopt",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "accountId": "acc_01jc4q3x6k9m2n8p4r7t5v1w3y",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Start a checkout

`POST /v1/billing/checkout`

Access `session`: a console session only; an API key gets 403 `session_required`.

A page at the payment provider where the person pays for the Unlimited plan, monthly. The plan changes when the provider reports the payment, never because the browser came back. An account that is already on a paid plan answers 409 `already_subscribed`. An organization's account pays for the Teams plan instead, $7 a month for each seat: the checkout is for as many seats as the organization holds, and never fewer than 3. Where the deployment does not sell that plan, an organization answers 404.

OAuth: not available to delegated app tokens.

Also available as [`client.billing.checkout`](https://doorman.fyi/docs/sdk/reference/account.md#billing-checkout) in TypeScript and [`client.billing.checkout`](https://doorman.fyi/docs/python/reference/account.md#billing-checkout) in Python.

Organizations: a member's console session needs `billing:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

Answers `200`: The checkout page.

**Response 200: BillingRedirect**
A page at the payment provider to send the person's browser to. It is for this account only and expires.
- `url` (string)

Example 200 response:
```json
{
  "url": "https://payments.example/checkout/c_123"
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `already_subscribed` | The account is already on a paid plan, so there is nothing to check out. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |
| 502 | `provider_unavailable` | The mail transport, the DNS setup provider or the payment provider did not answer, or refused this deployment's credentials. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/billing/checkout" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/billing/checkout", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.post(
    "https://api.doorman.fyi/v1/billing/checkout",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Change the organization's seats

`POST /v1/billing/seats`

Access `session`: a console session only; an API key gets 403 `session_required`.

Sets how many seats the organization's Teams subscription holds, from 3 to 20. A seat is held by every active member and every open invitation. More seats are charged at once, for what is left of the paid month, and count from the provider's answer; a card that cannot be charged answers 402 `payment_failed` and changes nothing. Fewer seats take effect when the paid month ends, with nothing paid back, and never fewer than are held (409 `seats_in_use`). The number is the whole count, so asking twice for the same number is charged once. One change is made at a time (409 `seat_change_pending`). An account without an active Teams subscription answers 409 `no_subscription`.

OAuth: not available to delegated app tokens.

Also available as [`client.billing.seats`](https://doorman.fyi/docs/sdk/reference/account.md#billing-seats) in TypeScript and [`client.billing.seats`](https://doorman.fyi/docs/python/reference/account.md#billing-seats) in Python.

Organizations: a member's console session needs `billing:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Request body (application/json): SetSeats**
The number of seats the organization's Teams subscription should hold: the whole count, not a difference.
- `seats` (integer)

Answers `200`: The plan and the subscription as they are now, with the seats.

**Response 200: BillingSynced**
The account's plan and billing after they were read again from the payment provider.
- `plan` ("free" | "pro" | "enterprise")
- `billing` (BillingSummary)

Example 200 response:
```json
{
  "plan": "pro",
  "billing": {
    "subscription": {
      "status": "active",
      "cancelAtPeriodEnd": false,
      "currentPeriodEnd": "2026-12-05T10:05:00.000Z"
    }
  }
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 400 | `validation_error` | A field is missing or invalid; the message names it. |
| 400 | `invalid_json` | The request body is not JSON. |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 402 | `payment_failed` | The payment provider could not charge for the change, so nothing was changed. The card on file can be replaced in the billing portal. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `no_subscription` | The account has never paid through the payment provider, so there is no billing to manage; or, where seats are changed, it has no Teams subscription that is active. |
| 409 | `seats_in_use` | The organization holds more seats than the number asked for: `used` says how many. Remove a member or take an invitation back first. |
| 409 | `seat_change_pending` | Another change to the organization's seats is still being made at the payment provider. Try again in a moment. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |
| 502 | `provider_unavailable` | The mail transport, the DNS setup provider or the payment provider did not answer, or refused this deployment's credentials. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/billing/seats" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "seats": 4
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/billing/seats", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "seats": 4
  }),
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.post(
    "https://api.doorman.fyi/v1/billing/seats",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "seats": 4,
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Open the billing portal

`POST /v1/billing/portal`

Access `session`: a console session only; an API key gets 403 `session_required`.

A page at the payment provider where the person changes the card, reads invoices and cancels. An account that never paid there answers 409 `no_subscription`.

OAuth: not available to delegated app tokens.

Also available as [`client.billing.portal`](https://doorman.fyi/docs/sdk/reference/account.md#billing-portal) in TypeScript and [`client.billing.portal`](https://doorman.fyi/docs/python/reference/account.md#billing-portal) in Python.

Organizations: a member's console session needs `billing:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

Answers `200`: The billing portal.

**Response 200: BillingRedirect**
A page at the payment provider to send the person's browser to. It is for this account only and expires.
- `url` (string)

Example 200 response:
```json
{
  "url": "https://payments.example/checkout/c_123"
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `no_subscription` | The account has never paid through the payment provider, so there is no billing to manage; or, where seats are changed, it has no Teams subscription that is active. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |
| 502 | `provider_unavailable` | The mail transport, the DNS setup provider or the payment provider did not answer, or refused this deployment's credentials. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/billing/portal" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/billing/portal", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.post(
    "https://api.doorman.fyi/v1/billing/portal",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Read billing again

`POST /v1/billing/sync`

Access `session`: a console session only; an API key gets 403 `session_required`.

Reads the account's subscription from the payment provider and applies it, as the provider's own event would. The console calls it when a person comes back from the checkout, so the plan shows without waiting for the event.

OAuth: not available to delegated app tokens.

Also available as [`client.billing.sync`](https://doorman.fyi/docs/sdk/reference/account.md#billing-sync) in TypeScript and [`client.billing.sync`](https://doorman.fyi/docs/python/reference/account.md#billing-sync) in Python.

Organizations: a member's console session needs `billing:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

Answers `200`: The plan and the subscription as they are now.

**Response 200: BillingSynced**
The account's plan and billing after they were read again from the payment provider.
- `plan` ("free" | "pro" | "enterprise")
- `billing` (BillingSummary)

Example 200 response:
```json
{
  "plan": "pro",
  "billing": {
    "subscription": {
      "status": "active",
      "cancelAtPeriodEnd": false,
      "currentPeriodEnd": "2026-12-05T10:05:00.000Z"
    }
  }
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |
| 502 | `provider_unavailable` | The mail transport, the DNS setup provider or the payment provider did not answer, or refused this deployment's credentials. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/billing/sync" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/billing/sync", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.post(
    "https://api.doorman.fyi/v1/billing/sync",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Read notification settings

`GET /v1/push`

Access `session`: a console session only; an API key gets 403 `session_required`.

Whether this deployment can send notifications, the key a browser subscribes with, and the browsers and devices the account has notifications on for. A subscription's address is never answered.

OAuth: not available to delegated app tokens.

Also available as [`client.push.get`](https://doorman.fyi/docs/sdk/reference/account.md#push-get) in TypeScript and [`client.push.get`](https://doorman.fyi/docs/python/reference/account.md#push-get) in Python.

Organizations: every member's console session may call it. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

Answers `200`: The settings and the subscriptions.

**Response 200: PushSettings**
Whether this deployment can send notifications, the key a browser subscribes with, and the account's subscriptions, oldest first.
- `available` (boolean): Whether this deployment has notifications configured. Where it has not, there is no key and nothing can be subscribed.
- `publicKey` (string | null): The application server key a browser subscribes with: an uncompressed P-256 point in base64url. Null where notifications are not configured. Example: `BAa0PjquH4AsQaDVl7stumrfQkF25D5eq5cDI3vLILFFIArx2o3ucteiAy6y5sH5jGLSsn6xjD5aRv4LFNVU9TM`
- `subscriptions` (PushSubscription[]): At most 10.

Example 200 response:
```json
{
  "available": true,
  "publicKey": "BAa0PjquH4AsQaDVl7stumrfQkF25D5eq5cDI3vLILFFIArx2o3ucteiAy6y5sH5jGLSsn6xjD5aRv4LFNVU9TM",
  "subscriptions": [
    {
      "id": "psh_01jc5f1a2b3c4d5e6f7g8h9j0k",
      "createdAt": "2026-11-05T10:05:00.000Z",
      "lastDeliveredAt": null
    }
  ]
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s "https://api.doorman.fyi/v1/push" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/push", {
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.get(
    "https://api.doorman.fyi/v1/push",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Switch notifications on for a browser

`POST /v1/push/subscriptions`

Access `session`: a console session only; an API key gets 403 `session_required`.

Records the address a browser was given when the owner allowed notifications there. From then on the account is notified there when mail is held for review, a service in its passport needs a look, or a sign-in waits to be allowed: at most once every 15 minutes and 20 times a day, and with no payload, so a notification says that something waits and never what. An address the account already has answers 200 with that subscription. An account has at most 10.

OAuth: not available to delegated app tokens.

Also available as [`client.push.subscriptions.create`](https://doorman.fyi/docs/sdk/reference/account.md#push-subscriptions-create) in TypeScript and [`client.push.subscriptions.create`](https://doorman.fyi/docs/python/reference/account.md#push-subscriptions-create) in Python.

Organizations: a member's console session needs `mail:read`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Request body (application/json): CreatePushSubscription**
The address a browser was given when the owner allowed notifications there.
- `endpoint` (string): The subscription's endpoint, as the browser gave it: an https address at a push service (fcm.googleapis.com, push.services.mozilla.com, push.apple.com, notify.windows.com, or a name under one of them). An address anywhere else is refused. Example: `https://fcm.googleapis.com/fcm/send/dQw4w9WgXcQ:APA91bHexample`

Answers `201`: The new subscription.

**Response 201: PushSubscription**
One browser on one device that the owner switched notifications on for. The address notifications are sent to is never answered.
- `id` (string): A push subscription's identifier. Example: `psh_01jc5f1a2b3c4d5e6f7g8h9j0k`
- `createdAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `lastDeliveredAt` (string (date-time) | null): When a push service last accepted a notification for it; null until the first.

Example 201 response:
```json
{
  "id": "psh_01jc5f1a2b3c4d5e6f7g8h9j0k",
  "createdAt": "2026-11-05T10:05:00.000Z",
  "lastDeliveredAt": null
}
```

Answers `200`: The subscription the account already had for this address.

**Response 200: PushSubscription**
One browser on one device that the owner switched notifications on for. The address notifications are sent to is never answered.
- `id` (string): A push subscription's identifier. Example: `psh_01jc5f1a2b3c4d5e6f7g8h9j0k`
- `createdAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `lastDeliveredAt` (string (date-time) | null): When a push service last accepted a notification for it; null until the first.

Example 200 response:
```json
{
  "id": "psh_01jc5f1a2b3c4d5e6f7g8h9j0k",
  "createdAt": "2026-11-05T10:05:00.000Z",
  "lastDeliveredAt": null
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 400 | `validation_error` | A field is missing or invalid; the message names it. |
| 400 | `invalid_json` | The request body is not JSON. |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 409 | `limit_reached` | The abuse ceiling for inboxes, custom domains, keys, endpoints, services, relying parties, the services an address signs in to, the sends an inbox has waiting for its owner or the invitations an organization has open; delete, revoke or decide one first. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |
| 503 | `push_unavailable` | Notifications are not configured for this deployment. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/push/subscriptions" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "endpoint": "https://fcm.googleapis.com/fcm/send/dQw4w9WgXcQ:APA91bHexample"
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/push/subscriptions", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "endpoint": "https://fcm.googleapis.com/fcm/send/dQw4w9WgXcQ:APA91bHexample"
  }),
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.post(
    "https://api.doorman.fyi/v1/push/subscriptions",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "endpoint": "https://fcm.googleapis.com/fcm/send/dQw4w9WgXcQ:APA91bHexample",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Switch notifications off for a browser

`DELETE /v1/push/subscriptions/{subscriptionId}`

Access `session`: a console session only; an API key gets 403 `session_required`.

Forgets the subscription, so nothing more is sent there. The browser's own permission is the browser's to take back.

OAuth: not available to delegated app tokens.

Also available as [`client.push.subscriptions.delete`](https://doorman.fyi/docs/sdk/reference/account.md#push-subscriptions-delete) in TypeScript and [`client.push.subscriptions.delete`](https://doorman.fyi/docs/python/reference/account.md#push-subscriptions-delete) in Python.

Organizations: a member's console session needs `mail:read`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `subscriptionId` | path | `string` | yes | The subscription. Example: `psh_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

Answers `204`: Forgotten.

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s -X DELETE "https://api.doorman.fyi/v1/push/subscriptions/psh_01jc5f1a2b3c4d5e6f7g8h9j0k" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/push/subscriptions/psh_01jc5f1a2b3c4d5e6f7g8h9j0k", {
  method: "DELETE",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
// 204: nothing to read.
```

Python:
```python
import os
import requests

response = requests.delete(
    "https://api.doorman.fyi/v1/push/subscriptions/psh_01jc5f1a2b3c4d5e6f7g8h9j0k",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
# 204: nothing to read.
```

## List the organization's members

`GET /v1/members`

Access `session`: a console session only; an API key gets 403 `session_required`.

Everyone who has worked in the organization, with the role the API keeps for each of them and where they stand. Every member may read it: a team knows who is on it. A personal account has no members, and the list is empty.

OAuth: not available to delegated app tokens.

Also available as [`client.members.list`](https://doorman.fyi/docs/sdk/reference/account.md#members-list) in TypeScript and [`client.members.list`](https://doorman.fyi/docs/python/reference/account.md#members-list) in Python.

Organizations: every member's console session may call it. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

Answers `200`: The members, in the order they joined.

**Response 200: MemberList**
The organization's people, in the order they joined. Empty for a personal account.
- `data` (Member[])

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s "https://api.doorman.fyi/v1/members" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/members", {
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.get(
    "https://api.doorman.fyi/v1/members",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Change a member's role

`PATCH /v1/members/{userId}`

Access `session`: a console session only; an API key gets 403 `session_required`.

Gives the member another role, which holds from their next request. Only an owner may make someone an owner or change an owner's role (403 `owner_required`), and an organization keeps at least one active owner: the last one cannot be given another role (409 `last_owner`). A role the member already has changes nothing.

OAuth: not available to delegated app tokens.

Also available as [`client.members.update`](https://doorman.fyi/docs/sdk/reference/account.md#members-update) in TypeScript and [`client.members.update`](https://doorman.fyi/docs/python/reference/account.md#members-update) in Python.

Organizations: a member's console session needs `members:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `userId` | path | `string` | yes | The member, by the identity provider's id of the person. Example: `user_2abcDEF3ghiJKL`. |

**Request body (application/json): UpdateMember**
A member's new role.
- `role` ("owner" | "admin" | "member" | "viewer"): The new role: `owner` and `admin` may do everything, `member` reads, changes and sends mail, `viewer` reads it. Only an owner may make someone an owner or change an owner's role.

Answers `200`: The member with the new role.

**Response 200: Member**
One person in an organization, with the role the API keeps for them.
- `userId` (string): The identity provider's id of a person. Example: `user_2abcDEF3ghiJKL`
- `email` (string (email)): The person's verified address, as their last session carried it. Example: `sam@example.com`
- `name` (string): The person's name as their last session carried it; empty when it carried none. Example: `Dana Ortiz`
- `role` ("owner" | "admin" | "member" | "viewer"): What the person may do: `owner` and `admin` may do everything, `member` reads, changes and sends mail, `viewer` reads it.
- `status` ("active" | "deactivated" | "removed"): `active`, `deactivated` for a member who is refused until an admin lets them in again, or `removed` for one who has left.
- `joinedAt` (string (date-time)): When the person first worked in the organization. Example: `2026-11-05T10:05:00.000Z`
- `lastSeenAt` (string (date-time) | null): About when the person last worked in the organization; null when never.
- `invitedBy` (string | null): Who invited the person, when an invitation brought them in; null otherwise.
- `isSelf` (boolean): True for the signed-in person's own entry.

Example 200 response:
```json
{
  "userId": "user_2abcDEF3ghiJKL",
  "email": "dana@example.com",
  "name": "Dana Ortiz",
  "role": "owner",
  "status": "active",
  "joinedAt": "2026-11-05T10:05:00.000Z",
  "lastSeenAt": "2026-11-05T10:05:00.000Z",
  "invitedBy": null,
  "isSelf": true
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 400 | `validation_error` | A field is missing or invalid; the message names it. |
| 400 | `invalid_json` | The request body is not JSON. |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `owner_required` | Only an owner of the organization may make someone an owner, invite an owner or change an owner's role. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `last_owner` | The member is the organization's only active owner. Make someone else an owner first. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s -X PATCH "https://api.doorman.fyi/v1/members/user_2abcDEF3ghiJKL" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "role": "admin"
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/members/user_2abcDEF3ghiJKL", {
  method: "PATCH",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "role": "admin"
  }),
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.patch(
    "https://api.doorman.fyi/v1/members/user_2abcDEF3ghiJKL",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "role": "admin",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## List the organization's invitations

`GET /v1/invitations`

Access `session`: a console session only; an API key gets 403 `session_required`.

The invitations the organization sent, open and settled, newest first. An invitation nobody answered in time is listed as `expired`. Empty for a personal account.

OAuth: not available to delegated app tokens.

Also available as [`client.invitations.list`](https://doorman.fyi/docs/sdk/reference/account.md#invitations-list) in TypeScript and [`client.invitations.list`](https://doorman.fyi/docs/python/reference/account.md#invitations-list) in Python.

Organizations: a member's console session needs `members:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

Answers `200`: The invitations.

**Response 200: InvitationList**
The organization's invitations, newest first. Empty for a personal account.
- `data` (Invitation[])

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s "https://api.doorman.fyi/v1/invitations" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/invitations", {
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.get(
    "https://api.doorman.fyi/v1/invitations",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Invite someone to the organization

`POST /v1/invitations`

Access `session`: a console session only; an API key gets 403 `session_required`.

Records an invitation and the role it grants. Nothing is sent by this call: the console's server then has the identity provider send the email, and records which invitation that was. The invitation stays open for 30 days. The person takes the role when their first session in the organization arrives with the invited address. An address that already belongs to a member answers 409 `already_member`, and one that already has an open invitation 409 `already_invited`. Only an owner may invite an owner (403 `owner_required`). An organization has at most 50 open invitations. A personal account cannot invite (403 `organization_required`). Where the deployment sells the Teams plan, an open invitation holds a seat: an organization with no seat free answers 402 `seat_required`, and so does one that has not started the plan.

OAuth: not available to delegated app tokens.

Also available as [`client.invitations.create`](https://doorman.fyi/docs/sdk/reference/account.md#invitations-create) in TypeScript and [`client.invitations.create`](https://doorman.fyi/docs/python/reference/account.md#invitations-create) in Python.

Organizations: a member's console session needs `members:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Request body (application/json): CreateInvitation**
Who to invite, and as what.
- `email` (string (email)): The address to invite. It is stored in lowercase. Example: `sam@example.com`
- `role` ("owner" | "admin" | "member" | "viewer", optional): The role the person takes when they come in: `owner` and `admin` may do everything, `member` reads, changes and sends mail, `viewer` reads it. Only an owner may invite an owner. Defaults to `member`.

Answers `201`: The invitation, still to be sent.

**Response 201: Invitation**
What an invitation to the organization is meant to grant. The identity provider sends the email; the person takes the role when they first sign in to the organization.
- `id` (string): An invitation's identifier. Example: `inv_01jc5f1a2b3c4d5e6f7g8h9j0k`
- `email` (string (email)): The invited address. Example: `sam@example.com`
- `role` ("owner" | "admin" | "member" | "viewer"): The role the person takes when they come in.
- `status` ("pending" | "accepted" | "revoked" | "expired")
- `invitedBy` (object): Who sent it.
  - `userId` (string): The identity provider's id of a person. Example: `user_2abcDEF3ghiJKL`
  - `name` (string): The inviter's name at the time. Example: `Dana Ortiz`
- `providerInvitationId` (string | null): The identity provider's id of the invitation, once the console has had it sent; null until then.
- `createdAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `expiresAt` (string (date-time)): When it stops being open: 30 days after it was made or last sent again. Example: `2026-11-05T10:05:00.000Z`
- `acceptedAt` (string (date-time) | null): When the person came in; null until then.

Example 201 response:
```json
{
  "id": "inv_01jc5f1a2b3c4d5e6f7g8h9j0k",
  "email": "sam@example.com",
  "role": "member",
  "status": "pending",
  "invitedBy": {
    "userId": "user_2abcDEF3ghiJKL",
    "name": "Dana Ortiz"
  },
  "providerInvitationId": null,
  "createdAt": "2026-11-05T10:05:00.000Z",
  "expiresAt": "2026-12-05T10:05:00.000Z",
  "acceptedAt": null
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 400 | `validation_error` | A field is missing or invalid; the message names it. |
| 400 | `invalid_json` | The request body is not JSON. |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 402 | `seat_required` | The organization has no seat free for another person. `seats` is how many its subscription pays for, or null when it has no Teams subscription yet; `used` is how many are held by members and open invitations; `seatPriceUsd` is what one more costs a month. Someone who may manage billing can start the Teams plan or add a seat. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `organization_required` | The operation acts on an organization, and the session is in a personal account. Switch to the organization first. |
| 403 | `owner_required` | Only an owner of the organization may make someone an owner, invite an owner or change an owner's role. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 409 | `already_member` | The invited address already belongs to a member of the organization. |
| 409 | `already_invited` | The address already has an open invitation to the organization. Take it back first, or send it again. |
| 409 | `limit_reached` | The abuse ceiling for inboxes, custom domains, keys, endpoints, services, relying parties, the services an address signs in to, the sends an inbox has waiting for its owner or the invitations an organization has open; delete, revoke or decide one first. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/invitations" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "email": "sam@example.com",
    "role": "member"
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/invitations", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "email": "sam@example.com",
    "role": "member"
  }),
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.post(
    "https://api.doorman.fyi/v1/invitations",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "email": "sam@example.com",
        "role": "member",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Record that an invitation was sent

`PATCH /v1/invitations/{invitationId}`

Access `session`: a console session only; an API key gets 403 `session_required`.

Records the identity provider's invitation that was sent for this one. The console's server calls it after the provider accepted the invitation, and again with the new one after sending it again, which keeps the invitation open for another 30 days. Only an open invitation can be changed.

OAuth: not available to delegated app tokens.

Also available as [`client.invitations.update`](https://doorman.fyi/docs/sdk/reference/account.md#invitations-update) in TypeScript and [`client.invitations.update`](https://doorman.fyi/docs/python/reference/account.md#invitations-update) in Python.

Organizations: a member's console session needs `members:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `invitationId` | path | `string` | yes | The invitation. Example: `inv_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

**Request body (application/json): UpdateInvitation**
The identity provider's invitation that was sent for this one. Recording a different one than before means the invitation was sent again, and it stays open that much longer.
- `providerInvitationId` (string): The identity provider's id of the invitation it sent. Example: `orginv_2abcDEF3ghiJKL`

Answers `200`: The invitation.

**Response 200: Invitation**
What an invitation to the organization is meant to grant. The identity provider sends the email; the person takes the role when they first sign in to the organization.
- `id` (string): An invitation's identifier. Example: `inv_01jc5f1a2b3c4d5e6f7g8h9j0k`
- `email` (string (email)): The invited address. Example: `sam@example.com`
- `role` ("owner" | "admin" | "member" | "viewer"): The role the person takes when they come in.
- `status` ("pending" | "accepted" | "revoked" | "expired")
- `invitedBy` (object): Who sent it.
  - `userId` (string): The identity provider's id of a person. Example: `user_2abcDEF3ghiJKL`
  - `name` (string): The inviter's name at the time. Example: `Dana Ortiz`
- `providerInvitationId` (string | null): The identity provider's id of the invitation, once the console has had it sent; null until then.
- `createdAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `expiresAt` (string (date-time)): When it stops being open: 30 days after it was made or last sent again. Example: `2026-11-05T10:05:00.000Z`
- `acceptedAt` (string (date-time) | null): When the person came in; null until then.

Example 200 response:
```json
{
  "id": "inv_01jc5f1a2b3c4d5e6f7g8h9j0k",
  "email": "sam@example.com",
  "role": "member",
  "status": "pending",
  "invitedBy": {
    "userId": "user_2abcDEF3ghiJKL",
    "name": "Dana Ortiz"
  },
  "providerInvitationId": null,
  "createdAt": "2026-11-05T10:05:00.000Z",
  "expiresAt": "2026-12-05T10:05:00.000Z",
  "acceptedAt": null
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 400 | `validation_error` | A field is missing or invalid; the message names it. |
| 400 | `invalid_json` | The request body is not JSON. |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s -X PATCH "https://api.doorman.fyi/v1/invitations/inv_01jc5f1a2b3c4d5e6f7g8h9j0k" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "providerInvitationId": "orginv_2abcDEF3ghiJKL"
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/invitations/inv_01jc5f1a2b3c4d5e6f7g8h9j0k", {
  method: "PATCH",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "providerInvitationId": "orginv_2abcDEF3ghiJKL"
  }),
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();
```

Python:
```python
import os
import requests

response = requests.patch(
    "https://api.doorman.fyi/v1/invitations/inv_01jc5f1a2b3c4d5e6f7g8h9j0k",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "providerInvitationId": "orginv_2abcDEF3ghiJKL",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Take an invitation back

`DELETE /v1/invitations/{invitationId}`

Access `session`: a console session only; an API key gets 403 `session_required`.

Revokes an open invitation, so that the role it would have granted is granted to nobody. The console's server revokes it at the identity provider first. An invitation that was accepted, revoked or has expired answers 404.

OAuth: not available to delegated app tokens.

Also available as [`client.invitations.revoke`](https://doorman.fyi/docs/sdk/reference/account.md#invitations-revoke) in TypeScript and [`client.invitations.revoke`](https://doorman.fyi/docs/python/reference/account.md#invitations-revoke) in Python.

Organizations: a member's console session needs `members:manage`. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `invitationId` | path | `string` | yes | The invitation. Example: `inv_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

Answers `204`: Revoked.

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | `session_invalid` | The console session token could not be verified. |
| 401 | `session_expired` | The console session token has expired. |
| 401 | `session_claims_missing` | The session token does not carry a verified email address. |
| 403 | `session_required` | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `account_deleted` | The account was deleted. |
| 403 | `permission_denied` | The signed-in member's role in the organization lacks a permission the operation needs; `permission` names it. An admin of the organization can do it, or change the member's role. |
| 403 | `member_deactivated` | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 409 | `account_mismatch` | The request named another account in `x-doorman-account` than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s -X DELETE "https://api.doorman.fyi/v1/invitations/inv_01jc5f1a2b3c4d5e6f7g8h9j0k" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/invitations/inv_01jc5f1a2b3c4d5e6f7g8h9j0k", {
  method: "DELETE",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
  },
  redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
// 204: nothing to read.
```

Python:
```python
import os
import requests

response = requests.delete(
    "https://api.doorman.fyi/v1/invitations/inv_01jc5f1a2b3c4d5e6f7g8h9j0k",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
# 204: nothing to read.
```
