---
title: "Sending"
description: "New messages and replies from an inbox, with idempotent retries."
url: https://doorman.fyi/docs/reference/sending
markdown: https://doorman.fyi/docs/reference/sending.md
area: "API reference"
section: "API reference"
---

# Sending

New messages and replies from an inbox, with idempotent retries.

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

## Send a message or reply

`POST /v1/inboxes/{inboxId}/send`

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

Sends from the inbox's address. `to`, `cc` and `bcc` take a comma-separated string or an array. A reply passes `threadId`: the subject defaults to `Re: <thread subject>`, In-Reply-To and References are set from the thread, the previous message is quoted under the text unless `includeQuote` is false, `to` defaults to the last inbound message's Reply-To or sender, and the thread is marked read. Limits per inbox: 10 sends per minute and 200 per day (429 with `Retry-After`; refused sends are not counted), 50 recipients, 32 attachments, 25 MiB per message. On the free plan the account's monthly cap applies on top (402). Outbound messages are stored without a raw copy. `multipart/form-data` is accepted with the same field names and repeated `attachments` file fields. The security policy guards sends from keys and app tokens, never from a console session: a reply into a thread that holds a flagged message from a sender that is not trusted, or a recipient the inbox does not know when the policy asks for known recipients, answers 403 `risk_blocked` with `guard`. Mail an inbox rule generates is not guarded; it is never sent for a flagged message. Where the policy asks (`sendApproval`), a message to a recipient the inbox does not know answers 202 with a held send: it waits for the owner and must not be sent again (at most 50 wait, then 409). A failed file or link check answers 403 `risk_blocked`; retry a 503 `scan_unavailable`.

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

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

Organizations: a member's console session needs `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 |
| --- | --- | --- | --- | --- |
| `inboxId` | path | `string` | yes | The inbox. Example: `inb_01jc4q7w9k2m5n8p3r6t1v4x7z`. |
| `Idempotency-Key` | header | `string` | no | 1 to 255 printable ASCII characters. For 24 hours the same key with the same request replays the original answer with `Idempotent-Replayed: true`; the same key with a different request is refused with 422 `idempotency_key_reused`; a key whose first attempt is still running answers 409 `idempotency_in_progress`; a failed send releases the key. Example: `order-2847-reply`. |

**Request body (application/json): SendMessage**
A message to send from an inbox: a new one with `to` and `subject`, or a reply with `threadId`.
- `to` (string | string[], optional): Recipients. Optional on a reply, where it defaults to the last inbound message's Reply-To or sender.
- `cc` (string | string[], optional)
- `bcc` (string | string[], optional)
- `replyTo` (string, optional): The address replies should go to instead of the inbox.
- `subject` (string, optional): Required on a new message. A reply defaults to `Re: <thread subject>`.
- `text` (string, optional): The plain-text body.
- `html` (string, optional): The HTML body. Text is derived from it when `text` is absent.
- `body` (string, optional): A convenience: treated as HTML when it looks like HTML, as text otherwise. Ignored when `text` or `html` is given.
- `threadId` (string, optional): A thread id (thr_...). Makes the message a reply in this thread: threading headers, the default subject and recipient, and the quoted previous message come from it. An unknown, foreign or trashed thread answers 404 `thread_not_found`. Example: `thr_01jc5a1b2c3d4e5f6g7h8j9k0m`
- `includeQuote` (boolean, optional): On a reply, quote the previous message under the text. Defaults to true.
- `attachments` (SendAttachment[], optional)

**Request body (multipart/form-data): SendMessageForm**
The same send as multipart/form-data: the text fields by name, repeated `attachments` file fields, `includeQuote` as text (`false`, `0` or `no` turn the quote off).
- `to` (string, optional)
- `cc` (string, optional)
- `bcc` (string, optional)
- `replyTo` (string, optional)
- `subject` (string, optional)
- `text` (string, optional)
- `html` (string, optional)
- `body` (string, optional)
- `threadId` (string, optional)
- `includeQuote` (string, optional)
- `attachments` (binary[], optional)

Answers `201`: The stored outbound message.

**Response 201: SendOutcome**
One of:

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>`

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 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>"
}
```

Response header `Idempotent-Replayed`: `true` when the answer was replayed for an `Idempotency-Key` seen before.

Answers `202`: The message waits for the owner: a held send. Nothing was sent.

**Response 202: SendOutcome**
One of:

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>`

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 202 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>"
}
```

Response header `Idempotent-Replayed`: `true` when the answer was replayed for an `Idempotency-Key` seen before.

**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. |
| 400 | `invalid_form` | The multipart body could not be parsed. |
| 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 | `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 | `risk_blocked` | The send or the download was refused; `guard` says why: `reply` when the thread holds a flagged message whose sender is not trusted, `recipient` when a recipient is not one the inbox knows, `content` when an attachment did not pass the check of its bytes (`reasons` lists what was found), `guardrail` when a healthcare guardrail found what may not be sent (`entities` lists the kinds). For `reply` and `recipient` a person can send from the console, mark the message safe or trust the sender. For `content`, a program or a file dressed as another kind is refused for every caller; a locked or damaged file, a script, or a document with macros, is refused for keys and app tokens only. A link that delivered harmful software when it was opened in isolation is refused for every caller. |
| 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 | `idempotency_in_progress` | A request with this Idempotency-Key is still being processed. |
| 409 | `domain_not_verified` | The custom domain has not verified its required DNS records. |
| 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. |
| 413 | `message_too_large` | The message exceeds the size limit, including attachments. |
| 422 | `idempotency_key_reused` | This Idempotency-Key was already used for a different request. |
| 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. |
| 503 | `scan_unavailable` | The malware engine did not answer in time, so an attachment could not be checked and nothing was sent. Try again after `Retry-After`; an `Idempotency-Key` makes the retry safe. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/send" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "idempotency-key: order-2847-reply" \
  -H "content-type: application/json" \
  -d '{
    "to": "sam@example.com",
    "subject": "Thursday",
    "text": "Thursday works."
  }'
```

