---
title: "Security"
description: "Risk assessment and sender trust: the policy that warns, holds and guards sending, the senders an inbox knows, held mail and the audit log."
url: https://doorman.fyi/docs/reference/security
markdown: https://doorman.fyi/docs/reference/security.md
area: "API reference"
section: "API reference"
---

# Security

Risk assessment and sender trust: the policy that warns, holds and guards sending, the senders an inbox knows, held mail and the audit log.

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

## Read the security policy

`GET /v1/security`

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

The account's policy: the thresholds on the risk score (low from 0, medium from 30, high from 60, critical from 85) at which mail is warned about or held, the guards on sending, and what this deployment does with it. An account that never chose starts on `balanced`.

OAuth: not available to delegated app tokens.

Also available as [`client.security.get`](https://doorman.fyi/docs/sdk/reference/security.md#security-get) in TypeScript, [`client.security.get`](https://doorman.fyi/docs/python/reference/security.md#security-get) in Python, the [`security_get`](https://doorman.fyi/docs/mcp/tools/security.md#security-get) tool and [`doorman security get`](https://doorman.fyi/docs/cli/commands/security.md#security-get) 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 settings.

**Response 200: SecuritySettings**
A policy as it applies to the account or to one inbox, with what this deployment does with it.
- `scope` ("account" | "inbox")
- `inboxId` (string | null): The inbox the settings are for; null for the account's.
- `inherited` (boolean): Inbox scope: true while the inbox has no policy of its own and follows the account's. Always false for the account.
- `policy` (SecurityPolicy)
- `enforcement` ("off" | "observe" | "enforce"): What the deployment does: `enforce` applies the policy; `observe` assesses mail and records the result without warning, holding or blocking anything; `off` does not assess.
- `modelAnalysisAvailable` (boolean): Whether this deployment has a model to read content with. When false, `modelAnalysis` has no effect.
- `deepScanAvailable` (boolean, optional): Whether this deployment runs the malware engine and the link sandbox. When false, `deepScan` and `linkSandbox` have no effect. Older deployments omit it.
- `updatedAt` (string (date-time) | null): When the policy was last changed; null while it is the default.

Example 200 response:
```json
{
  "scope": "account",
  "inboxId": null,
  "inherited": false,
  "policy": {
    "level": "balanced",
    "warnAt": 60,
    "holdAt": 85,
    "holdUnauthenticatedNewSenders": false,
    "replyGuard": true,
    "recipients": "any",
    "unscannable": "warn",
    "labels": {},
    "modelAnalysis": true,
    "sendApproval": "apps",
    "allowKeyManagement": false,
    "deepScan": true,
    "linkSandbox": true
  },
  "enforcement": "enforce",
  "modelAnalysisAvailable": true,
  "deepScanAvailable": true,
  "updatedAt": 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 | `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/security" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/security", {
  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/security",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Change the security policy

`PATCH /v1/security`

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

Applies a preset with `level`, or changes single values; fields left out stay as they are. Every inbox without a policy of its own follows the account's. A change that loosens protection needs a console session unless the account allows its account keys to (403 `session_required`); a change that tightens it does not. `allowKeyManagement` can only be switched on from a console session. Recorded in the audit log.

OAuth: not available to delegated app tokens.

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

Organizations: a member's console session needs `security:manage`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Request body (application/json): UpdateSecurityPolicy**
Changes to a policy. `level` applies a preset first; any other field given with it, or alone, then replaces that one value. Fields left out stay as they are. Loosening protection needs a console session unless the account allows its account keys to.
- `level` ("relaxed" | "balanced" | "strict", optional): Apply this preset's thresholds and guards. It also clears the per-label rules, unless `labels` is given with it.
- `warnAt` (integer | null, optional): Mail scoring at least this is delivered with a warning and is never answered automatically. Null means never. Example: `60`
- `holdAt` (integer | null, optional): Mail scoring at least this is held for the owner and kept from agents. Null means never. Not below `warnAt`. Example: `85`
- `labels` (object of "warn" | "hold", optional): The least that happens to mail carrying a label, whatever its score: `warn` or `hold`. Replaced as a whole; {} clears it. Example: `{"prompt_injection":"hold"}`
- `holdUnauthenticatedNewSenders` (boolean, optional): Hold mail from a sender the inbox has never dealt with when it does not authenticate as its domain.
- `modelAnalysis` (boolean, optional): Let a model read the content of mail the signals leave undecided. The text goes to the deployment's AI gateway, is not kept and is never used for training. Off: assessments rest on the deterministic signals alone.
- `replyGuard` (boolean, optional): Refuse an agent's reply into a thread that holds a flagged message: one this policy warns about or holds, by its score or a label, or one the owner marked unsafe (403 `risk_blocked`). A message stops counting once the owner marks it safe, or while its sender is trusted and it passed authentication. A console session is never refused.
- `recipients` ("any" | "known", optional): `known`: an agent may write only to senders the inbox trusts or knows, and to the account's own inboxes (403 `risk_blocked` otherwise). Having written to the inbox, or being named in a message, does not make a recipient known: answering a stranger takes a person, or trusting them first. `any`: no such limit. A console session is never refused.
- `sendApproval` ("off" | "apps" | "all", optional): Whose sends wait for the owner when a recipient is not one the inbox knows or trusts, nor one of the account's own inboxes. `apps`: a connected app's. `all`: an app's and an API key's. `off`: nobody's. A send that waits answers 202 with a held send, which the owner sends or discards; it expires unsent after 7 days. A console session is never held, and neither is mail an inbox rule generates. It applies whatever the deployment's `enforcement`, except `off`, where no record of senders is kept and nothing is held. No preset changes it. An account that never chose starts on `apps`.
- `allowKeyManagement` (boolean, optional): Let account keys loosen protection (trust a sender, raise a threshold, release held mail, approve a held send). Off by default, and only a console session can switch it on. Account scope only.
- `deepScan` (boolean, optional): Run every attachment, in both directions, through the deployment's malware engine. The bytes go to an isolated scanner that keeps nothing. Off: attachments are still checked by their structure. No effect where the deployment has no engine (`deepScanAvailable`).
- `linkSandbox` (boolean, optional): Open the most suspect links of a message in an isolated browser before the message is delivered, to see where they lead. The site a link points at sees a visit. Links that verify an address, sign in, accept an invitation or unsubscribe are never opened, and neither are an authenticated sender's links to its own site. No effect where the deployment has no sandbox.
- `unscannable` ("deliver" | "warn" | "hold", optional): The least that happens to mail carrying something that could not be checked (a locked archive, or a scan that did not finish): `deliver`, `warn` or `hold`.

Answers `200`: The settings as they are now.

**Response 200: SecuritySettings**
A policy as it applies to the account or to one inbox, with what this deployment does with it.
- `scope` ("account" | "inbox")
- `inboxId` (string | null): The inbox the settings are for; null for the account's.
- `inherited` (boolean): Inbox scope: true while the inbox has no policy of its own and follows the account's. Always false for the account.
- `policy` (SecurityPolicy)
- `enforcement` ("off" | "observe" | "enforce"): What the deployment does: `enforce` applies the policy; `observe` assesses mail and records the result without warning, holding or blocking anything; `off` does not assess.
- `modelAnalysisAvailable` (boolean): Whether this deployment has a model to read content with. When false, `modelAnalysis` has no effect.
- `deepScanAvailable` (boolean, optional): Whether this deployment runs the malware engine and the link sandbox. When false, `deepScan` and `linkSandbox` have no effect. Older deployments omit it.
- `updatedAt` (string (date-time) | null): When the policy was last changed; null while it is the default.

Example 200 response:
```json
{
  "scope": "account",
  "inboxId": null,
  "inherited": false,
  "policy": {
    "level": "balanced",
    "warnAt": 60,
    "holdAt": 85,
    "holdUnauthenticatedNewSenders": false,
    "replyGuard": true,
    "recipients": "any",
    "unscannable": "warn",
    "labels": {},
    "modelAnalysis": true,
    "sendApproval": "apps",
    "allowKeyManagement": false,
    "deepScan": true,
    "linkSandbox": true
  },
  "enforcement": "enforce",
  "modelAnalysisAvailable": true,
  "deepScanAvailable": true,
  "updatedAt": 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 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 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 | `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 | `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 -X PATCH "https://api.doorman.fyi/v1/security" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "level": "strict"
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/security", {
  method: "PATCH",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "level": "strict"
  }),
});
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/security",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "level": "strict",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Read an inbox's security policy

`GET /v1/inboxes/{inboxId}/security`

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

The policy in force for one inbox: its own when it has one, the account's otherwise (`inherited` says which).

OAuth: not available to delegated app tokens.

Also available as [`client.inboxes.security.get`](https://doorman.fyi/docs/sdk/reference/security.md#inboxes-security-get) in TypeScript, [`client.inboxes.security.get`](https://doorman.fyi/docs/python/reference/security.md#inboxes-security-get) in Python, the [`inboxes_security_get`](https://doorman.fyi/docs/mcp/tools/security.md#inboxes-security-get) tool and [`doorman inboxes security get`](https://doorman.fyi/docs/cli/commands/security.md#inboxes-security-get) 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 |
| --- | --- | --- | --- | --- |
| `inboxId` | path | `string` | yes | The inbox. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`. |

Answers `200`: The inbox's settings.

**Response 200: SecuritySettings**
A policy as it applies to the account or to one inbox, with what this deployment does with it.
- `scope` ("account" | "inbox")
- `inboxId` (string | null): The inbox the settings are for; null for the account's.
- `inherited` (boolean): Inbox scope: true while the inbox has no policy of its own and follows the account's. Always false for the account.
- `policy` (SecurityPolicy)
- `enforcement` ("off" | "observe" | "enforce"): What the deployment does: `enforce` applies the policy; `observe` assesses mail and records the result without warning, holding or blocking anything; `off` does not assess.
- `modelAnalysisAvailable` (boolean): Whether this deployment has a model to read content with. When false, `modelAnalysis` has no effect.
- `deepScanAvailable` (boolean, optional): Whether this deployment runs the malware engine and the link sandbox. When false, `deepScan` and `linkSandbox` have no effect. Older deployments omit it.
- `updatedAt` (string (date-time) | null): When the policy was last changed; null while it is the default.

Example 200 response:
```json
{
  "scope": "account",
  "inboxId": null,
  "inherited": false,
  "policy": {
    "level": "balanced",
    "warnAt": 60,
    "holdAt": 85,
    "holdUnauthenticatedNewSenders": false,
    "replyGuard": true,
    "recipients": "any",
    "unscannable": "warn",
    "labels": {},
    "modelAnalysis": true,
    "sendApproval": "apps",
    "allowKeyManagement": false,
    "deepScan": true,
    "linkSandbox": true
  },
  "enforcement": "enforce",
  "modelAnalysisAvailable": true,
  "deepScanAvailable": true,
  "updatedAt": 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 | `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. |
| 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/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/security" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/security", {
  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/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/security",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Give an inbox its own security policy

`PATCH /v1/inboxes/{inboxId}/security`

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

Starts from the policy in force for the inbox and applies the change; from then on the inbox no longer follows the account's policy. `allowKeyManagement` is the account's and is refused here. A change that loosens protection needs a console session unless the account allows its account keys to (403 `session_required`); a change that tightens it does not. Recorded in the audit log.

OAuth: not available to delegated app tokens.

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

Organizations: a member's console session needs `security:manage`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `inboxId` | path | `string` | yes | The inbox. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`. |

**Request body (application/json): UpdateSecurityPolicy**
Changes to a policy. `level` applies a preset first; any other field given with it, or alone, then replaces that one value. Fields left out stay as they are. Loosening protection needs a console session unless the account allows its account keys to.
- `level` ("relaxed" | "balanced" | "strict", optional): Apply this preset's thresholds and guards. It also clears the per-label rules, unless `labels` is given with it.
- `warnAt` (integer | null, optional): Mail scoring at least this is delivered with a warning and is never answered automatically. Null means never. Example: `60`
- `holdAt` (integer | null, optional): Mail scoring at least this is held for the owner and kept from agents. Null means never. Not below `warnAt`. Example: `85`
- `labels` (object of "warn" | "hold", optional): The least that happens to mail carrying a label, whatever its score: `warn` or `hold`. Replaced as a whole; {} clears it. Example: `{"prompt_injection":"hold"}`
- `holdUnauthenticatedNewSenders` (boolean, optional): Hold mail from a sender the inbox has never dealt with when it does not authenticate as its domain.
- `modelAnalysis` (boolean, optional): Let a model read the content of mail the signals leave undecided. The text goes to the deployment's AI gateway, is not kept and is never used for training. Off: assessments rest on the deterministic signals alone.
- `replyGuard` (boolean, optional): Refuse an agent's reply into a thread that holds a flagged message: one this policy warns about or holds, by its score or a label, or one the owner marked unsafe (403 `risk_blocked`). A message stops counting once the owner marks it safe, or while its sender is trusted and it passed authentication. A console session is never refused.
- `recipients` ("any" | "known", optional): `known`: an agent may write only to senders the inbox trusts or knows, and to the account's own inboxes (403 `risk_blocked` otherwise). Having written to the inbox, or being named in a message, does not make a recipient known: answering a stranger takes a person, or trusting them first. `any`: no such limit. A console session is never refused.
- `sendApproval` ("off" | "apps" | "all", optional): Whose sends wait for the owner when a recipient is not one the inbox knows or trusts, nor one of the account's own inboxes. `apps`: a connected app's. `all`: an app's and an API key's. `off`: nobody's. A send that waits answers 202 with a held send, which the owner sends or discards; it expires unsent after 7 days. A console session is never held, and neither is mail an inbox rule generates. It applies whatever the deployment's `enforcement`, except `off`, where no record of senders is kept and nothing is held. No preset changes it. An account that never chose starts on `apps`.
- `allowKeyManagement` (boolean, optional): Let account keys loosen protection (trust a sender, raise a threshold, release held mail, approve a held send). Off by default, and only a console session can switch it on. Account scope only.
- `deepScan` (boolean, optional): Run every attachment, in both directions, through the deployment's malware engine. The bytes go to an isolated scanner that keeps nothing. Off: attachments are still checked by their structure. No effect where the deployment has no engine (`deepScanAvailable`).
- `linkSandbox` (boolean, optional): Open the most suspect links of a message in an isolated browser before the message is delivered, to see where they lead. The site a link points at sees a visit. Links that verify an address, sign in, accept an invitation or unsubscribe are never opened, and neither are an authenticated sender's links to its own site. No effect where the deployment has no sandbox.
- `unscannable` ("deliver" | "warn" | "hold", optional): The least that happens to mail carrying something that could not be checked (a locked archive, or a scan that did not finish): `deliver`, `warn` or `hold`.

Answers `200`: The inbox's settings as they are now.

**Response 200: SecuritySettings**
A policy as it applies to the account or to one inbox, with what this deployment does with it.
- `scope` ("account" | "inbox")
- `inboxId` (string | null): The inbox the settings are for; null for the account's.
- `inherited` (boolean): Inbox scope: true while the inbox has no policy of its own and follows the account's. Always false for the account.
- `policy` (SecurityPolicy)
- `enforcement` ("off" | "observe" | "enforce"): What the deployment does: `enforce` applies the policy; `observe` assesses mail and records the result without warning, holding or blocking anything; `off` does not assess.
- `modelAnalysisAvailable` (boolean): Whether this deployment has a model to read content with. When false, `modelAnalysis` has no effect.
- `deepScanAvailable` (boolean, optional): Whether this deployment runs the malware engine and the link sandbox. When false, `deepScan` and `linkSandbox` have no effect. Older deployments omit it.
- `updatedAt` (string (date-time) | null): When the policy was last changed; null while it is the default.

Example 200 response:
```json
{
  "scope": "account",
  "inboxId": null,
  "inherited": false,
  "policy": {
    "level": "balanced",
    "warnAt": 60,
    "holdAt": 85,
    "holdUnauthenticatedNewSenders": false,
    "replyGuard": true,
    "recipients": "any",
    "unscannable": "warn",
    "labels": {},
    "modelAnalysis": true,
    "sendApproval": "apps",
    "allowKeyManagement": false,
    "deepScan": true,
    "linkSandbox": true
  },
  "enforcement": "enforce",
  "modelAnalysisAvailable": true,
  "deepScanAvailable": true,
  "updatedAt": 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 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 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 | `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 | `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/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/security" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "level": "strict"
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/security", {
  method: "PATCH",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "level": "strict"
  }),
});
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/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/security",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "level": "strict",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Return an inbox to the account's security policy

`DELETE /v1/inboxes/{inboxId}/security`

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

Removes the inbox's own policy, so it follows the account's again. A change that loosens protection needs a console session unless the account allows its account keys to (403 `session_required`); a change that tightens it does not. Recorded in the audit log.

OAuth: not available to delegated app tokens.

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

Organizations: a member's console session needs `security:manage`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `inboxId` | path | `string` | yes | The inbox. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`. |

Answers `204`: The inbox follows the account's policy.

**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 | `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 | `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 | `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/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/security" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/security", {
  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/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/security",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
# 204: nothing to read.
```

## List an inbox's senders

`GET /v1/inboxes/{inboxId}/senders`

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

Everyone the inbox has received mail from or written to, most recently heard from first, with what arrived, what the inbox sent them and the standing that follows: `trusted` or `blocked` by a sender rule, `known` once the inbox wrote to them or they sent 3 authenticated messages over 7 days without a flag, `new` otherwise.

OAuth: not available to delegated app tokens.

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

Organizations: a member's console session needs `mail:read`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `inboxId` | path | `string` | yes | The inbox. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`. |
| `standing` | query | `"trusted" \| "known" \| "new" \| "blocked"` | no | Only senders with this standing. |
| `q` | query | `string` | no | Keep the senders whose address or name contains this text, case-insensitively. |
| `limit` | query | `integer` | no | Page size, 1 to 100. Defaults to 50. |
| `offset` | query | `integer` | no | Rows to skip. Defaults to 0. |

Answers `200`: A page of senders.

**Response 200: SenderPage**
A page of an inbox's senders, most recent first.
- `data` (Sender[])
- `limit` (integer): The page size that was applied.
- `offset` (integer): The offset that was applied.
- `total` (integer): How many senders match, across every page.

**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 | `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 | `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 "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/senders" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/senders", {
  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/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/senders",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## List sender rules

`GET /v1/sender-rules`

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

The account's sender rules, newest first: the addresses and domains the owner trusts or blocks, for the whole account or for one inbox.

OAuth: not available to delegated app tokens.

Also available as [`client.senderRules.list`](https://doorman.fyi/docs/sdk/reference/security.md#senderRules-list) in TypeScript, [`client.sender_rules.list`](https://doorman.fyi/docs/python/reference/security.md#senderRules-list) in Python, the [`senderRules_list`](https://doorman.fyi/docs/mcp/tools/security.md#senderRules-list) tool and [`doorman sender-rules list`](https://doorman.fyi/docs/cli/commands/security.md#senderRules-list) 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 |
| --- | --- | --- | --- | --- |
| `inboxId` | query | `string` | no | Only the rules that apply to this inbox alone. Omit for every rule of the account. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`. |
| `standing` | query | `"trusted" \| "blocked"` | no | Only trusted or only blocked. |
| `q` | query | `string` | no | Keep the rules whose address or domain contains this text. |
| `limit` | query | `integer` | no | Page size, 1 to 100. Defaults to 50. |
| `offset` | query | `integer` | no | Rows to skip. Defaults to 0. |

Answers `200`: A page of rules.

**Response 200: SenderRulePage**
A page of sender rules, newest first.
- `data` (SenderRule[])
- `limit` (integer): The page size that was applied.
- `offset` (integer): The offset that was applied.
- `total` (integer): How many rules match, across every page.

**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 | `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. |
| 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/sender-rules" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/sender-rules", {
  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/sender-rules",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Trust or block a sender

`POST /v1/sender-rules`

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

Trusts or blocks an address or a whole domain, for one inbox or the whole account. A rule for the same match in the same scope is replaced. An inbox's own rule wins over the account's, and an address wins over its domain. Trust counts only for mail that authenticates as the sender: a trusted name that fails authentication is treated as an impersonation. Mail from a blocked sender is refused. Trusting needs a console session unless the account allows its account keys to (403 `session_required`); blocking does not. The domain every account's inboxes share cannot be trusted as a whole. An account holds at most 2000 rules. Recorded in the audit log.

OAuth: not available to delegated app tokens.

Also available as [`client.senderRules.create`](https://doorman.fyi/docs/sdk/reference/security.md#senderRules-create) in TypeScript, [`client.sender_rules.create`](https://doorman.fyi/docs/python/reference/security.md#senderRules-create) in Python, the [`senderRules_create`](https://doorman.fyi/docs/mcp/tools/security.md#senderRules-create) tool and [`doorman sender-rules create`](https://doorman.fyi/docs/cli/commands/security.md#senderRules-create) on the command line.

Organizations: a member's console session needs `security:manage`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Request body (application/json): CreateSenderRule**
The owner's word on a sender: an address or a whole domain, trusted or blocked, for one inbox or the whole account. A rule for the same match in the same scope is replaced.
- `match` (string): An address (`sam@example.com`) or a domain (`example.com`, which covers every address at it, not its subdomains). Example: `sam@example.com`
- `standing` ("trusted" | "blocked"): `trusted`: their authenticated mail is treated as low risk and replies to them are never guarded. `blocked`: their mail is refused. Trusting needs a console session unless the account allows its account keys to.
- `inboxId` (string, optional): Apply to this inbox only. Omit for every inbox of the account. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`
- `note` (string, optional): A label for whoever reads the list later, at most 200 characters.

Answers `201`: The rule.

**Response 201: SenderRule**
A sender rule: who it matches, what it says, and where it applies.
- `id` (string): A sender rule identifier. Example: `snr_01jc5f1a2b3c4d5e6f7g8h9j0k`
- `kind` ("address" | "domain")
- `match` (string) Example: `sam@example.com`
- `standing` ("trusted" | "blocked")
- `inboxId` (string | null): The inbox the rule applies to; null for the whole account.
- `note` (string | null)
- `createdAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `updatedAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`

Example 201 response:
```json
{
  "id": "snr_01jc5f1a2b3c4d5e6f7g8h9j0k",
  "kind": "address",
  "match": "sam@example.com",
  "standing": "trusted",
  "inboxId": null,
  "note": null,
  "createdAt": "2026-11-05T10:05:00.000Z",
  "updatedAt": "2026-11-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. |
| 403 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 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 | `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 | `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 | `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/sender-rules" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "match": "sam@example.com",
    "standing": "trusted"
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/sender-rules", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "match": "sam@example.com",
    "standing": "trusted"
  }),
});
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/sender-rules",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "match": "sam@example.com",
        "standing": "trusted",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Remove a sender rule

`DELETE /v1/sender-rules/{senderRuleId}`

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

The sender goes back to the standing they earned. Removing a block needs a console session unless the account allows its account keys to (403 `session_required`); removing trust does not. Recorded in the audit log.

OAuth: not available to delegated app tokens.

Also available as [`client.senderRules.delete`](https://doorman.fyi/docs/sdk/reference/security.md#senderRules-delete) in TypeScript, [`client.sender_rules.delete`](https://doorman.fyi/docs/python/reference/security.md#senderRules-delete) in Python, the [`senderRules_delete`](https://doorman.fyi/docs/mcp/tools/security.md#senderRules-delete) tool and [`doorman sender-rules delete`](https://doorman.fyi/docs/cli/commands/security.md#senderRules-delete) on the command line.

Organizations: a member's console session needs `security:manage`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `senderRuleId` | path | `string` | yes | The sender rule. Example: `snr_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

Answers `204`: Removed.

**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 | `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 | `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 | `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/sender-rules/snr_01jc5f1a2b3c4d5e6f7g8h9j0k" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/sender-rules/snr_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/sender-rules/snr_01jc5f1a2b3c4d5e6f7g8h9j0k",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
# 204: nothing to read.
```

## List held messages

`GET /v1/inboxes/{inboxId}/held`

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

The messages held for the owner under the security policy, newest first. Every caller that can read the inbox gets the stub: who sent it, when, and why it is held. The subject is added for a caller that may review held mail; the body and the attachments are never here. A held message is in no thread and in no other list until it is released.

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

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

Organizations: a member's console session needs `mail:read`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `inboxId` | path | `string` | yes | The inbox. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`. |
| `limit` | query | `integer` | no | Page size, 1 to 100. Defaults to 50. |
| `offset` | query | `integer` | no | Rows to skip. Defaults to 0. |

Answers `200`: A page of held messages.

**Response 200: HeldMessagePage**
A page of an inbox's held messages, newest first.
- `data` (HeldMessage[])
- `limit` (integer): The page size that was applied.
- `offset` (integer): The offset that was applied.
- `total` (integer): How many messages are held, across every page.

**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 | `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 "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/held" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/held", {
  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/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/held",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Release a held message

`POST /v1/messages/{messageId}/release`

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

Delivers a held message: it is threaded as if it had just arrived and `message.received` fires, with `risk.action` `released`. Agents can read it from then on, so releasing needs a console session unless the account allows its account keys to (403 `session_required`). It stays flagged: the reply guard applies to its thread until the message is marked safe or its sender is trusted. A message that is not held answers 404. Recorded in the audit log.

OAuth: not available to delegated app tokens.

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

Organizations: a member's console session needs `security:manage` and `mail:read`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `messageId` | path | `string` | yes | The message. Example: `msg_01jc5a6g7h8j9k0m1n2p3q4r5s`. |

Answers `200`: The message, now delivered.

**Response 200: Message**
One message, inbound or outbound, with its text, headers, classification and attachments.
- `id` (string): A message identifier. Example: `msg_01jc5a6g7h8j9k0m1n2p3q4r5s`
- `inboxId` (string): An inbox identifier. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`
- `threadId` (string): A thread identifier. Example: `thr_01jc5a1b2c3d4e5f6g7h8j9k0m`
- `direction` ("inbound" | "outbound")
- `rfcMessageId` (string | null): The Message-ID header of inbound mail; null for mail this API sent. Example: `<a1b2c3@example.com>`
- `inReplyTo` (string | null): The In-Reply-To header, when the message is a reply.
- `references` (string[]): The References chain, oldest first.
- `from` (NamedAddress)
- `to` (NamedAddress[])
- `cc` (NamedAddress[])
- `bcc` (NamedAddress[]): Only outbound mail carries blind copies.
- `replyTo` (string | null): The Reply-To address, when one was given.
- `deliveryRole` ("to" | "cc" | "bcc" | null): How the inbox received the message: as a to, cc or bcc recipient. Null for outbound mail.
- `subject` (string) Example: `Invoice 2847`
- `text` (string | null): The plain-text body, or text derived from the HTML when there was none.
- `hasHtml` (boolean): Whether an HTML body is stored; read it at /v1/messages/{messageId}/html.
- `rawUrl` (string | null): Where to download the original message/rfc822; null for outbound mail.
- `sizeBytes` (integer)
- `category` ("personal" | "automated" | "marketing" | "bounce" | "spam" | "malicious"): What kind of mail this is; ordinary outbound mail is personal and rule-generated mail is automated.
- `autoReplyable` (boolean): False for anything an agent should not answer on its own.
- `verdict` ("clean" | "unverified" | "suspicious" | null): From the authentication results; null for outbound mail.
- `spamScore` (number | null): How likely the message is junk, from 0 to 1, when it was assessed; null otherwise.
- `authentication` (AuthenticationResults | null)
- `service` (MessageService | null, optional): The outside service the message came from, for the inbox's passport; null for any other mail and for outbound mail. Older deployments omit it.
- `risk` (RiskAssessment | null, optional): Doorman's assessment of an inbound message (ADR-019). Null for outbound mail and for mail that was not assessed. Older deployments omit it.
- `redaction` (Redaction, optional): What the account's healthcare guardrails found in the message (ADR-027), and whether `subject`, `text` and the attachments' `parsedText` carry placeholders in place of it. Absent where no guardrail applies.
- `occurredAt` (string (date-time)): When the message arrived or was sent. Example: `2026-11-05T10:05:00.000Z`
- `attachments` (Attachment[])

Example 200 response:
```json
{
  "id": "msg_01jc5a6g7h8j9k0m1n2p3q4r5s",
  "inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
  "threadId": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
  "direction": "inbound",
  "rfcMessageId": "<a1b2c3@example.com>",
  "inReplyTo": null,
  "references": [],
  "from": {
    "address": "sam@example.com",
    "name": "Sam Rivera"
  },
  "to": [
    {
      "address": "concierge@doorman.example",
      "name": null
    }
  ],
  "cc": [],
  "bcc": [],
  "replyTo": null,
  "deliveryRole": "to",
  "subject": "Invoice 2847",
  "text": "Hi, invoice 2847 is attached.",
  "hasHtml": true,
  "rawUrl": "https://api.doorman.example/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/raw",
  "sizeBytes": 48120,
  "category": "personal",
  "autoReplyable": true,
  "verdict": "clean",
  "spamScore": 0.02,
  "authentication": {
    "spf": "pass",
    "dkim": "pass",
    "dmarc": "pass"
  },
  "risk": {
    "score": 6,
    "level": "low",
    "labels": [],
    "reasons": [],
    "sender": {
      "standing": "known",
      "authenticated": true
    },
    "action": "delivered",
    "analysis": "full",
    "review": null
  },
  "occurredAt": "2026-11-05T10:05:00.000Z",
  "attachments": [
    {
      "filename": "invoice.pdf",
      "contentType": "application/pdf",
      "sizeBytes": 45000,
      "url": "https://api.doorman.example/v1/attachments/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/invoice.pdf",
      "parsedText": "Invoice 2847. Line 3: Setup fee, billed twice. Total 1,480.",
      "extractionMethod": "pdf"
    }
  ]
}
```

**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 | `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 | `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 | `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 POST "https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/release" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/release", {
  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/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/release",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Discard a held message

`POST /v1/messages/{messageId}/discard`

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

Moves a held message to the trash without ever delivering it. Nothing brings it back, and where the deployment erases it is erased 30 days later. A message that is not held answers 404. Recorded in the audit log.

OAuth: not available to delegated app tokens.

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

Organizations: a member's console session needs `security:manage`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `messageId` | path | `string` | yes | The message. Example: `msg_01jc5a6g7h8j9k0m1n2p3q4r5s`. |

Answers `204`: Discarded.

**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 | `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 POST "https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/discard" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/discard", {
  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}.`);
// 204: nothing to read.
```

Python:
```python
import os
import requests

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

## Mark a message safe or unsafe

`POST /v1/messages/{messageId}/feedback`

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

The owner's verdict on a delivered inbound message that was assessed. `safe` lifts the reply guard for it, stops it counting toward its thread's risk level and withdraws the flag it put on its sender; it needs a console session unless the account allows its account keys to (403 `session_required`). `unsafe` flags the sender, which keeps them from being known, stops automatic replies to the message and makes the reply guard apply to its thread. The score stays what Doorman concluded. Recorded in the audit log.

OAuth: not available to delegated app tokens.

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

Organizations: a member's console session needs `security:manage` and `mail:read`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `messageId` | path | `string` | yes | The message. Example: `msg_01jc5a6g7h8j9k0m1n2p3q4r5s`. |

**Request body (application/json): RiskFeedback**
The owner's verdict on a delivered message. `safe` lifts the reply guard for it; `unsafe` flags the sender and stops automatic replies to it.
- `verdict` ("safe" | "unsafe")

Answers `200`: The message with the verdict recorded.

**Response 200: Message**
One message, inbound or outbound, with its text, headers, classification and attachments.
- `id` (string): A message identifier. Example: `msg_01jc5a6g7h8j9k0m1n2p3q4r5s`
- `inboxId` (string): An inbox identifier. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`
- `threadId` (string): A thread identifier. Example: `thr_01jc5a1b2c3d4e5f6g7h8j9k0m`
- `direction` ("inbound" | "outbound")
- `rfcMessageId` (string | null): The Message-ID header of inbound mail; null for mail this API sent. Example: `<a1b2c3@example.com>`
- `inReplyTo` (string | null): The In-Reply-To header, when the message is a reply.
- `references` (string[]): The References chain, oldest first.
- `from` (NamedAddress)
- `to` (NamedAddress[])
- `cc` (NamedAddress[])
- `bcc` (NamedAddress[]): Only outbound mail carries blind copies.
- `replyTo` (string | null): The Reply-To address, when one was given.
- `deliveryRole` ("to" | "cc" | "bcc" | null): How the inbox received the message: as a to, cc or bcc recipient. Null for outbound mail.
- `subject` (string) Example: `Invoice 2847`
- `text` (string | null): The plain-text body, or text derived from the HTML when there was none.
- `hasHtml` (boolean): Whether an HTML body is stored; read it at /v1/messages/{messageId}/html.
- `rawUrl` (string | null): Where to download the original message/rfc822; null for outbound mail.
- `sizeBytes` (integer)
- `category` ("personal" | "automated" | "marketing" | "bounce" | "spam" | "malicious"): What kind of mail this is; ordinary outbound mail is personal and rule-generated mail is automated.
- `autoReplyable` (boolean): False for anything an agent should not answer on its own.
- `verdict` ("clean" | "unverified" | "suspicious" | null): From the authentication results; null for outbound mail.
- `spamScore` (number | null): How likely the message is junk, from 0 to 1, when it was assessed; null otherwise.
- `authentication` (AuthenticationResults | null)
- `service` (MessageService | null, optional): The outside service the message came from, for the inbox's passport; null for any other mail and for outbound mail. Older deployments omit it.
- `risk` (RiskAssessment | null, optional): Doorman's assessment of an inbound message (ADR-019). Null for outbound mail and for mail that was not assessed. Older deployments omit it.
- `redaction` (Redaction, optional): What the account's healthcare guardrails found in the message (ADR-027), and whether `subject`, `text` and the attachments' `parsedText` carry placeholders in place of it. Absent where no guardrail applies.
- `occurredAt` (string (date-time)): When the message arrived or was sent. Example: `2026-11-05T10:05:00.000Z`
- `attachments` (Attachment[])

Example 200 response:
```json
{
  "id": "msg_01jc5a6g7h8j9k0m1n2p3q4r5s",
  "inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
  "threadId": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
  "direction": "inbound",
  "rfcMessageId": "<a1b2c3@example.com>",
  "inReplyTo": null,
  "references": [],
  "from": {
    "address": "sam@example.com",
    "name": "Sam Rivera"
  },
  "to": [
    {
      "address": "concierge@doorman.example",
      "name": null
    }
  ],
  "cc": [],
  "bcc": [],
  "replyTo": null,
  "deliveryRole": "to",
  "subject": "Invoice 2847",
  "text": "Hi, invoice 2847 is attached.",
  "hasHtml": true,
  "rawUrl": "https://api.doorman.example/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/raw",
  "sizeBytes": 48120,
  "category": "personal",
  "autoReplyable": true,
  "verdict": "clean",
  "spamScore": 0.02,
  "authentication": {
    "spf": "pass",
    "dkim": "pass",
    "dmarc": "pass"
  },
  "risk": {
    "score": 6,
    "level": "low",
    "labels": [],
    "reasons": [],
    "sender": {
      "standing": "known",
      "authenticated": true
    },
    "action": "delivered",
    "analysis": "full",
    "review": null
  },
  "occurredAt": "2026-11-05T10:05:00.000Z",
  "attachments": [
    {
      "filename": "invoice.pdf",
      "contentType": "application/pdf",
      "sizeBytes": 45000,
      "url": "https://api.doorman.example/v1/attachments/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/invoice.pdf",
      "parsedText": "Invoice 2847. Line 3: Setup fee, billed twice. Total 1,480.",
      "extractionMethod": "pdf"
    }
  ]
}
```

**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 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 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 | `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 | `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 POST "https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/feedback" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "verdict": "safe"
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/feedback", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "verdict": "safe"
  }),
});
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/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/feedback",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "verdict": "safe",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Read the security audit log

`GET /v1/security/audit`

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

Every change to what protects the account, newest first: policy changes, sender rules, and held mail released, discarded or marked. Entries say who did it and carry no mail content.

OAuth: not available to delegated app tokens.

Also available as [`client.security.audit`](https://doorman.fyi/docs/sdk/reference/security.md#security-audit) in TypeScript, [`client.security.audit`](https://doorman.fyi/docs/python/reference/security.md#security-audit) in Python, the [`security_audit`](https://doorman.fyi/docs/mcp/tools/security.md#security-audit) tool and [`doorman security audit`](https://doorman.fyi/docs/cli/commands/security.md#security-audit) 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 |
| --- | --- | --- | --- | --- |
| `inboxId` | query | `string` | no | Only the entries about this inbox. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`. |
| `limit` | query | `integer` | no | Page size, 1 to 100. Defaults to 50. |
| `offset` | query | `integer` | no | Rows to skip. Defaults to 0. |

Answers `200`: A page of entries.

**Response 200: SecurityAuditPage**
A page of the security audit log, newest first.
- `data` (SecurityAuditEntry[])
- `limit` (integer): The page size that was applied.
- `offset` (integer): The offset that was applied.
- `total` (integer)

**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 | `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. |
| 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/security/audit" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/security/audit", {
  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/security/audit",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Preview what a policy does to a message

`POST /v1/security/preview`

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

Evaluates one message (a stored one, a built-in sample, or text of your own) under the policy in force or a draft, and answers what would happen and what an agent would be given. A message of your own is judged as one that passed authentication unless `authenticated` is false. Nothing is stored, sent or changed, and no model is called.

OAuth: not available to delegated app tokens.

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

Organizations: a member's console session needs `mail:read`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Request body (application/json): SecurityPreviewRequest**
What to evaluate and under which policy. Give exactly one of `messageId` (a stored message, with the assessment it already has), `sample` (a built-in message) or `text`/`html` (your own). Nothing is stored or sent, and no model is called: a sample and your own message are judged by the deterministic signals.
- `inboxId` (string, optional): Evaluate as this inbox: its senders and, without `policy`, its policy. Defaults to the message's inbox, or to the account's policy with no sender history. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`
- `messageId` (string, optional): A stored inbound message of the account that was assessed. A held one needs a caller that may review held mail. Example: `msg_01jc5a6g7h8j9k0m1n2p3q4r5s`
- `sample` ("ordinary" | "phishing" | "prompt_injection" | "impersonation", optional): A built-in message: ordinary mail, a phishing attempt, an injection hidden from the reader, or an impersonation.
- `from` (string, optional): The sender of your own message. Defaults to a sender the inbox has never seen. Example: `stranger@example.net`
- `authenticated` (boolean, optional): Whether your own message passed authentication for its sender's domain. Defaults to true, so the content decides; false shows what a forged sender looks like.
- `subject` (string, optional)
- `text` (string, optional): The plain-text body of your own message.
- `html` (string, optional): The HTML body of your own message.
- `policy` (UpdateSecurityPolicy, optional): A draft to evaluate under, applied over the policy in force. Omit to use the policy in force.

Answers `200`: The assessment, the action and the agent's view.

**Response 200: SecurityPreview**
What would happen to the message under the policy, and exactly what an agent reading the inbox would be given for it. The assessment's `action` is the one the policy leads to: what `enforce` would do, whatever the deployment's mode.
- `risk` (RiskAssessment)
- `refused` (boolean): True when the sender is blocked: the message would be refused and never stored, whatever `risk.action` says the policy would otherwise have done.
- `agentView` (string): The text an agent receives for the message: the fenced mail, the mail behind a warning, the stub of a held message, or nothing but a note for mail that is refused.
- `enforcement` ("off" | "observe" | "enforce"): The deployment's mode, so a caller can say whether this is what happens today.

Example 200 response:
```json
{
  "risk": {
    "score": 92,
    "level": "critical",
    "labels": [
      "prompt_injection"
    ],
    "reasons": [
      "hidden_text",
      "instruction_override"
    ],
    "sender": {
      "standing": "new",
      "authenticated": false
    },
    "action": "held",
    "analysis": "signals",
    "review": null
  },
  "refused": false,
  "agentView": "A message from stranger@example.net is held for review: critical risk (prompt_injection). Its content is not shown.",
  "enforcement": "enforce"
}
```

**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 | `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 | `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 POST "https://api.doorman.fyi/v1/security/preview" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "sample": "prompt_injection",
    "policy": {
      "level": "strict"
    }
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/security/preview", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "sample": "prompt_injection",
    "policy": {
      "level": "strict"
    }
  }),
});
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/security/preview",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    json={
        "sample": "prompt_injection",
        "policy": {
            "level": "strict",
        },
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## List held sends

`GET /v1/inboxes/{inboxId}/held-sends`

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

The messages that wait for the owner before they leave the inbox, newest first: the sends the security policy kept (`sendApproval`) and the drafts written for the owner to send. The ones still waiting unless `status` says otherwise. Every caller that can read the inbox gets who each is to and where it stands; the subject and the text are added for a caller that may decide. An inbox has at most 50 sends the policy kept and 100 drafts waiting; one that nobody decides expires unsent after 7 days, a draft after 30. A connected app is not offered the list: it reads the held send it was answered with.

OAuth: not available to delegated app tokens.

Also available as [`client.inboxes.heldSends.list`](https://doorman.fyi/docs/sdk/reference/security.md#inboxes-heldSends-list) in TypeScript, [`client.inboxes.held_sends.list`](https://doorman.fyi/docs/python/reference/security.md#inboxes-heldSends-list) in Python, the [`inboxes_heldSends_list`](https://doorman.fyi/docs/mcp/tools/security.md#inboxes-heldSends-list) tool and [`doorman inboxes held-sends list`](https://doorman.fyi/docs/cli/commands/security.md#inboxes-heldSends-list) on the command line.

Organizations: a member's console session needs `mail:read`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `inboxId` | path | `string` | yes | The inbox. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`. |
| `status` | query | `"held" \| "sent" \| "discarded" \| "expired"` | no | Only held sends in this state. Defaults to `held`. |
| `kind` | query | `"held" \| "draft"` | no | Only the sends the policy kept (`held`) or only drafts (`draft`). Both when left out. |
| `limit` | query | `integer` | no | Page size, 1 to 100. Defaults to 50. |
| `offset` | query | `integer` | no | Rows to skip. Defaults to 0. |

Answers `200`: A page of held sends.

**Response 200: HeldSendPage**
A page of an inbox's held sends, newest first.
- `data` (HeldSend[])
- `limit` (integer): The page size that was applied.
- `offset` (integer): The offset that was applied.
- `total` (integer): How many match, across every page.

**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 | `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 "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/held-sends" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/held-sends", {
  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/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/held-sends",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Read a held send

`GET /v1/held-sends/{heldSendId}`

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

Where a held send stands: waiting, sent, discarded or expired. What it says is shown only to a caller that may decide.

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

Also available as [`client.heldSends.get`](https://doorman.fyi/docs/sdk/reference/security.md#heldSends-get) in TypeScript, [`client.held_sends.get`](https://doorman.fyi/docs/python/reference/security.md#heldSends-get) in Python, the [`heldSends_get`](https://doorman.fyi/docs/mcp/tools/security.md#heldSends-get) tool and [`doorman held-sends get`](https://doorman.fyi/docs/cli/commands/security.md#heldSends-get) on the command line.

Organizations: a member's console session needs `mail:read`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `heldSendId` | path | `string` | yes | The held send. Example: `hsd_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

Answers `200`: The held send.

**Response 200: HeldSend**
A message that waits for the owner: one that was asked to be sent and that the security policy kept, or a draft written for the owner to send. Every caller that can read the inbox gets who it is to and where it stands; the subject and the text are added for a caller that may decide (a console session, or an account key the account allows).
- `id` (string): A held send's identifier. Example: `hsd_01jc5f1a2b3c4d5e6f7g8h9j0k`
- `inboxId` (string): An inbox identifier. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`
- `kind` ("held" | "draft"): Why it waits. `held`: the security policy kept a send for the owner. `draft`: an app or a key wrote it as a draft, and only the owner sends it.
- `status` ("held" | "sent" | "discarded" | "expired"): `held` while it waits. `sent` once the owner approved it and the mail went out. `discarded` when the owner said no. `expired` when nobody decided in time. Only a held send can be decided.
- `threadId` (string | null): The thread a reply was written into; null for a new message.
- `to` (string[]): Who it would go to: the recipients the request named, or on a reply that named none, the one the thread gives. Example: `["sam@example.com"]`
- `cc` (string[])
- `bcc` (string[])
- `unknownRecipients` (string[]): The recipients that made it wait: addresses the inbox neither knows nor trusts. Empty for a draft. Example: `["sam@example.com"]`
- `subject` (string | null): The subject as written, for a caller that may decide; null for every other caller, and on a reply that left it to the thread.
- `text` (string | null): The text as written (derived from the HTML when only HTML was given, and cut at 200,000 characters), for a caller that may decide; null for every other caller.
- `attachments` (integer): How many attachments it carries.
- `requestedBy` (object)
  - `kind` ("app" | "key"): A connected app, or an API key.
  - `name` (string | null): The app's or the key's name, when it has one. Example: `Support agent`
- `messageId` (string | null): The message it became once it was sent; null otherwise.
- `createdAt` (string (date-time)) Example: `2026-11-05T10:05:00.000Z`
- `expiresAt` (string (date-time)): When it expires unsent: 7 days after it was made, or 30 for a draft. Example: `2026-11-05T10:05:00.000Z`
- `decidedAt` (string (date-time) | null): When it was sent, discarded or expired; null while it waits.

Example 200 response:
```json
{
  "id": "hsd_01jc5f1a2b3c4d5e6f7g8h9j0k",
  "inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
  "kind": "held",
  "status": "held",
  "threadId": null,
  "to": [
    "sam@example.com"
  ],
  "cc": [],
  "bcc": [],
  "unknownRecipients": [
    "sam@example.com"
  ],
  "subject": null,
  "text": null,
  "attachments": 0,
  "requestedBy": {
    "kind": "app",
    "name": "Support agent"
  },
  "messageId": null,
  "createdAt": "2026-11-05T10:05:00.000Z",
  "expiresAt": "2026-11-12T10:05:00.000Z",
  "decidedAt": 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 | `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 | `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 "https://api.doorman.fyi/v1/held-sends/hsd_01jc5f1a2b3c4d5e6f7g8h9j0k" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/held-sends/hsd_01jc5f1a2b3c4d5e6f7g8h9j0k", {
  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/held-sends/hsd_01jc5f1a2b3c4d5e6f7g8h9j0k",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Send a held send

`POST /v1/held-sends/{heldSendId}/approve`

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

Sends the message as it was asked for, now: the limits, the plan's cap and the thread are checked at this moment, and `message.sent` fires as for any send. Its recipients become known to the inbox, as with any mail the inbox sends. It needs a console session unless the account allows its account keys to (403 `session_required`). A send that fails stays held and answers the error a send would. One that is no longer held answers 404. Recorded in the audit log.

OAuth: not available to delegated app tokens.

Also available as [`client.heldSends.approve`](https://doorman.fyi/docs/sdk/reference/security.md#heldSends-approve) in TypeScript, [`client.held_sends.approve`](https://doorman.fyi/docs/python/reference/security.md#heldSends-approve) in Python, the [`heldSends_approve`](https://doorman.fyi/docs/mcp/tools/security.md#heldSends-approve) tool and [`doorman held-sends approve`](https://doorman.fyi/docs/cli/commands/security.md#heldSends-approve) on the command line.

Organizations: a member's console session needs `security:manage`, `mail:send` and `mail:read`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `heldSendId` | path | `string` | yes | The held send. Example: `hsd_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

Answers `201`: The stored outbound message.

**Response 201: SentMessage**
The stored outbound message, with the identifier the sending provider assigned.
- `id` (string): A message identifier. Example: `msg_01jc5a6g7h8j9k0m1n2p3q4r5s`
- `inboxId` (string): An inbox identifier. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`
- `threadId` (string): A thread identifier. Example: `thr_01jc5a1b2c3d4e5f6g7h8j9k0m`
- `direction` ("inbound" | "outbound")
- `rfcMessageId` (string | null): The Message-ID header of inbound mail; null for mail this API sent. Example: `<a1b2c3@example.com>`
- `inReplyTo` (string | null): The In-Reply-To header, when the message is a reply.
- `references` (string[]): The References chain, oldest first.
- `from` (NamedAddress)
- `to` (NamedAddress[])
- `cc` (NamedAddress[])
- `bcc` (NamedAddress[]): Only outbound mail carries blind copies.
- `replyTo` (string | null): The Reply-To address, when one was given.
- `deliveryRole` ("to" | "cc" | "bcc" | null): How the inbox received the message: as a to, cc or bcc recipient. Null for outbound mail.
- `subject` (string) Example: `Invoice 2847`
- `text` (string | null): The plain-text body, or text derived from the HTML when there was none.
- `hasHtml` (boolean): Whether an HTML body is stored; read it at /v1/messages/{messageId}/html.
- `rawUrl` (string | null): Where to download the original message/rfc822; null for outbound mail.
- `sizeBytes` (integer)
- `category` ("personal" | "automated" | "marketing" | "bounce" | "spam" | "malicious"): What kind of mail this is; ordinary outbound mail is personal and rule-generated mail is automated.
- `autoReplyable` (boolean): False for anything an agent should not answer on its own.
- `verdict` ("clean" | "unverified" | "suspicious" | null): From the authentication results; null for outbound mail.
- `spamScore` (number | null): How likely the message is junk, from 0 to 1, when it was assessed; null otherwise.
- `authentication` (AuthenticationResults | null)
- `service` (MessageService | null, optional): The outside service the message came from, for the inbox's passport; null for any other mail and for outbound mail. Older deployments omit it.
- `risk` (RiskAssessment | null, optional): Doorman's assessment of an inbound message (ADR-019). Null for outbound mail and for mail that was not assessed. Older deployments omit it.
- `redaction` (Redaction, optional): What the account's healthcare guardrails found in the message (ADR-027), and whether `subject`, `text` and the attachments' `parsedText` carry placeholders in place of it. Absent where no guardrail applies.
- `occurredAt` (string (date-time)): When the message arrived or was sent. Example: `2026-11-05T10:05:00.000Z`
- `attachments` (Attachment[])
- `providerMessageId` (string | null): The provider's message identifier, used to thread replies to this message. Example: `<b2c3d4@doorman.example>`

Example 201 response:
```json
{
  "id": "msg_01jc5b7h8j9k0m1n2p3q4r5s6t",
  "inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
  "threadId": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
  "direction": "outbound",
  "rfcMessageId": null,
  "inReplyTo": "<a1b2c3@example.com>",
  "references": [
    "<a1b2c3@example.com>"
  ],
  "from": {
    "address": "concierge@doorman.example",
    "name": "Acme concierge"
  },
  "to": [
    {
      "address": "sam@example.com",
      "name": null
    }
  ],
  "cc": [],
  "bcc": [],
  "replyTo": null,
  "deliveryRole": null,
  "subject": "Re: Invoice 2847",
  "text": "Thanks, confirming for Thursday.",
  "hasHtml": false,
  "rawUrl": null,
  "sizeBytes": 31,
  "category": "personal",
  "autoReplyable": false,
  "verdict": null,
  "spamScore": null,
  "authentication": null,
  "occurredAt": "2026-11-05T10:05:00.000Z",
  "attachments": [],
  "providerMessageId": "<b2c3d4@doorman.example>"
}
```

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 400 | `recipient_suppressed` | A recipient previously bounced or complained and is suppressed. |
| 400 | `send_rejected` | The sending provider rejected the message; `providerCode` carries its reason. |
| 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 | `plan_limit_reached` | The plan's allowance is used up; `scope` says whether it is the inbox count, the monthly sends or the custom domains. Upgrade rather than wait. |
| 403 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 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 | `inbox_suspended` | The inbox cannot send, or start a sign-in, at the moment. |
| 403 | `recipient_not_permitted` | A recipient is not permitted for this deployment. |
| 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 | `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. |
| 404 | `thread_not_found` | The thread does not exist, belongs to another inbox or was trashed. |
| 409 | `domain_not_verified` | The custom domain has not verified its required DNS records. |
| 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. |
| 413 | `message_too_large` | The message exceeds the size limit, including attachments. |
| 429 | `rate_limit_exceeded` | A per-inbox or per-account rate limit; `Retry-After` and `resetsAt` say when to try again. |
| 429 | `provider_rate_limited` | The sending provider is rate limiting this deployment. |
| 500 | `internal_error` | Something went wrong on the server. |
| 502 | `send_failed` | The sending provider did not accept or could not deliver the message; `providerCode` carries its reason. |
| 503 | `sending_paused` | Sending is paused for this deployment pending review. |
| 503 | `sending_unavailable` | The inbox domain is not onboarded for sending, or sending is not configured. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/held-sends/hsd_01jc5f1a2b3c4d5e6f7g8h9j0k/approve" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/held-sends/hsd_01jc5f1a2b3c4d5e6f7g8h9j0k/approve", {
  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/held-sends/hsd_01jc5f1a2b3c4d5e6f7g8h9j0k/approve",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Discard a held send

`POST /v1/held-sends/{heldSendId}/discard`

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

Ends a held send without sending it and removes what it carried; `send.discarded` fires. Nothing brings it back. One that is no longer held answers 404. Recorded in the audit log.

OAuth: not available to delegated app tokens.

Also available as [`client.heldSends.discard`](https://doorman.fyi/docs/sdk/reference/security.md#heldSends-discard) in TypeScript, [`client.held_sends.discard`](https://doorman.fyi/docs/python/reference/security.md#heldSends-discard) in Python, the [`heldSends_discard`](https://doorman.fyi/docs/mcp/tools/security.md#heldSends-discard) tool and [`doorman held-sends discard`](https://doorman.fyi/docs/cli/commands/security.md#heldSends-discard) on the command line.

Organizations: a member's console session needs `security:manage`. API keys and app tokens are not held to member permissions. See [Roles and permissions](https://doorman.fyi/docs/organizations.md#roles).

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `heldSendId` | path | `string` | yes | The held send. Example: `hsd_01jc5f1a2b3c4d5e6f7g8h9j0k`. |

Answers `204`: Discarded.

**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 | `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 POST "https://api.doorman.fyi/v1/held-sends/hsd_01jc5f1a2b3c4d5e6f7g8h9j0k/discard" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/held-sends/hsd_01jc5f1a2b3c4d5e6f7g8h9j0k/discard", {
  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}.`);
// 204: nothing to read.
```

Python:
```python
import os
import requests

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