TypeScript:
```ts
const response = await fetch("https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/send", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
    "idempotency-key": "order-2847-reply",
    "content-type": "application/json",
  },
  redirect: "manual", credentials: "omit",
  body: JSON.stringify({
    "to": "sam@example.com",
    "subject": "Thursday",
    "text": "Thursday works."
  }),
});
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/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/send",
    headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}", "idempotency-key": "order-2847-reply"},
    json={
        "to": "sam@example.com",
        "subject": "Thursday",
        "text": "Thursday works.",
    },
    allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Write a draft for the owner to send

`POST /v1/inboxes/{inboxId}/drafts`

Access `key`: an API key, or a correctly scoped app token where delegated access is allowed; console sessions are refused.

Writes a message and leaves it for the owner: nothing is sent, and only the owner sends it, from the console or with `heldSends.approve`. The body is the one a send takes, and it is checked as a send would be (recipients, size, thread) so the owner is not handed something that cannot go out. The answer is a held send with `kind` `draft`; `send.held` fires, and `message.sent` follows if the owner sends it. An inbox has at most 100 drafts waiting, and one nobody sends expires after 30 days. A draft cannot be changed: take it back with `drafts.delete` and write it again.

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

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

**Parameters**

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

**Request body (application/json): SendMessage**
A message to send from an inbox: a new one with `to` and `subject`, or a reply with `threadId`.
- `to` (string | string[], optional): Recipients. Optional on a reply, where it defaults to the last inbound message's Reply-To or sender.
- `cc` (string | string[], optional)
- `bcc` (string | string[], optional)
- `replyTo` (string, optional): The address replies should go to instead of the inbox.
- `subject` (string, optional): Required on a new message. A reply defaults to `Re: <thread subject>`.
- `text` (string, optional): The plain-text body.
- `html` (string, optional): The HTML body. Text is derived from it when `text` is absent.
- `body` (string, optional): A convenience: treated as HTML when it looks like HTML, as text otherwise. Ignored when `text` or `html` is given.
- `threadId` (string, optional): A thread id (thr_...). Makes the message a reply in this thread: threading headers, the default subject and recipient, and the quoted previous message come from it. An unknown, foreign or trashed thread answers 404 `thread_not_found`. Example: `thr_01jc5a1b2c3d4e5f6g7h8j9k0m`
- `includeQuote` (boolean, optional): On a reply, quote the previous message under the text. Defaults to true.
- `attachments` (SendAttachment[], optional)

**Request body (multipart/form-data): SendMessageForm**
The same send as multipart/form-data: the text fields by name, repeated `attachments` file fields, `includeQuote` as text (`false`, `0` or `no` turn the quote off).
- `to` (string, optional)
- `cc` (string, optional)
- `bcc` (string, optional)
- `replyTo` (string, optional)
- `subject` (string, optional)
- `text` (string, optional)
- `html` (string, optional)
- `body` (string, optional)
- `threadId` (string, optional)
- `includeQuote` (string, optional)
- `attachments` (binary[], optional)

Answers `201`: The draft, waiting for the owner.

**Response 201: 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 201 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 |
| --- | --- | --- |
| 400 | `validation_error` | A field is missing or invalid; the message names it. |
| 400 | `invalid_json` | The request body is not JSON. |
| 400 | `invalid_form` | The multipart body could not be parsed. |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 403 | `forbidden` | The key is scoped to one inbox and cannot manage inboxes, keys or webhooks, or cannot read account-wide data. |
| 403 | `inbox_suspended` | The inbox cannot send, or start a sign-in, at the moment. |
| 403 | `insufficient_scope` | The app's token lacks a required scope, or the operation cannot be delegated. |
| 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 | `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. |
| 413 | `message_too_large` | The message exceeds the size limit, including attachments. |
| 500 | `internal_error` | Something went wrong on the server. |

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/drafts" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "to": "sam@example.com",
    "subject": "Thursday",
    "text": "Thursday works."
  }'
```

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

## Take a draft back

`DELETE /v1/drafts/{heldSendId}`

Access `key`: an API key, or a correctly scoped app token where delegated access is allowed; console sessions are refused.

Removes a draft that still waits, with what it carried; `send.discarded` fires. For the app or the key that wrote it, or a caller that may decide. A send the security policy kept is not a draft and answers 404 here: the owner ends that one.

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

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

**Parameters**

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

Answers `204`: Removed.

**Errors**

| Status | Error | Meaning |
| --- | --- | --- |
| 401 | `unauthorized` | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 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. |
| 404 | `not_found` | No such resource for this caller, or no such route. |
| 500 | `internal_error` | Something went wrong on the server. |

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

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