# API reference

Base URL: https://api.send.io. Authenticate with `Authorization: Bearer mx_...`. Request and response bodies are JSON. 437 endpoints.

Moving from another provider (opened as /docs/api?guide=<provider>)? Each guide has its own page: [Resend](https://developer.send.io/docs/integrations/resend), [SendGrid](https://developer.send.io/docs/integrations/sendgrid), [Mailchimp](https://developer.send.io/docs/integrations/mailchimp), [Mailgun](https://developer.send.io/docs/integrations/mailgun), [Postmark](https://developer.send.io/docs/integrations/postmark), [Brevo](https://developer.send.io/docs/integrations/brevo), [Mailjet](https://developer.send.io/docs/integrations/mailjet).

## Errors

Errors are JSON with `statusCode`, `name` and `message`.

| Status | name | Meaning |
| --- | --- | --- |
| 400 | `invalid_idempotency_key` | The `Idempotency-Key` header is empty or longer than 256 characters. |
| 401 | `missing_api_key` | No `Authorization: Bearer mx_...` header. |
| 401 | `invalid_api_key` | The key does not exist or was revoked. |
| 401 | `restricted_api_key` | The key (or an app you connected with sending access) may only send email, or the key may only use its agent inbox. |
| 401 | `invalid_token` | An access token from the MCP sign-in was used outside the MCP server. Use an API key for the API. |
| 402 | `insufficient_credits` | Your credit balance is too low to send this email; nothing was sent. Buy credits in Billing. See [Credits and pricing](https://developer.send.io/docs/credits). |
| 403 | `validation_error` | Not allowed, for example sending from a domain that is not verified. |
| 403 | `invalid_permission` | The key or your role may not do this, for example a key restricted to another domain, or an action only an admin can take. |
| 403 | `missing_permission` | The key's permission list does not include this action, or the key is waiting for its agent to be verified. |
| 403 | `ip_not_allowed` | The API key has an IP allow list and the request came from another address. |
| 403 | `receive_only` | Free mailboxes can receive but not send for now. Send from your own domain. |
| 403 | `sending_paused` | Sending from this mailbox is paused. |
| 403 | `free_limit` | The workspace has used all its free mailboxes. Delete one, or buy credits to add more. |
| 403 | `sending_suspended` | Sending is suspended for this workspace because of its sending reputation. See [Sending reputation](https://developer.send.io/docs/sending-reputation). |
| 403 | `subaccount_suspended` | This subaccount is suspended, so it cannot send. |
| 404 | `not_found` | No such resource in this team. |
| 405 | `method_not_allowed` | The path exists but does not take this HTTP method, for example `DELETE /mailboxes` without a mailbox ID. |
| 409 | `concurrent_idempotent_requests` | A request with the same `Idempotency-Key` has not finished yet. Retry later to get its response. |
| 409 | `invalid_idempotent_request` | The `Idempotency-Key` was used in the last 24 hours with a different body. Use a new key. |
| 409 | `conflict` | The request conflicts with the resource as it is now: it already exists, it changed since you read it, or its state does not allow this. |
| 409 | `resource_in_use` | Something else uses this resource, such as a broadcast or workflow. Remove it from there before deleting it. |
| 409 | `domain_ownership_required` | The domain name is held unverified by another workspace: publish the TXT record shown to prove you control it, then add it again. |
| 409 | `concurrent_modification` | Someone else changed the resource at the same time. Reload it and try again. |
| 413 | `validation_error` | The request body is too large. |
| 415 | `unsupported_media_type` | The body is compressed with a `Content-Encoding` send.io does not read (such as `br` or `zstd`). Send it uncompressed, or with `gzip` or `deflate`. |
| 422 | `invalid_parameter` | A parameter has the wrong type or format, such as a malformed id in the path. |
| 422 | `missing_required_field` | A required field is missing from the body. |
| 422 | `validation_error` | The request is well formed but its values are not valid. |
| 422 | `invalid_attachment` | An attachment cannot be used: too large, a blocked file type, or its `path` could not be fetched. |
| 422 | `unknown_merge_tags` | The content uses merge tags that are not contact fields or properties. |
| 429 | `rate_limit_exceeded` | More than 10 requests per second for your team. Retry after a moment. |
| 429 | `daily_quota_exceeded` | A daily sending limit is used up: the one until your first credit purchase, or the one for new paid accounts (5,000 emails a day for the first 7 days after the first purchase, by default). It resets at 00:00 UTC; `GET /billing/balance` shows it as `daily_limit`. See [Credits and pricing](https://developer.send.io/docs/credits). |
| 429 | `subaccount_daily_quota_exceeded` | A subaccount reached its own daily sending limit. |
| 429 | `subaccount_monthly_quota_exceeded` | A subaccount reached its own monthly sending limit. |
| 429 | `daily_limit` | A free mailbox reached its daily sending limit. It resets at 00:00 UTC. Send from your own domain for more. |
| 500 | `application_error` | Something went wrong on our side. Retry later; if it keeps happening, contact support. |
| 503 | `billing_provider_error` | The payment provider refused a billing request or could not be reached. Nothing was charged by this request; try again in a minute. |
| 503 | `service_unavailable` | A dependency is not configured or is down. Retry later. |

## Pagination

List endpoints return one page at a time. Each one pages in one of the styles below; its query parameters say which.

### Most lists: limit, after and before

`limit` (1 to 100) sets the page size. `after` is the `id` of the last item you have and returns the next page (older items); `before` is the `id` of the first item you have and returns the previous page (newer items). The answer: `{ "object": "list", "has_more": true, "data": [...] }`. `has_more` is true while more items lie beyond this page in the direction you are paging.

- Items are newest first, on every page (a `before` page too).
- A few lists page forward only: they take `after` and not `before`, as their query parameters say.
- `limit` defaults to 20. A few lists return every item when `limit` is left out; their `limit` row says so.
- Send only one of `after` and `before`: both answer 422 `validation_error`. A `limit` outside 1 to 100 answers 422 `validation_error` too.
- A cursor that is not an id, or names no item of this list that you can see, answers 422 `invalid_parameter`.

```text
GET /contacts?limit=50
GET /contacts?limit=50&after=<id of the last contact on the page>   # while has_more is true
```

Endpoints: [`GET /emails`](https://developer.send.io/docs/api#list-emails), [`GET /emails/{email_id}/attachments`](https://developer.send.io/docs/api#list-email-attachments), [`GET /emails/receiving`](https://developer.send.io/docs/api#list-received-emails), [`GET /emails/receiving/{email_id}/attachments`](https://developer.send.io/docs/api#list-received-attachments), [`GET /inbound/routes/{route_id}/deliveries`](https://developer.send.io/docs/api#list-inbound-deliveries), [`GET /inbound/routes/{route_id}/deliveries/{delivery_id}/attempts`](https://developer.send.io/docs/api#list-inbound-delivery-attempts), [`GET /domains`](https://developer.send.io/docs/api#list-domains), [`GET /api-keys`](https://developer.send.io/docs/api#list-api-keys), [`GET /oauth/grants`](https://developer.send.io/docs/api#list-oauth-grants), [`GET /webhooks`](https://developer.send.io/docs/api#list-webhooks), [`GET /webhooks/{webhook_id}/events`](https://developer.send.io/docs/api#list-webhook-events), [`GET /webhooks/{webhook_id}/events/{event_id}/attempts`](https://developer.send.io/docs/api#list-webhook-event-attempts), [`GET /senders`](https://developer.send.io/docs/api#list-senders), [`GET /suppressions`](https://developer.send.io/docs/api#list-suppressions), [`GET /suppressions/allowlist`](https://developer.send.io/docs/api#list-allowlist), [`GET /templates`](https://developer.send.io/docs/api#list-templates), [`GET /contacts`](https://developer.send.io/docs/api#list-contacts), [`GET /contacts/{contact_id}/segments`](https://developer.send.io/docs/api#list-contact-segments), [`GET /contacts/{contact_id}/topics`](https://developer.send.io/docs/api#get-contact-topics), [`GET /contacts/imports`](https://developer.send.io/docs/api#list-contact-imports), [`GET /audiences`](https://developer.send.io/docs/api#list-audiences), [`GET /audiences/{audience_id}/contacts`](https://developer.send.io/docs/api#list-audience-contacts), [`GET /segments`](https://developer.send.io/docs/api#list-segments), [`GET /segments/{segment_id}/contacts`](https://developer.send.io/docs/api#list-segment-contacts), [`GET /topics`](https://developer.send.io/docs/api#list-topics), [`GET /contact-properties`](https://developer.send.io/docs/api#list-contact-properties), [`GET /broadcasts`](https://developer.send.io/docs/api#list-broadcasts), [`GET /broadcasts/{broadcast_id}/versions`](https://developer.send.io/docs/api#list-broadcast-versions), [`GET /broadcasts/{broadcast_id}/recipients`](https://developer.send.io/docs/api#list-broadcast-recipients), [`GET /broadcasts/{broadcast_id}/clicked-links`](https://developer.send.io/docs/api#list-broadcast-clicked-links), [`GET /transactional`](https://developer.send.io/docs/api#list-transactional-emails), [`GET /automations`](https://developer.send.io/docs/api#list-automations), [`GET /automations/{id}/runs`](https://developer.send.io/docs/api#list-automation-runs), [`GET /events`](https://developer.send.io/docs/api#list-events), [`GET /logs`](https://developer.send.io/docs/api#list-logs), [`GET /billing/transactions`](https://developer.send.io/docs/api#list-credit-transactions), [`GET /billing/purchases`](https://developer.send.io/docs/api#list-credit-purchases).

### Email events: limit and cursor

`limit` (1 to 300, default 50) sets the page size. `cursor` is the `next_cursor` of the previous page; the filters must stay the same. The answer: `{ "object": "list", "has_more": true, "next_cursor": "...", "data": [...] }`. `next_cursor` is null on the last page.

- Events are newest first. Here `after` and `before` are times (ISO 8601, a date or Unix seconds), not cursors.
- A `cursor` that was not made by this endpoint, or a `limit` outside 1 to 300, answers 422 `validation_error`.

```text
GET /emails/events?type=bounced&limit=100
GET /emails/events?type=bounced&limit=100&cursor=<next_cursor>   # while next_cursor is not null
```

Endpoints: [`GET /emails/events`](https://developer.send.io/docs/api#list-team-email-events).

### Agent inboxes: limit and page_token

`limit` (1 to 100, default 50) sets the page size. `page_token` is the `next_page_token` of the previous page. The answer: `count` (items on this page), `limit`, and `next_page_token` only when there is another page, next to the items.

- Stop when the answer has no `next_page_token`.
- A `page_token` that was not made by the API answers 400 `validation_error`. A `limit` outside 1 to 100 is ignored (the page holds 50).

```text
GET /v0/inboxes?limit=100
GET /v0/inboxes?limit=100&page_token=<next_page_token>   # while next_page_token is present
```

Endpoints: [`GET /inboxes/{id}/events`](https://developer.send.io/docs/api#list-inbox-events), [`GET /inboxes/{id}/webhooks`](https://developer.send.io/docs/api#list-inbox-webhooks), [`GET /v0/inboxes`](https://developer.send.io/docs/api#am-list-inboxes), [`GET /v0/inboxes/search`](https://developer.send.io/docs/api#am-search-inboxes), [`GET /v0/inboxes/{inbox_id}/messages`](https://developer.send.io/docs/api#am-list-messages), [`GET /v0/inboxes/{inbox_id}/messages/search`](https://developer.send.io/docs/api#am-search-messages), [`GET /v0/inboxes/{inbox_id}/threads`](https://developer.send.io/docs/api#am-list-inbox-threads), [`GET /v0/inboxes/{inbox_id}/threads/search`](https://developer.send.io/docs/api#am-search-inbox-threads), [`GET /v0/threads`](https://developer.send.io/docs/api#am-list-threads), [`GET /v0/threads/search`](https://developer.send.io/docs/api#am-search-threads), [`GET /v0/inboxes/{inbox_id}/drafts`](https://developer.send.io/docs/api#am-list-inbox-drafts), [`GET /v0/drafts`](https://developer.send.io/docs/api#am-list-drafts), [`GET /v0/inboxes/{inbox_id}/lists/{direction}/{type}`](https://developer.send.io/docs/api#am-list-inbox-list-entries), [`GET /v0/inboxes/{inbox_id}/webhooks`](https://developer.send.io/docs/api#am-list-inbox-webhooks), [`GET /v0/inboxes/{inbox_id}/api-keys`](https://developer.send.io/docs/api#am-list-inbox-api-keys), [`GET /v0/inboxes/{inbox_id}/metrics/events`](https://developer.send.io/docs/api#am-inbox-metrics-events), [`GET /v0/inboxes/{inbox_id}/events`](https://developer.send.io/docs/api#am-inbox-events), [`GET /v0/pods`](https://developer.send.io/docs/api#am-list-pods), [`GET /v0/pods/{pod_id}/inboxes`](https://developer.send.io/docs/api#am-pod-list-inboxes), [`GET /v0/pods/{pod_id}/inboxes/search`](https://developer.send.io/docs/api#am-pod-search-inboxes), [`GET /v0/pods/{pod_id}/threads`](https://developer.send.io/docs/api#am-pod-list-threads), [`GET /v0/pods/{pod_id}/threads/search`](https://developer.send.io/docs/api#am-pod-search-threads), [`GET /v0/pods/{pod_id}/drafts`](https://developer.send.io/docs/api#am-pod-list-drafts), [`GET /v0/pods/{pod_id}/lists/{direction}/{type}`](https://developer.send.io/docs/api#am-pod-list-entries), [`GET /v0/pods/{pod_id}/webhooks`](https://developer.send.io/docs/api#am-pod-list-webhooks), [`GET /v0/pods/{pod_id}/domains`](https://developer.send.io/docs/api#am-pod-list-domains), [`GET /v0/pods/{pod_id}/metrics/events`](https://developer.send.io/docs/api#am-pod-metrics-events), [`GET /v0/pods/{pod_id}/api-keys`](https://developer.send.io/docs/api#am-pod-list-api-keys), [`GET /v0/domains`](https://developer.send.io/docs/api#am-list-domains), [`GET /v0/webhooks`](https://developer.send.io/docs/api#am-list-webhooks), [`GET /v0/lists/{direction}/{type}`](https://developer.send.io/docs/api#am-list-entries), [`GET /v0/metrics/events`](https://developer.send.io/docs/api#am-metrics-events), [`GET /v0/api-keys`](https://developer.send.io/docs/api#am-list-api-keys).

### Inbox threads: limit and before (a time)

`limit` (1 to 200, default 50) sets the page size. `before` is a time (ISO 8601): only threads whose last message is older. For the next page, send the last thread's `last_message_at`. The answer: `{ "object": "list", "has_more": true, "data": [...] }`, threads with the newest last message first.

- Stop when `has_more` is false. A `limit` outside 1 to 200 is ignored (the page holds 50).

```text
GET /inbox/threads?limit=50
GET /inbox/threads?limit=50&before=<last_message_at of the last thread>   # while has_more is true
```

Endpoints: [`GET /inboxes/{id}/threads`](https://developer.send.io/docs/api#list-inbox-threads), [`GET /inbox/threads`](https://developer.send.io/docs/api#list-all-inbox-threads).

## Timestamps

All timestamps are RFC 3339 strings in UTC, for example 2026-11-10T14:40:35.840078+00:00. The number of fraction digits and the UTC suffix (+00:00 or Z) differ between endpoints, so parse them as RFC 3339 rather than with a fixed pattern.

| Where | Form | Example |
| --- | --- | --- |
| Emails, contacts, suppressions, streams, senders, domains and most other resources; webhook events and their delivery attempts | `+00:00`, up to 6 fraction digits | `2026-11-19T10:11:12.123456+00:00` |
| Email events (`GET /emails/{id}/events`, `GET /emails/events`) and an email's `bounce.bounced_at` and `bounces[].bounced_at` | `Z`, 3 fraction digits | `2026-11-19T10:11:12.123Z` |
| `GET /usage`: `resets_at` | `Z`, whole seconds | `2026-11-20T00:00:00Z` |
| `GET /reputation`: `since` and `evaluated_at` | `Z`, up to 6 fraction digits | `2026-11-19T10:11:12.123456Z` |
| Attachments of sent and received emails: `expires_at` of the download link | `Z`, up to 9 fraction digits | `2026-11-19T11:11:12.123456789Z` |
| Webhook payloads: the top-level `created_at` | `Z`, up to 9 fraction digits | `2026-11-19T10:11:12.123456789Z` |
| Webhook payloads: `data` of `contact.*` and `topic.*` events, as in Resend's contact webhooks | `Z`, 3 fraction digits | `2026-11-19T10:11:12.123Z` |
| Webhook payloads: `data` of the other events, the email, domain or suppression as the API returns it. These end in `Z` instead: `click.timestamp`, the `created_at` of `email.received`, and the times of a suppression added by a bounce or complaint | `+00:00`, up to 6 fraction digits | `2026-11-19T10:11:12.123456+00:00` |

Dates without a time, such as `bulk.day` in `GET /reputation`, are `YYYY-MM-DD`. The provider-compatible routes keep their provider's format, for example RFC 2822 dates on the Mailgun routes.

## Emails

Send transactional email, one at a time or in batches, and look up what you sent.

### Send email

`POST /emails` (https://developer.send.io/docs/api#send-email)

Queue an email for delivery. The `from` address must be on a verified domain of your team. Returns the id of the new email. To send a saved transactional email, pass its `transactional_id`, the recipient and its `variables`: it sets the sender, subject and content.

Body:

- `from` (string): Sender address, `ada@acme.com` or `Ada <ada@acme.com>`. The domain must be verified. Required, except with `transactional_id` (which sets it, so it cannot be sent) or with a `template` that has a default From.
- `to` (string | string[], required): Recipient address or addresses. 1 to 50, counting `cc` and `bcc` too.
- `subject` (string): Subject line. Cannot contain line breaks. Required, except with `transactional_id` (which sets it) or with a `template` that has a default subject.
- `transactional_id` (string): Send a transactional email (`tx_...`, see Transactional emails): its From, subject, preview text, Reply-To and tracking, and the published version of its template. Pass the template's variables in `variables`. Cannot be combined with `template`, `html`, `text`, `react`, `from`, `subject`, `reply_to`, `sender_id` or `template_engine` (422).
- `html` (string): HTML body. You must send `html` or `text` (unless you use `template` or `transactional_id`).
- `text` (string): Plain text body.
- `cc` (string | string[]): Cc recipients.
- `bcc` (string | string[]): Bcc recipients.
- `reply_to` (string | string[]): Reply-To address or addresses.
- `scheduled_at` (string): Send later. A full ISO 8601 timestamp with a time zone, such as `2026-10-08T09:00:00Z` or `2026-10-08T14:30:00+05:30`, or a relative time like `in 30 minutes`, `in 2 hours` or `in 3 days` (seconds up to weeks). A timestamp without a zone (`2026-10-08T09:00:00`) or a date alone is refused with 422. Must be in the future and at most 30 days ahead.
- `headers` (object): Custom headers as name/value strings: at most 50 headers, each value up to 2000 characters and without line breaks. Names may use letters, digits and dashes. From, To, Cc, Bcc, Subject, MIME-Version, Message-ID, Date, Received, Delivered-To, Authentication-Results, DKIM-Signature, Return-Path and any `Content-*`, `ARC-*` or `X-SES-*` header are reserved.
- `tags` (object[]): Tags to attach to the email, at most 50. They come back in webhook events.
- `tags[].name` (string, required): Tag name. Letters, digits, `_` and `-`, up to 256 characters.
- `tags[].value` (string, required): Tag value. Same rules as the name.
- `attachments` (object[]): Files to attach. There is no limit on how many: only the size counts. The whole message must stay under 40 MB as sent, with each attachment base64 encoded (about a third larger than the file). At most 10 attachments may be given by `path`.
- `attachments[].filename` (string, required): File name shown to the recipient.
- `attachments[].content` (string): File content, base64 encoded. Send `content` or `path`.
- `attachments[].path` (string): A public URL we download the file from (up to 30 MB per file; all of an email's files must download within 15 seconds).
- `attachments[].content_type` (string): MIME type. Detected from the content when left out.
- `attachments[].content_id` (string): Content-ID for inline images (`<img src="cid:...">`). Makes the attachment inline. Under 128 characters.
- `template` (object): Deprecated: send with `transactional_id`. Still accepted for now.
- `template_engine` (string): `simple` or `handlebars`. With `template`, renders the template with this engine instead of its own. Without `template`, renders the inline `subject`, `html` and `text` with `variables`.
- `variables` (object): Values for the template of a `transactional_id`, or for an inline body. Without `template_engine` the `simple` engine fills `{{NAME}}` and `{{{NAME}}}` (strings and numbers only); with `template_engine: "handlebars"` (or a Handlebars template) values may be nested objects and arrays.
- `topic_id` (string): Topic the email belongs to. Recipients who opted out of the topic are skipped. If nobody is left, the email is recorded as failed and not sent.
- `metadata` (object): Your own key/value pairs, all strings: at most 50 keys, keys up to 100 characters, values up to 1000, 10 KB in all. Returned on the email, in its events and webhooks, and searchable with `metadata[key]=value` on List emails.
- `track_opens` (boolean): Open tracking for this email only. `false` leaves the tracking pixel out even when the domain tracks opens. `true` adds it only when the domain's tracking subdomain is active (or the sender is a free mailbox: then on its pool's shared tracking host); otherwise it is ignored. Leave it out to follow the domain's setting (with `transactional_id`, the transactional email's `track_opens`). A free mailbox's sends are not tracked unless the send sets `true`.
- `track_clicks` (boolean): Click tracking for this email only. `false` leaves links as written even when the domain tracks clicks. `true` rewrites them only when the domain's tracking subdomain is active (or the sender is a free mailbox: then on its pool's shared tracking host); otherwise it is ignored. Leave it out to follow the domain's setting (with `transactional_id`, the transactional email's `track_clicks`). A free mailbox's sends are not tracked unless the send sets `true`.
- `batch_id` (string): Add the email to a batch: the `batch_id` that Send batch emails returned, or your own id (1 to 100 letters, digits or `. _ : @ + = ~ -`). Retrieve batch counts its emails by status; Cancel batch cancels the ones still scheduled.
- `stream` (string): Message stream id (see Streams). Default `outbound`. The stream must exist, not be archived, and not be the inbound stream. Stored on the email; a broadcast stream sends on the bulk lane.
- `sender_id` (string): A sender's id (see Senders). Fills `from` (name and address) and `reply_to` when you leave them out. The From domain must still be a verified domain of your team.

Example request body:

```json
{
  "from": "Ada <ada@acme.com>",
  "to": [
    "grace@example.com"
  ],
  "subject": "Your receipt",
  "html": "<p>Thanks for your order.</p>",
  "tags": [
    {
      "name": "category",
      "value": "receipt"
    }
  ],
  "metadata": {
    "order_id": "A-1042",
    "customer_id": "c_981"
  }
}
```

- Send an `Idempotency-Key` header (1 to 256 characters) to make retries safe: the same key and body within 24 hours returns the first response. A key still in use, or reused with a different body, answers 409.
- send.io extension: `X-Sendio-Redact: KEY1,KEY2` stores those template variables as null in the saved copy of the email.
- Test addresses `delivered@send.io`, `bounced@send.io`, `complained@send.io` and `suppressed@send.io` (and the `@resend.dev` versions, with optional `+label`) simulate outcomes. `onboarding@send.io` can send only to test recipients; an email from it with any other recipient is refused (403).
- `react` is not rendered by the API. Render it to HTML in your code (the Resend SDKs do this for you).
- send.io extension: `topic_id` for topic opt-out gating.
- send.io extension: `metadata`. Unlike `tags` it takes any characters. A value that is not a string, or a request over the limits, answers 422 `validation_error`.
- send.io extension: `track_opens` and `track_clicks` override the domain's open and click tracking for one email. Broadcasts keep their own `tracking` setting. Tracking is per email: with several recipients an open or click lists them all (see List email events). For per-recipient tracking send one email per recipient, for example with Send batch emails.
- send.io extension: `batch_id`. See Retrieve batch and Cancel batch.
- send.io extension: `template_engine` and inline `variables`, for example `{"template_engine": "handlebars", "subject": "{{count}} item{{#if (gt count 1)}}s{{/if}}", "html": "{{#each items}}<li>{{name}}</li>{{/each}}", "variables": {"count": 2, "items": [{"name": "Tea"}, {"name": "Cake"}]}}`. See Create template for the template language.
- send.io extension: `stream` (message streams, like Postmark's `MessageStream`) and `sender_id` (sender identities). Sends that name a stream other than `outbound`, or a `sender_id`, take the database path rather than the low-latency hot path.
- send.io extension: `transactional_id`. Example: `{"transactional_id": "tx_2hX9Yq1bVv0kq3W4m8sZJt1aB7c", "to": "ann@example.com", "variables": {"CODE": "123456"}}`. The email uses the template's published version at send time, so a republish reaches every send within 10 seconds, as does an edit to the transactional email. `cc`, `bcc`, `headers`, `tags`, `metadata`, `attachments`, `scheduled_at`, `track_opens`, `track_clicks`, `stream` and `topic_id` work as on any send. The email is stored with `transactional_id`, `template_id` and its version, so it also counts in the template's stats.
- Errors with `transactional_id`: 404 `not_found` for an unknown or deleted transactional email; 422 `validation_error` when its template was deleted or has no published version (the message names the template), when the id is not a `tx_...` id, when a field the transactional email sets is also sent, or when a variable the template needs has no value. In a `permissive` batch each of these is reported for its item.
- One-time codes: send them with this endpoint (not the batch one) and a tag such as `priority=otp`, keep tracking off (the default for a transactional email, or `track_opens: false, track_clicks: false`; with both off the send stays on the low-latency path even when the domain has a tracking subdomain), and send `X-Sendio-Redact: CODE` so the code is not stored with the email.
- A verified single sender (confirmed by email) on a domain you have not verified cannot be sent from: send.io signs mail only for verified domains, and From addresses on other domains would fail DMARC alignment. The 403 says so; verify the domain or use the sender as `reply_to`.
- Errors: 402 `insufficient_credits` when your credit balance is too low (buy credits in Billing); 403 `validation_error` when the domain is not verified; 422 `validation_error` for an unknown, archived or inbound `stream` or an unknown `sender_id`; 429 `daily_quota_exceeded` when a daily limit is used up: the one until your first credit purchase, or, for new paid accounts, 5,000 emails a day for the first 7 days after the first purchase (by default). It resets at 00:00 UTC.

### Send batch emails

`POST /emails/batch` (https://developer.send.io/docs/api#send-batch-emails)

Send up to 100 emails in one request. The body is an array of email objects with the same fields as Send email.

Body:

- `[]` (object[], required): 1 to 100 email objects. Each takes the fields of Send email, except `attachments`.

Example request body:

```json
[
  {
    "from": "Ada <ada@acme.com>",
    "to": [
      "grace@example.com"
    ],
    "subject": "Hello Grace",
    "html": "<p>Hi Grace</p>"
  },
  {
    "from": "Ada <ada@acme.com>",
    "to": [
      "alan@example.com"
    ],
    "subject": "Hello Alan",
    "html": "<p>Hi Alan</p>"
  }
]
```

- send.io extension: `batch_id` in the response. Every email of the request is stored with it. If every item sends the same `batch_id`, that id is used; otherwise one is generated, and items that name another batch keep their own.
- `track_opens`, `track_clicks`, `batch_id`, `stream`, `sender_id` and `transactional_id` (with `variables`) are accepted on batch items.
- Header `x-batch-validation`: `strict` (default) fails the whole batch on the first invalid email. `permissive` sends the valid ones and adds an `errors` array of `{ index, error }` to the response.
- Attachments are not allowed in batch emails.
- In `strict` mode a batch your credit balance cannot cover is refused whole with 402 `insufficient_credits`. In `permissive` mode the emails the balance cannot cover may instead be listed in `errors` with that 402 while the others are sent.
- send.io extension: `scheduled_at` and `metadata` are accepted on batch items. Resend refuses `scheduled_at` in a batch; here an item with `scheduled_at` is scheduled, not sent now, so leave it out to send at once.
- Supports the `Idempotency-Key` header: a retry with the same key and body returns the first response, the same email ids and `batch_id`. A key still in use, or reused with a different body, answers 409.

### Send raw email

`POST /emails/raw` (https://developer.send.io/docs/api#send-raw-email)

Send a complete RFC 5322 (MIME) message you built yourself. Envelope recipients come from `to`, `cc` and `bcc`, or from the message's To, Cc and Bcc headers when you give none. The sender's domain must be verified.

Body:

- `raw` (string, required): The whole message, base64 encoded (headers and body). Up to 40 MB once decoded.
- `from` (string): Envelope sender. Defaults to the From header. Its domain, and the From header's, must be verified domains of your team.
- `to` (string | string[]): Envelope recipients. 1 to 50 in all, counting `cc` and `bcc`. When `to`, `cc` and `bcc` are all left out, the To, Cc and Bcc headers are used.
- `cc` (string | string[]): Envelope Cc recipients (only recorded as cc; the message's headers are sent as written).
- `bcc` (string | string[]): Envelope Bcc recipients.
- `tags` (object[]): Tags, as on Send email.
- `metadata` (object): Metadata, as on Send email.
- `scheduled_at` (string): Send later, as on Send email.
- `batch_id` (string): Join a batch, as on Send email.
- `track_opens` (boolean): `true` adds the open pixel (when the domain's tracking subdomain is active). Raw messages are never tracked unless you ask.
- `track_clicks` (boolean): `true` rewrites links for click tracking (when the domain's tracking subdomain is active).

Example request body:

```json
{
  "raw": "RnJvbTogQWRhIDxhZGFAYWNtZS5jb20+DQpUbzogZ3JhY2VAZXhhbXBsZS5jb20NClN1YmplY3Q6IEhlbGxvDQpNSU1FLVZlcnNpb246IDEuMA0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCkhpIEdyYWNlDQo=",
  "to": [
    "grace@example.com"
  ],
  "tags": [
    {
      "name": "category",
      "value": "raw"
    }
  ]
}
```

- send.io extension.
- Also takes `multipart/form-data`: the message as a file field `message` (or `raw`, `file`), and `to`, `cc`, `bcc` (repeated or comma-separated), `from`, `scheduled_at`, `batch_id`, `track_opens`, `track_clicks` as fields; `tags` and `metadata` as JSON strings, or `tag=name:value` repeated.
- The message is sent as written except: `Message-ID` is replaced with send.io's (`<email_id@domain>`, returned as `message_id` on Retrieve email), `Bcc` and `Return-Path` are dropped, a `DKIM-Signature` by your sending domain is removed (send.io signs the message again), and `Date` and `From` are added if missing.
- The parsed subject, text and HTML bodies, attachments and other headers are stored like any email: Retrieve email, List attachments and the email's events show them.
- With `track_opens` or `track_clicks` true the message is rebuilt from its parsed parts (text, HTML, attachments, custom headers) so the pixel and links can be added.
- The "Sent with Sendio" line that the Free daily limit adds to other emails ([Credits and limits](https://developer.send.io/docs/credits)) is never added to a raw message: it is sent as written, so signed or encrypted bodies, calendar invites and AMP parts stay intact.
- Suppressions, the allow-list, quotas, scheduling, events and webhooks work as for Send email. Raw sends always take the database path (not the low-latency hot path).
- Supports the `Idempotency-Key` header. Sending-only API keys may use it.
- Errors: 422 `validation_error` when `raw` is not base64 of a valid message or has no From; 403 `validation_error` when a domain is not verified.

### Retrieve email

`GET /emails/{email_id}` (https://developer.send.io/docs/api#retrieve-email)

Get one sent email, including its body, recipients and latest status.

Path parameters:

- `email_id` (string, required): The email id.

- `metadata` is the object you sent (`{}` when none).
- send.io extension: `bounces` lists every recipient that bounced, with why (`[]` when none): `recipient`, `bounced_at`, `type` (Permanent or Transient), `subtype` (the provider's, such as General, NoEmail, MailboxFull), `class` (hard, soft or undetermined), `smtp_code` (550), `enhanced_code` (5.1.1), `response` (the recipient server's reply, as it was given) and `suppressed` (the address is now on your suppression list). Example: `{"recipient":"grace@example.com","bounced_at":"2026-10-07T09:15:24.210Z","type":"Permanent","subtype":"General","class":"hard","smtp_code":"550","enhanced_code":"5.1.1","response":"smtp; 550 5.1.1 <grace@example.com>: Recipient address rejected: User unknown","suppressed":true}`.
- `last_event` is one of queued, scheduled, sent, delivered, delivery_delayed, bounced, complained, opened, clicked, failed, suppressed, canceled.
- send.io adds `message_id`, the Message-ID header the email was sent with, and `stream`, the message stream it was sent on (also in its webhook events' `data.stream`).
- send.io extension: `transactional_id` on an email sent from a transactional email (left out for every other email), also in its webhook events' `data.transactional_id`.
- send.io extension: `track_opens` and `track_clicks` are whether this email's opens and clicks are tracked, `true` or `false` (never null): the send's own flags, else the domain's switches, and `false` without an active tracking host. A free mailbox's email is tracked only where the send set the flag `true`. A broadcast email follows its broadcast's tracking setting. List emails returns the flags as sent (null when not set).

### List emails

`GET /emails` (https://developer.send.io/docs/api#list-emails)

List sent emails, newest first. Filters narrow the list; without any, every email is listed.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. Default 20.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.
- `to` (string): Only emails with this recipient (to, cc or bcc). Case does not matter.
- `from` (string): Only emails from this sender address, or from any address on this domain (`acme.com`).
- `subject` (string): Only emails whose subject contains this text. Case does not matter.
- `tag` (string): Only emails with this tag: `name` or `name:value`. Repeat the parameter to require several tags.
- `metadata[key]` (string): Only emails whose metadata has this key with this value. `metadata.key=value` works too. Several keys must all match.
- `status` (string): Only emails whose `last_event` is this, or one of a comma-separated list (`bounced,complained`).
- `template_id` (string): Only emails sent from this template (id or alias). Includes the sends of transactional emails that use it.
- `transactional_id` (string): Only emails sent from this transactional email (`tx_...`), deleted ones included. Another value is a 422 `invalid_parameter`.
- `broadcast_id` (string): Only the emails of this broadcast.
- `batch_id` (string): Only the emails of this batch.
- `stream` (string): Only emails sent on this message stream, or one of a comma-separated list (`outbound,broadcast`).
- `created_after` (string): Only emails created at or after this time: ISO 8601, a date, or Unix seconds.
- `created_before` (string): Only emails created before this time: ISO 8601, a date, or Unix seconds.

Response fields:

- `data[].stream` (string): The message stream the email was sent on (`outbound` unless the send named another).
- `data[].transactional_id` (string): The transactional email (`tx_...`) it was sent from. Present only on emails sent with `transactional_id`.

- List items return `cc`, `bcc` and `reply_to` as arrays (empty when none), the same as Retrieve email, plus `tags` and `template_id`.
- `from` is written as it was sent: a display name with a comma or other special character is in double quotes (`"Acme, Inc." <ada@acme.com>`).
- send.io extension: `bounce` on every item, null unless a recipient bounced. It describes the first recipient that bounced (`recipient`, `bounced_at`, `type`, `subtype`, `class`, `smtp_code`, `enhanced_code`) and `recipients`, how many bounced. Retrieve email's `bounces` has every bounced recipient with the server's full response.
- send.io extension: `batch_id`, `track_opens` and `track_clicks` (as sent, null when not set) on every item. Retrieve email returns the effective tracking instead, `true` or `false`.
- send.io extension: the filters, and `metadata` on every item. Filters combine with `limit`, `after` and `before` paging. Example: `GET /emails?metadata[order_id]=A-1042&status=bounced`.
- send.io extension: `transactional_id` on the items sent from a transactional email (left out on the others).

### List email events

`GET /emails/{email_id}/events` (https://developer.send.io/docs/api#list-email-events)

The timeline of one email, oldest first: queued or scheduled, sent, delivered, delivery_delayed, bounced, complained, opened, clicked, failed, suppressed, canceled and unsubscribed, per recipient, with detail. Full event history covers the last 30 days (see the notes).

Path parameters:

- `email_id` (string, required): The email id.

- send.io extension. `type` is one of queued, scheduled, sent, delivered, delivery_delayed, bounced, complained, opened, clicked, failed, suppressed, canceled, unsubscribed.
- `detail` holds what is known: `bounce_class` (hard, soft or undetermined), `bounce_type`, `bounce_subtype`, `smtp_code`, `reason`, `response` (the SMTP reply), `provider` for delivery events; `url`, `ip` and `user_agent` for opens and clicks; `unsubscribe_source` (`list_unsubscribe` or `unsubscribe_link`); plus the email's `tags` and `metadata`.
- A bounced event with `after_delivery` set to `true` is a soft bounce notice with no SMTP code that arrived after the recipient was delivered (an auto-reply or out-of-office message, as SES reports it). It is listed as reported but changes nothing: the email and the recipient stay delivered, and no `email.bounced` webhook is sent for it.
- Events about the whole email (queued, scheduled, canceled, and a failed send) and opens and clicks name the `recipient` only when the email had one recipient; otherwise `recipient` is empty. A delivery can be deferred several times: each attempt is an event.
- Opens and clicks also list `recipients`: every recipient of the email (to, then cc and bcc). The tracking pixel and links are per email, not per recipient, so an open or click of an email sent to several people cannot say which of them it was. For per-recipient opens and clicks, send one email per recipient (Send batch emails does this in one request).
- Every event is kept for 30 days; after that the email's delivery state, bounce detail, opens, clicks and unsubscribes are still listed.

### List events

`GET /emails/events` (https://developer.send.io/docs/api#list-team-email-events)

Your team's email events, newest first, across all emails. Filter by type, recipient, email, tag, stream and time, and page with the cursor.

Query parameters:

- `type` (string): Only events of this type, or a comma-separated list (`opened,clicked`). The `email.` prefix is optional.
- `recipient` (string): Only events for this recipient address. Case does not matter. Events about the whole email (queued, scheduled, canceled) are not matched, nor are opens and clicks of an email with several recipients (they name no single recipient; see `recipients`).
- `email_id` (string): Only the events of this email.
- `tag` (string): Only events of emails with this tag: `name` or `name:value`. Repeat to require several.
- `stream` (string): Only events of emails sent on this message stream, or a comma-separated list (`outbound,product-updates`).
- `after` (string): Only events at or after this time: ISO 8601, a date, or Unix seconds.
- `before` (string): Only events before this time: ISO 8601, a date, or Unix seconds.
- `limit` (number): Number of events to return, from 1 to 300. Default 50.
- `cursor` (string): The `next_cursor` of the previous page.

- send.io extension. Events and `detail` are as in List email events; each item also has a summary of its `email`.
- Events from the last 30 days.

### Update email

`PATCH /emails/{email_id}` (https://developer.send.io/docs/api#update-email)

Change when a scheduled or queued email is sent. Works only while the email has not been picked up for sending.

Path parameters:

- `email_id` (string, required): The email id.

Body:

- `scheduled_at` (string, required): New send time, in the same forms as on Send email: a full ISO 8601 timestamp with a time zone (`2026-10-08T09:00:00Z`) or a relative time like `in 30 minutes`, `in 2 hours` or `in 3 days`. A timestamp without a zone is refused with 422. Must be in the future and at most 30 days ahead.

Example request body:

```json
{
  "scheduled_at": "in 1 hour"
}
```

- Returns 422 "Only an email that has not been leased can be rescheduled." once sending has started.

### Cancel email

`POST /emails/{email_id}/cancel` (https://developer.send.io/docs/api#cancel-email)

Cancel a scheduled or queued email before it is sent. Its recipients no longer count toward your quota.

Path parameters:

- `email_id` (string, required): The email id.

- Returns 404 if the email does not exist or has already been picked up for sending.

### Retrieve batch

`GET /emails/batches/{batch_id}` (https://developer.send.io/docs/api#retrieve-email-batch)

Count the emails of a batch by status.

Path parameters:

- `batch_id` (string, required): The batch id: returned by Send batch emails, or your own.

- send.io extension. `counts` is keyed by `last_event`. `cancelable` is how many are still scheduled and not yet picked up for sending. `scheduled_at` is the earliest one.
- Returns 404 when no email of your team has this batch id.

### Cancel batch

`POST /emails/batches/{batch_id}/cancel` (https://developer.send.io/docs/api#cancel-email-batch)

Cancel every email of a batch that is still scheduled. Their recipients no longer count toward your quota.

Path parameters:

- `batch_id` (string, required): The batch id.

- send.io extension. Emails already queued for immediate sending, being sent or sent are left alone and counted in `not_canceled`. Calling it again cancels nothing more.
- Returns 404 when no email of your team has this batch id.

### Email metrics

`GET /emails/metrics` (https://developer.send.io/docs/api#email-metrics)

Counts and rates for the emails you sent in a period, by period and optionally broken down by domain, email, broadcast, tag, sender or mailbox provider.

Query parameters:

- `start_date` (string): Start of the period: a date (`2026-10-01`) or an ISO 8601 timestamp, in `timezone`. Default: 7 days before `end_date`.
- `end_date` (string): End of the period. A bare date covers that whole day. Default: now.
- `timezone` (string): IANA time zone for the dates and periods. Default `UTC`.
- `granularity` (string): `hourly`, `daily` (default), `weekly` or `monthly`.
- `metrics[]` (string): Metrics to return (repeat or comma-separate). Default: all of received, sent, delivered, delivery_delayed, failed, suppressed, bounced, bounced_transient, bounced_permanent, bounced_undetermined, opened, unique_opened, clicked, unique_clicked, complained, unsubscribed and the rates delivery_rate, open_rate, click_rate, bounce_rate, complaint_rate, unsubscribe_rate.
- `dimensions[]` (string): Row breakdown: `period` (default), `domain`, `email`, `broadcast`, `tag` (name and value), `tag_name`, `sender` (from address), `mailbox_provider` and `stream` (message stream). Combine several, except email with broadcast and tag with tag_name.
- `stream[]` (string): Only emails sent on these message streams.
- `domain_id[]` (string): Only emails from these domains.
- `email_id[]` (string): Only these emails.
- `broadcast_id[]` (string): Only the emails of these broadcasts.
- `tag[]` (string): Only emails with any of these tags: `name` or `name:value`. With a tag dimension, only these tags make rows.
- `sender[]` (string): Only emails from any of these from addresses, or from any address on a bare domain (`acme.com`).
- `mailbox_provider[]` (string): Only emails whose first To recipient is at one of these providers: `gmail`, `outlook`, `yahoo`, `icloud`, `other`.

Response fields:

- `metrics` (string[]): The metrics in each row: the ones requested, or all 22 by default.
- `dimensions` (string[]): The row breakdown.
- `totals.received` (number): Count of received. Present when requested in `metrics[]` (all are by default).
- `totals.sent` (number): Count of sent. Present when requested in `metrics[]` (all are by default).
- `totals.delivered` (number): Count of delivered. Present when requested in `metrics[]` (all are by default).
- `totals.delivery_delayed` (number): Count of delivery delayed. Present when requested in `metrics[]` (all are by default).
- `totals.failed` (number): Count of failed. Present when requested in `metrics[]` (all are by default).
- `totals.suppressed` (number): Count of suppressed. Present when requested in `metrics[]` (all are by default).
- `totals.bounced` (number): Count of bounced. Present when requested in `metrics[]` (all are by default).
- `totals.bounced_transient` (number): Count of bounced transient. Present when requested in `metrics[]` (all are by default).
- `totals.bounced_permanent` (number): Count of bounced permanent. Present when requested in `metrics[]` (all are by default).
- `totals.bounced_undetermined` (number): Count of bounced undetermined. Present when requested in `metrics[]` (all are by default).
- `totals.opened` (number): Count of opened. Present when requested in `metrics[]` (all are by default).
- `totals.unique_opened` (number): Count of unique opened. Present when requested in `metrics[]` (all are by default).
- `totals.clicked` (number): Count of clicked. Present when requested in `metrics[]` (all are by default).
- `totals.unique_clicked` (number): Count of unique clicked. Present when requested in `metrics[]` (all are by default).
- `totals.complained` (number): Count of complained. Present when requested in `metrics[]` (all are by default).
- `totals.unsubscribed` (number): Count of unsubscribed. Present when requested in `metrics[]` (all are by default).
- `totals.delivery_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `totals.open_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `totals.click_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `totals.bounce_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `totals.complaint_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `totals.unsubscribe_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `data[].received` (number): Count of received. Present when requested in `metrics[]` (all are by default).
- `data[].sent` (number): Count of sent. Present when requested in `metrics[]` (all are by default).
- `data[].delivered` (number): Count of delivered. Present when requested in `metrics[]` (all are by default).
- `data[].delivery_delayed` (number): Count of delivery delayed. Present when requested in `metrics[]` (all are by default).
- `data[].failed` (number): Count of failed. Present when requested in `metrics[]` (all are by default).
- `data[].suppressed` (number): Count of suppressed. Present when requested in `metrics[]` (all are by default).
- `data[].bounced` (number): Count of bounced. Present when requested in `metrics[]` (all are by default).
- `data[].bounced_transient` (number): Count of bounced transient. Present when requested in `metrics[]` (all are by default).
- `data[].bounced_permanent` (number): Count of bounced permanent. Present when requested in `metrics[]` (all are by default).
- `data[].bounced_undetermined` (number): Count of bounced undetermined. Present when requested in `metrics[]` (all are by default).
- `data[].opened` (number): Count of opened. Present when requested in `metrics[]` (all are by default).
- `data[].unique_opened` (number): Count of unique opened. Present when requested in `metrics[]` (all are by default).
- `data[].clicked` (number): Count of clicked. Present when requested in `metrics[]` (all are by default).
- `data[].unique_clicked` (number): Count of unique clicked. Present when requested in `metrics[]` (all are by default).
- `data[].complained` (number): Count of complained. Present when requested in `metrics[]` (all are by default).
- `data[].unsubscribed` (number): Count of unsubscribed. Present when requested in `metrics[]` (all are by default).
- `data[].delivery_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `data[].open_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `data[].click_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `data[].bounce_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `data[].complaint_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `data[].unsubscribe_rate` (number): A fraction from 0 to 1, rounded to 4 places; 0 when the base is 0. Present when requested (all are by default).
- `data[].period` (string): The start of the period, with the `period` dimension. RFC 3339 with the offset of `timezone`, for example `2026-10-07T00:00:00+02:00`. Left out otherwise.
- `data[].domain_id` (string): With the `domain` dimension. Left out otherwise.
- `data[].domain_name` (string): With the `domain` dimension. Left out otherwise.
- `data[].email_id` (string): With the `email` dimension. Left out otherwise.
- `data[].broadcast_id` (string): With the `broadcast` dimension. Left out otherwise.
- `data[].broadcast_name` (string): With the `broadcast` dimension. Left out otherwise.
- `data[].tag` (string): With the `tag` dimension (`name:value`) or the `tag_name` dimension (the name). Left out otherwise.
- `data[].tag_name` (string): With the `tag` or `tag_name` dimension. Left out otherwise.
- `data[].tag_value` (string): With the `tag` dimension. Left out otherwise.
- `data[].sender` (string): With the `sender` dimension. Left out otherwise.
- `data[].mailbox_provider` (string): With the `mailbox_provider` dimension. Left out otherwise.
- `data[].stream` (string): With the `stream` dimension. Left out otherwise.

- send.io extension. Emails are counted by the time they were created; emails sent over SMTP are not counted. Answers are cached for a minute.
- Without `metrics[]`, `totals` and each row carry all 22 metrics. The example asked for three.
- Rows carry the keys of their dimensions: `period`, `domain_id` and `domain_name`, `email_id`, `broadcast_id` and `broadcast_name`, `tag` (`name:value`) with `tag_name` and `tag_value` (or `tag` = the name with `tag_name`), `sender`, `mailbox_provider`, `stream`.
- With a tag dimension an email with two tags counts in both rows and untagged emails make no row; `totals` still count every matching email once.
- `mailbox_provider` comes from the domain of the email's first To recipient: gmail (gmail.com, googlemail.com), outlook (outlook, hotmail, live, msn), yahoo (yahoo, ymail, rocketmail, aol), icloud (icloud.com, me.com, mac.com), else other. Custom domains hosted by Google Workspace or Microsoft 365 count as other.

### List tags

`GET /emails/tags` (https://developer.send.io/docs/api#list-email-tags)

The tags on emails you sent in a period, most used first, with how many emails carry each.

Query parameters:

- `start_date` (string): Start of the period (date or ISO 8601). Default: 30 days before `end_date`.
- `end_date` (string): End of the period. A bare date covers that whole day. Default: now.
- `timezone` (string): IANA time zone for the dates. Default `UTC`.
- `by` (string): `name_value` (default): one row per tag name and value. `name`: one row per tag name.
- `name` (string): Only tags with this name.
- `prefix` (string): Only tags whose name starts with this.
- `limit` (number): 1 to 1000. Default 100.

- send.io extension. Tags are not stored on their own: a tag exists while emails in the period carry it. `count` is the number of emails.

### List attachments

`GET /emails/{email_id}/attachments` (https://developer.send.io/docs/api#list-email-attachments)

List the attachments of a sent email. Each one has a signed download link valid for one hour.

Path parameters:

- `email_id` (string, required): The email id.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. All attachments are returned when left out.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

### Retrieve attachment

`GET /emails/{email_id}/attachments/{attachment_id}` (https://developer.send.io/docs/api#retrieve-email-attachment)

Get one attachment of a sent email, with a signed download link valid for one hour.

Path parameters:

- `email_id` (string, required): The email id.
- `attachment_id` (string, required): The attachment id.

### Create share link

`POST /emails/{email_id}/share` (https://developer.send.io/docs/api#share-email)

Create a public, read-only link that shows the email's subject, sender and body. The link expires.

Path parameters:

- `email_id` (string, required): The email id.

Body:

- `expires_in` (number | string): Lifetime in seconds, or a duration like `2h`. From 1 second to 48 hours. Default 24 hours.

Example request body:

```json
{
  "expires_in": "2h"
}
```

- send.io extension.

## Receiving emails

Email that arrives at your domains when receiving is turned on (the domain's MX record points at send.io). Webhooks send `email.received` as it arrives. A message may be up to 50 MB, attachments included; the MX refuses a larger one at once with `552 5.3.4`, so the sender gets a bounce instead of the mail going missing.

### List received emails

`GET /emails/receiving` (https://developer.send.io/docs/api#list-received-emails)

List received emails, newest first. Items carry the sender, recipients and subject; retrieve one for its body.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. All received emails are returned when left out.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

### Retrieve received email

`GET /emails/receiving/{email_id}` (https://developer.send.io/docs/api#retrieve-received-email)

Get one received email with its HTML and text bodies, headers and attachments.

Path parameters:

- `email_id` (string, required): The received email id.

Query parameters:

- `html_format` (string): Only `cid` (inline images referenced by Content-ID) is available, which is also the default.

- Returns 403 `email_above_quota` for mail that arrived while the team was over its quota: it is stored, but its content cannot be read.
- send.io extension: `stored` is false when inbound routes matched and none of them stored the message (it is not listed and has no inbox thread, but can be retrieved and retried). `routing` lists each run of the routes (on receipt and on every retry) with the routes that matched and what each action did.

### List received attachments

`GET /emails/receiving/{email_id}/attachments` (https://developer.send.io/docs/api#list-received-attachments)

List the attachments of a received email. Each one has a signed download link valid for one hour.

Path parameters:

- `email_id` (string, required): The received email id.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. All attachments are returned when left out.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

### Retry inbound routes

`POST /emails/receiving/{email_id}/retry` (https://developer.send.io/docs/api#retry-received-email)

Run the inbound routes again for a received email: `forward_url` actions deliver the message again (a new delivery), `forward_email` actions send it again, and a `store` action makes a forward-only message visible.

Path parameters:

- `email_id` (string, required): The received email id.

Body:

- `route_id` (string): Run only this route's actions, whether it matches the message or not. Left out: every enabled route is evaluated again.

Example request body:

```json
{
  "route_id": "6d2b9f4a-1c3e-4a5b-8d7f-0e9c8b7a6f5e"
}
```

- The body is optional. Each run is recorded in the email's `routing` (see Retrieve received email).

### Retrieve received attachment

`GET /emails/receiving/{email_id}/attachments/{attachment_id}` (https://developer.send.io/docs/api#retrieve-received-attachment)

Get one attachment of a received email, with a signed download link valid for one hour.

Path parameters:

- `email_id` (string, required): The received email id.
- `attachment_id` (string, required): The attachment id.

## Inbound routes

Rules for mail arriving at your receiving domains and inboxes: forward it to a URL with the full parsed message, forward it to another address, store it, or stop. Routes run by priority (lower first), then creation time.

### Create inbound route

`POST /inbound/routes` (https://developer.send.io/docs/api#create-inbound-route)

Create a route. The response includes the signing secret used to sign `sendio` deliveries of its `forward_url` actions.

Body:

- `match` (object, required): When the route applies. Every condition given must hold. `recipient`: an address or glob (`support@acme.com`, `*@acme.com`; `*` and `?`, case-insensitive). `recipient_regex`: a regular expression (RE2, case-insensitive). A recipient condition holds when any recipient of the message at your domains matches.
- `match.header` (object): `{name, pattern}` (glob) or `{name, regex}`: holds when any value of that header matches.
- `match.catch_all` (boolean): `true` matches every message. Cannot be combined with other conditions.
- `actions` (object[], required): 1 to 10 actions, run in order.
- `actions[].type` (string, required): `forward_url`, `forward_email`, `store` or `stop`. `stop` must be last: no later route runs.
- `actions[].url` (string): forward_url: public HTTPS URL that receives the message.
- `actions[].format` (string): forward_url: payload format. `sendio` (default): the JSON below, signed with `svix-*` headers using the route's signing secret. Provider inbound formats are added as the compatible APIs ship them.
- `actions[].options` (object): forward_url: `basic_auth` ({username, password}) or `bearer_token`, `backup_endpoint`, `backup_after_attempts`, `backup_basic_auth` (as for webhooks), and for `sendio` `attachments`: `auto` (content inline up to 2 MB each, 10 MB per message, download links for larger ones; default) or `url` (links only). Secrets are stored encrypted and returned as `********`.
- `actions[].headers` (object): forward_url: custom request headers, as for webhooks.
- `actions[].address` (string): forward_email: the address the message is re-sent to.
- `priority` (number): 0 to 1000000, lower runs first. Default 0.
- `description` (string): Up to 500 characters.
- `enabled` (boolean): Default true. Disabled routes are skipped.

Example request body:

```json
{
  "priority": 10,
  "description": "Support mail to the helpdesk",
  "match": {
    "recipient": "support@acme.com"
  },
  "actions": [
    {
      "type": "forward_url",
      "url": "https://acme.com/inbound",
      "options": {
        "basic_auth": {
          "username": "sendio",
          "password": "s3cret"
        }
      }
    },
    {
      "type": "store"
    }
  ]
}
```

- When no route matches, a message is stored as usual. When routes match, it is stored (inbox thread, Receiving emails list, `email.received` webhook) only if one of them has a `store` action.
- forward_url deliveries use the webhook delivery system: success is any HTTP 2xx response (200 to 299), failures are retried with the same backoff (8 attempts over about 28 hours), and each delivery has a stable `svix-id`.
- `sendio` payload: `{type: "inbound.email", created_at, data}` where data has `email_id`, `route`, `message_id`, `in_reply_to`, `references`, `from` and `to`/`cc`/`reply_to` (`{email, name}`), `subject`, `date`, `text`, `html`, `stripped_text`, `stripped_html`, `stripped_signature`, `headers` (`[{name, value}]` in order), `attachments` (`id`, `filename`, `content_type`, `content_disposition`, `content_id`, `size`, `sha256`, `content` in base64 when inline, `download_url` and `expires_at` always), `envelope` (`from`, `to`), `auth` (`spf`, `dkim`, `dmarc`, `results`), `spam` (`is_spam`, `verdict`, `score`, `reasons`), `size` and `received_at`.
- forward_email re-sends the message from your team: From is the recipient address when its domain is a verified sending domain (else `forwarding@` your first one), Reply-To the original sender, with the `X-Sendio-Forwarded-Id` header and the tag `inbound_forward`. Mail that send.io forwarded already, or sent to the target itself, is not forwarded again. It counts toward your sending quota.
- A team can have up to 100 routes.

### List inbound routes

`GET /inbound/routes` (https://developer.send.io/docs/api#list-inbound-routes)

List every route in the order they run (priority, then creation time). Signing secrets are left out.

### Retrieve inbound route

`GET /inbound/routes/{route_id}` (https://developer.send.io/docs/api#retrieve-inbound-route)

Get one route, including its signing secret.

Path parameters:

- `route_id` (string, required): The route id.

### Update inbound route

`PATCH /inbound/routes/{route_id}` (https://developer.send.io/docs/api#update-inbound-route)

Change a route. Fields given replace the stored ones; `actions` replaces the whole list.

Path parameters:

- `route_id` (string, required): The route id.

Body:

- `priority` (number): 0 to 1000000, lower runs first.
- `description` (string): Up to 500 characters.
- `enabled` (boolean): Disabled routes are skipped.
- `match` (object): Replaces the match (see Create inbound route).
- `actions` (object[]): Replaces the actions. Send an action's `id` back to keep it (and its masked secrets, sent back as `********`); actions without an id are new.

Example request body:

```json
{
  "enabled": false
}
```

### Delete inbound route

`DELETE /inbound/routes/{route_id}` (https://developer.send.io/docs/api#delete-inbound-route)

Delete a route. Deliveries still waiting for a retry are dropped.

Path parameters:

- `route_id` (string, required): The route id.

### Test inbound routes

`POST /inbound/routes/test` (https://developer.send.io/docs/api#test-inbound-routes)

Show which routes a message with these recipients and headers would match, the actions that would run, and whether it would be stored. Nothing is sent.

Body:

- `recipient` (string | string[], required): The recipient address (or `recipients`, a list).
- `headers` (object): Headers of the sample message, as `{name: value}` or `{name: [values]}`.

Example request body:

```json
{
  "recipient": "support@acme.com",
  "headers": {
    "X-Priority": "urgent"
  }
}
```

### List route deliveries

`GET /inbound/routes/{route_id}/deliveries` (https://developer.send.io/docs/api#list-inbound-deliveries)

List the route's `forward_url` deliveries, newest first, with their status (`pending`, `success`, `failed`).

Path parameters:

- `route_id` (string, required): The route id.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. Default 20.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.

### Retrieve route delivery

`GET /inbound/routes/{route_id}/deliveries/{delivery_id}` (https://developer.send.io/docs/api#retrieve-inbound-delivery)

Get one `forward_url` delivery of the route, with its status and the payload that was posted.

Path parameters:

- `route_id` (string, required): The route id.
- `delivery_id` (string, required): The delivery id (msg_...).

Response fields:

- `next_attempt_at` (string | null): When the next retry is due while the delivery is `pending`, or null.

### List delivery attempts

`GET /inbound/routes/{route_id}/deliveries/{delivery_id}/attempts` (https://developer.send.io/docs/api#list-inbound-delivery-attempts)

List the HTTP attempts of one delivery, newest first. `GET /inbound/routes/{route_id}/deliveries/{delivery_id}` returns the delivery itself.

Path parameters:

- `route_id` (string, required): The route id.
- `delivery_id` (string, required): The delivery id (msg_...).

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. Default 20.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.

## Domains

Add and verify the domains you send from, and manage their tracking settings.

### Create domain

`POST /domains` (https://developer.send.io/docs/api#create-domain)

Add a domain. The response lists the DNS records to add at your DNS provider. Verification starts right away and has a 72 hour deadline.

Body:

- `name` (string, required): Domain name, such as `acme.com` or `mail.acme.com`. Labels that start with `xn--` must be valid punycode.
- `region` (string): Sending region: `us-east-1` (default), `eu-west-1`, `sa-east-1` or `ap-northeast-1`.
- `custom_return_path` (string): Subdomain used for the return path (bounce) address. One DNS label: starts with a letter, then letters, digits and dashes, up to 63 characters. Capitals are lowercased. Default `send`. It cannot be changed later.
- `receiving` (boolean): Also receive mail on this domain. Adds an MX record to set up. Default false.
- `capabilities` (object): Resend's form of the same: `{ sending: "enabled", receiving: "enabled" | "disabled" }`. Sending cannot be disabled.
- `tls` (string): `opportunistic` (default). `enforced` is not available yet and returns 422.
- `open_tracking` (boolean): Track opens for email sent from this domain.
- `click_tracking` (boolean): Track link clicks for email sent from this domain.
- `tracking_subdomain` (string): Subdomain used for tracking links, such as `links`. A single DNS label. Adds a CNAME record to set up. Left out while `open_tracking` or `click_tracking` is true, it defaults to `links` (`track` when the return path is `links`): opens and clicks are only counted through a tracking subdomain.

Response fields:

- `dns_provider` (string | null): The DNS provider the domain's zone is hosted at, when send.io recognises it.
- `dns_zone` (string): The DNS zone the domain lives in. Record `host` values are relative to it.
- `dns_zone_detected` (boolean): Whether send.io found the zone in DNS. When false, `dns_zone` is the domain name itself and record names are given in full.
- `verification_deadline_at` (string | null): When verification gives up, or null when no check is running.
- `last_checked_at` (string | null): When the DNS records were last checked, by verify or automatically, or null before the first check.
- `tracking_subdomain` (string | null): The branded tracking subdomain, or null.
- `sending_setup` (object | null): Null in the usual case. Set while the domain's DNS records are all found but send.io has not finished its own sending set-up for it: `{ status, message }`, where `status` is `retrying` (we are trying again, nothing to do) or `needs_attention` (contact support), and `message` says the same in words. The domain stays `pending` and is not removed at `verification_deadline_at` while this is set.
- `records[].name` (string): The record name relative to the domain (`@` for the domain itself).
- `records[].host` (string): The record name relative to `dns_zone`: what you type into your DNS provider.
- `records[].full_name` (string): The complete record name.
- `records[].priority` (number): MX records only.

Example request body:

```json
{
  "name": "acme.com",
  "region": "us-east-1",
  "click_tracking": true,
  "tracking_subdomain": "links"
}
```

- send.io extensions: `receiving`, `open_tracking`, `click_tracking`, `tracking_subdomain`, plus extra response fields (`tracking_status`, `dns_provider`, `verification_deadline_at`, `events`, ...).
- The domain limit depends on your plan. Over the limit returns 422 "The domain limit for this plan has been reached."
- At most 5 domains can wait for verification at once, whatever the plan. A sixth returns 422 "At most 5 domains can wait for verification at once. Verify or delete one before adding another." Verified domains do not count.
- A domain already in your workspace returns 409 `resource_locked` naming it. A domain verified in another workspace returns 409 `resource_locked`.
- A domain another workspace added but never verified does not block you: the first request returns 409 `domain_ownership_required` with a TXT record to publish (name `_sendio.<domain>`, value `sendio-verification=...`). Publish it and send the same request again: the other workspace's unverified domain is removed and yours is added.
- Options send.io cannot apply (an unknown capability, sending disabled, enforced TLS) return 422 instead of being ignored.
- Receiving asks for an MX record on the domain. The MX value is the same for every domain, so use a subdomain such as `inbound.acme.com` if the domain already receives mail elsewhere.
- Records you are asked to add depend on the domain's setup; always copy them from the response.

### Retrieve domain

`GET /domains/{domain_id}` (https://developer.send.io/docs/api#retrieve-domain)

Get one domain with its DNS records, their status, and its setup history.

Path parameters:

- `domain_id` (string, required): The domain id.

Response fields:

- `dns_provider` (string | null): The DNS provider the domain's zone is hosted at, when send.io recognises it.
- `dns_zone` (string): The DNS zone the domain lives in. Record `host` values are relative to it.
- `dns_zone_detected` (boolean): Whether send.io found the zone in DNS. When false, `dns_zone` is the domain name itself and record names are given in full.
- `verification_deadline_at` (string | null): When verification gives up, or null when no check is running.
- `last_checked_at` (string | null): When the DNS records were last checked, by verify or automatically, or null before the first check.
- `tracking_subdomain` (string | null): The branded tracking subdomain, or null.
- `sending_setup` (object | null): Null in the usual case. Set while the domain's DNS records are all found but send.io has not finished its own sending set-up for it: `{ status, message }`, where `status` is `retrying` (we are trying again, nothing to do) or `needs_attention` (contact support), and `message` says the same in words. The domain stays `pending` and is not removed at `verification_deadline_at` while this is set.
- `records[].name` (string): The record name relative to the domain (`@` for the domain itself).
- `records[].host` (string): The record name relative to `dns_zone`: what you type into your DNS provider.
- `records[].full_name` (string): The complete record name.
- `records[].priority` (number): MX records only.

- Domain `status` is one of not_started, pending, verified, partially_verified, failed, temporary_failure.
- Each record has a `status` and, once checked, `found` (the value we saw in DNS) and `last_checked_at`. The domain's `last_checked_at` is the last check of any kind; open domains are checked automatically every minute.
- A domain added again after a delete gets a new DKIM value: its `events` include `domain.added_again`. Replace the old DKIM record in your DNS.
- `name` is relative to the domain. `full_name` is the complete record name, and `host` is the name relative to `dns_zone`, the DNS zone the domain lives in. For a subdomain such as `mail.acme.com` in the zone `acme.com`, the return path has name `send` and host `send.mail`. Type `host` into your DNS provider.

### List domains

`GET /domains` (https://developer.send.io/docs/api#list-domains)

List your domains, newest first. Records are not included; retrieve a domain to get them.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. All domains are returned when left out.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

Response fields:

- `data[].dns_provider` (string | null): The DNS provider the domain's zone is hosted at, when send.io recognises it.
- `data[].dns_zone` (string): The DNS zone the domain lives in. Record `host` values are relative to it.
- `data[].dns_zone_detected` (boolean): Whether send.io found the zone in DNS. When false, `dns_zone` is the domain name itself and record names are given in full.
- `data[].verification_deadline_at` (string | null): When verification gives up, or null when no check is running.
- `data[].last_checked_at` (string | null): When the DNS records were last checked, by verify or automatically, or null before the first check.
- `data[].tracking_subdomain` (string | null): The branded tracking subdomain, or null.
- `data[].sending_setup` (object | null): Null in the usual case. Set while the domain's DNS records are all found but send.io has not finished its own sending set-up for it: `{ status, message }`, where `status` is `retrying` (we are trying again, nothing to do) or `needs_attention` (contact support), and `message` says the same in words. The domain stays `pending` and is not removed at `verification_deadline_at` while this is set.

### Update domain

`PATCH /domains/{domain_id}` (https://developer.send.io/docs/api#update-domain)

Change a domain's tracking, TLS and receiving settings. Only the fields you send are changed.

Path parameters:

- `domain_id` (string, required): The domain id.

Body:

- `open_tracking` (boolean): Track opens.
- `click_tracking` (boolean): Track link clicks.
- `tracking_subdomain` (string): Subdomain for tracking links. A single DNS label (letters, digits and dashes). It can be changed but not removed. A new value adds a new CNAME record to set up.
- `tls` (string): `opportunistic`. `enforced` is not available yet and returns 422.
- `receiving` (boolean): Turn receiving on or off. Or send Resend's `capabilities: { receiving: "enabled" | "disabled" }`.

Example request body:

```json
{
  "open_tracking": true,
  "click_tracking": true,
  "tracking_subdomain": "links"
}
```

- send.io extension: `tracking_subdomain` sets up a branded tracking host with its own certificate. Track its progress in `tracking_status` (off, pending, active, failed).
- Receiving off: email to the domain is refused right away and its MX record is no longer required (a domain waiting only for it becomes verified). Remove the MX record pointing at send.io from your DNS.
- Receiving on: the domain asks for its MX record (publish it to receive email); a domain whose MX record is already published is verified again at the next check.
- Sending cannot be turned off (422).
- `name`, `region`, `custom_return_path` and `delivery_route` are set when the domain is added. Sending one with another value returns 422 instead of being ignored; to change it, add the domain again.
- Turning `open_tracking` or `click_tracking` on for a domain without a tracking subdomain sets `tracking_subdomain` to `links` (or `track`), with its CNAME record to add.

### Verify domain

`POST /domains/{domain_id}/verify` (https://developer.send.io/docs/api#verify-domain)

Check the domain's DNS records now instead of waiting for the next automatic check (every minute). The response is the checked domain: its status, and each record's status, `found` and `last_checked_at`.

Path parameters:

- `domain_id` (string, required): The domain id.

### Delete domain

`DELETE /domains/{domain_id}` (https://developer.send.io/docs/api#delete-domain)

Remove a domain. Its mailboxes and agent inboxes are removed with it, and you can no longer send from it.

Path parameters:

- `domain_id` (string, required): The domain id.

- A domain that had an MX record for receiving answers with a `note` to remove it: the MX value is shared, so left in place it would send the domain's email to whoever adds it next.

### Get Domain Connect link

`GET /domains/{domain_id}/domain-connect` (https://developer.send.io/docs/api#domain-connect)

Check whether the domain's DNS provider supports one-click setup (Domain Connect). If it does, the response has a signed URL that opens the provider and adds the records for you.

Path parameters:

- `domain_id` (string, required): The domain id.

- send.io extension. Never fails because setup is unsupported: you get `supported: false` and a `reason`, one of custom_return_path, provider_unsupported, template_pending, signing_unavailable, or a reason that the records are not ready yet.
- A DMARC record is only offered when the domain has none, so an existing policy is never overwritten.

### Get DNS context

`GET /domains/{domain_id}/dns-context` (https://developer.send.io/docs/api#domain-dns-context)

Check what the domain's DNS already holds that matters when you add send.io's records: the other email services its records name, each with the record that says so, and anything that is in the way of a record send.io needs.

Path parameters:

- `domain_id` (string, required): The domain id.

- send.io extension. Read-only: it only looks up the domain you added and names under it.
- `status` is `ok` when every lookup answered, `partial` or `unavailable` when DNS did not answer; `unchecked` then lists what could not be checked (providers, spf, dmarc, names). An empty `providers` list means no other service only when `status` is `ok`.
- A provider has `kind` sending (an email service) or mailbox (Google Workspace, Microsoft 365), and is never listed without `evidence`.
- `conflicts` have a `kind` (name_taken, multiple_spf, spf_exists), a `message` and an `action`. `affects_sendio` is false for a problem send.io's email does not depend on.
- The answer is kept for up to a minute.

## API keys

Create and manage the keys that authenticate API requests.

### Create API key

`POST /api-keys` (https://developer.send.io/docs/api#create-api-key)

Create a new API key. The full token is returned only once, in this response.

Body:

- `name` (string, required): Name of the key, up to 50 characters.
- `permission` (string): `full_access` (default) or `sending_access`. A sending key can only send: Send email, Send batch emails and Send raw email.
- `domain_id` (string): Restrict the key to sending from this domain. Requires `permission: "sending_access"`: with `full_access` (the default) it is refused with 422.
- `allowed_ips` (string[]): Only accept the key from these IP addresses or CIDR ranges (IPv4 and IPv6, up to 50). Leave out for a key that works from any address.

Example request body:

```json
{
  "name": "Production",
  "permission": "sending_access",
  "domain_id": "d91cd9bd-1176-453e-8fc1-35364d380206",
  "allowed_ips": [
    "203.0.113.10",
    "198.51.100.0/24"
  ]
}
```

- Tokens start with `mx_`. The response also includes `object`.
- `allowed_ips` applies everywhere the key works: the API, the compatible APIs, MCP, and SMTP and IMAP logins with the key as the password. A request from any other address is refused with 403 `ip_not_allowed`, which names the address send.io saw. Single addresses come back as `/32` (IPv4) or `/128` (IPv6). Entries that cannot match, such as private addresses, are accepted and listed in `warnings`.
- `domain_id` only works on a sending key. A full-access key cannot be limited to a domain, so `domain_id` with `full_access` answers 422 `validation_error` instead of being ignored.
- A key limited to a domain that is not verified yet is created, with a line in `warnings`: it cannot send until the domain is verified.
- A key limited to a domain refuses any other From first, with 403 `invalid_permission` "This API key can only send from <domain>...". Once the domain is deleted the key cannot send; the key list shows `domain_deleted: true`. Create a new key for a domain added again.

### List API keys

`GET /api-keys` (https://developer.send.io/docs/api#list-api-keys)

List active API keys, newest first. Tokens are never returned, only their prefix.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. All keys are returned when left out.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

Response fields:

- `data[].last_used_at` (string | null): When the key last authenticated a request, or null.
- `data[].domain_id` (string | null): The domain a sending key is limited to, or null.
- `data[].domain` (string | null): That domain's name, or null.
- `data[].domain_deleted` (boolean | null): True when that domain was deleted: the key can no longer send. Null for a key without a domain.
- `data[].created_by` (string | null): Who created the key, or null when unknown.
- `data[].created_by_api_key_id` (string | null): The API key that created this key through the API, or null when it was created in the dashboard.
- `data[].allowed_ips` (string[]): The IP addresses and ranges (CIDR) the key may be used from. Empty when the key works from any address.

- send.io adds `last_used_at`, `token_prefix`, `permission`, `domain_id`, `domain`, `created_by` and `allowed_ips`.

### Retrieve API key

`GET /api-keys/{api_key_id}` (https://developer.send.io/docs/api#retrieve-api-key)

Get one API key and its usage over the last 30 days: request counts, top endpoints and the 25 latest requests.

Path parameters:

- `api_key_id` (string, required): The API key id.

Response fields:

- `last_used_at` (string | null): When the key last authenticated a request, or null.
- `domain_id` (string | null): The domain a sending key is limited to, or null.
- `domain` (string | null): That domain's name, or null.
- `domain_deleted` (boolean | null): True when that domain was deleted: the key can no longer send. Null for a key without a domain.
- `created_by` (string | null): Who created the key, or null when unknown.
- `created_by_api_key_id` (string | null): The API key that created this key through the API, or null when it was created in the dashboard.
- `allowed_ips` (string[]): The IP addresses and ranges (CIDR) the key may be used from. Empty when the key works from any address.

- send.io extension.

### Update API key

`PATCH /api-keys/{api_key_id}` (https://developer.send.io/docs/api#update-api-key)

Rename an API key, or change the IP addresses it may be used from.

Path parameters:

- `api_key_id` (string, required): The API key id.

Body:

- `name` (string): New name, up to 50 characters.
- `allowed_ips` (string[] | null): Replace the key's allowed IP addresses and CIDR ranges (up to 50). `[]` or `null` lets the key work from any address again.

Example request body:

```json
{
  "allowed_ips": [
    "203.0.113.10",
    "198.51.100.0/24"
  ]
}
```

- send.io extension. Send `name`, `allowed_ips`, or both.
- A change to `allowed_ips` takes effect within seconds everywhere the key works, and is recorded in the audit log with the old and new lists.
- A key cannot change its own list so that it would refuse the request making the change: that is answered with 422, so you cannot lock yourself out through the API.

### Delete API key

`DELETE /api-keys/{api_key_id}` (https://developer.send.io/docs/api#delete-api-key)

Revoke an API key. Requests made with it fail from then on.

Path parameters:

- `api_key_id` (string, required): The API key id.

- Returns the deleted key's id.

### Get your IP address

`GET /api-keys/client-ip` (https://developer.send.io/docs/api#get-client-ip)

The public IP address send.io sees your request coming from: the address to put in a key's `allowed_ips`.

- send.io extension. The dashboard's "Add my IP" on a key's allowed IPs uses it.

## OAuth grants

The apps your team approved to act on its behalf through Sign in with send.io, such as an AI app using the MCP server or the CLI. The dashboard lists them as Connected apps on the API keys page.

### List OAuth grants

`GET /oauth/grants` (https://developer.send.io/docs/api#list-oauth-grants)

List the team's OAuth grants, newest first, including revoked ones. A sign-in that was never completed is not listed.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. Defaults to 20.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

- Needs a full access key; for dashboard users, admins and members can list.

### Revoke OAuth grant

`DELETE /oauth/grants/{grant_id}` (https://developer.send.io/docs/api#revoke-oauth-grant)

Revoke an OAuth grant. The app's access and refresh tokens stop working at once. Revoking a grant that is already revoked returns it unchanged.

Path parameters:

- `grant_id` (string, required): The OAuth grant id.

- Needs a full access key; for dashboard users, admins only.

### List connected apps

`GET /connected-apps` (https://developer.send.io/docs/api#list-connected-apps)

The team's active OAuth grants in the shape the dashboard's Connected apps list shows: the app, the permission it was given, who approved it and when it was last used. Revoked grants and sign-ins never completed are left out; at most 200, newest first.

Response fields:

- `data[].logo_uri` (string | null): The app's logo, or null.
- `data[].client_uri` (string | null): The app's home page, or null.
- `data[].redirect_host` (string | null): The host the sign-in redirected to, or null for a device sign-in.
- `data[].device_name` (string | null): The device named in a device sign-in (the CLI), or null.
- `data[].approved_by` (string | null): Who approved the sign-in, or null when unknown.
- `data[].last_used_at` (string | null): When the app last called the API, or null.

- send.io extension. `GET /oauth/grants` lists the same grants in Resend's shape, revoked ones included.

## Subaccounts

Child accounts for platforms and resellers. A subaccount is a separate account with its own domains, API keys, suppressions, templates, webhooks, emails and metrics; none of it is visible to its parent or to other subaccounts. Its sending counts toward your plan's quota, and it can have limits of its own. Manage subaccounts with a full-access key of the parent account. To call any endpoint as one of your subaccounts, add the header `X-Sendio-Subaccount: <subaccount_id>` to a request made with that key.

### Create subaccount

`POST /subaccounts` (https://developer.send.io/docs/api#create-subaccount)

Create a subaccount. It starts active, with no members, no domains and no API keys: mint keys with Create subaccount API key, or act for it with the `X-Sendio-Subaccount` header.

Body:

- `name` (string, required): Name of the subaccount, 1 to 60 characters.
- `monthly_email_limit` (number | null): Most emails (recipients) the subaccount may send per billing period of your account. `null` (default): no limit of its own; your credit balance still applies.
- `daily_email_limit` (number | null): Most emails (recipients) the subaccount may send per UTC day. `null` (default): no limit of its own.
- `rps` (number): API requests per second for the subaccount's keys, from 1 to your account's own rate limit (the default).

Example request body:

```json
{
  "name": "Acme Bakery",
  "monthly_email_limit": 50000,
  "daily_email_limit": 5000
}
```

- Up to 1000 active subaccounts per account. A subaccount cannot have subaccounts of its own (403).
- Billing rolls up: a subaccount spends your credit balance, and its usage shows in your transactions with its `source_team_id`. When the balance is too low a send returns 402 `insufficient_credits`; over the subaccount's own limit, 429 `subaccount_monthly_quota_exceeded` or `subaccount_daily_quota_exceeded`.
- Like SendGrid subusers, Mailgun subaccounts, Mandrill subaccounts, Mailjet sub-account API keys, Brevo corporate sub-accounts and Postmark servers (a server is a subaccount, its server token a subaccount key).

### List subaccounts

`GET /subaccounts` (https://developer.send.io/docs/api#list-subaccounts)

List your active subaccounts, newest first. Deleted subaccounts are not listed.

### Retrieve subaccount

`GET /subaccounts/{subaccount_id}` (https://developer.send.io/docs/api#retrieve-subaccount)

Get one subaccount.

Path parameters:

- `subaccount_id` (string, required): The subaccount id.

### Update subaccount

`PATCH /subaccounts/{subaccount_id}` (https://developer.send.io/docs/api#update-subaccount)

Rename a subaccount or change its limits. Only the fields you send change; `null` removes a limit.

Path parameters:

- `subaccount_id` (string, required): The subaccount id.

Body:

- `name` (string): Name of the subaccount, 1 to 60 characters.
- `monthly_email_limit` (number | null): Most emails (recipients) the subaccount may send per billing period of your account. `null` (default): no limit of its own; your credit balance still applies.
- `daily_email_limit` (number | null): Most emails (recipients) the subaccount may send per UTC day. `null` (default): no limit of its own.
- `rps` (number): API requests per second for the subaccount's keys, from 1 to your account's own rate limit (the default).

Example request body:

```json
{
  "daily_email_limit": null,
  "monthly_email_limit": 100000
}
```

### Delete subaccount

`DELETE /subaccounts/{subaccount_id}` (https://developer.send.io/docs/api#delete-subaccount)

Delete a subaccount. Its API keys stop working at once, scheduled emails are canceled and its data is removed like a closed account's.

Path parameters:

- `subaccount_id` (string, required): The subaccount id.

### Suspend subaccount

`POST /subaccounts/{subaccount_id}/suspend` (https://developer.send.io/docs/api#suspend-subaccount)

Stop a subaccount from sending. Its sends (API, batch, raw), broadcasts and automation emails are refused with 403 `subaccount_suspended` until you resume it; its API keys still work for everything else.

Path parameters:

- `subaccount_id` (string, required): The subaccount id.

- Queued broadcasts wait and continue after Resume. Email already accepted before the suspension is still delivered.

### Resume subaccount

`POST /subaccounts/{subaccount_id}/resume` (https://developer.send.io/docs/api#resume-subaccount)

Let a suspended subaccount send again.

Path parameters:

- `subaccount_id` (string, required): The subaccount id.

### Create subaccount API key

`POST /subaccounts/{subaccount_id}/api-keys` (https://developer.send.io/docs/api#create-subaccount-api-key)

Create an API key for a subaccount. The full token is returned only once, in this response. The key sees only the subaccount's data.

Path parameters:

- `subaccount_id` (string, required): The subaccount id.

Body:

- `name` (string, required): Name of the key, up to 50 characters.
- `permission` (string): `full_access` (default) or `sending_access`.
- `domain_id` (string): Restrict the key to sending from this domain of the subaccount.

Example request body:

```json
{
  "name": "Acme Bakery production"
}
```

### List subaccount API keys

`GET /subaccounts/{subaccount_id}/api-keys` (https://developer.send.io/docs/api#list-subaccount-api-keys)

List a subaccount's active API keys, newest first. Tokens are never returned, only their prefix.

Path parameters:

- `subaccount_id` (string, required): The subaccount id.

### Delete subaccount API key

`DELETE /subaccounts/{subaccount_id}/api-keys/{api_key_id}` (https://developer.send.io/docs/api#delete-subaccount-api-key)

Revoke one of a subaccount's API keys.

Path parameters:

- `subaccount_id` (string, required): The subaccount id.
- `api_key_id` (string, required): The API key id.

### Subaccount stats

`GET /subaccounts/{subaccount_id}/stats` (https://developer.send.io/docs/api#subaccount-stats)

A subaccount's usage in the current billing period against its limits and your plan, and its email metrics. Takes the same query parameters as Email metrics (period, granularity, metrics, dimensions and filters).

Path parameters:

- `subaccount_id` (string, required): The subaccount id.

Query parameters:

- `start_date` (string): Start of the metrics period (date or ISO 8601). Default: 7 days before end_date.
- `end_date` (string): End of the metrics period. Default: now.
- `granularity` (string): `hourly`, `daily` (default), `weekly` or `monthly`.

- `parent_plan_emails_used` counts your account and every subaccount in the period.

## Webhooks

Get an HTTP POST to your endpoint when emails, domains, contacts and other resources change.

### Create webhook

`POST /webhooks` (https://developer.send.io/docs/api#create-webhook)

Register an endpoint for one or more event types. The response includes the signing secret used to verify deliveries.

Body:

- `endpoint` (string, required): Public HTTPS URL that receives the events, at most 2,048 characters. No user name or password and no #fragment in the URL.
- `events` (string | string[], required): Event types to send. Allowed: email.sent, email.delivered, email.delivery_delayed, email.complained, email.bounced, email.opened, email.clicked, email.failed, email.scheduled, email.canceled, email.suppressed, email.unsubscribed, email.received, email.replied, domain.created, domain.updated, domain.verified, domain.deleted, suppression.added, suppression.removed, contact.created, contact.updated, contact.deleted, contact.unsubscribed, contact.list_unsubscribed, contact.topics.updated, contact.segment_entered, contact.segment_left, topic.created, topic.updated, topic.deleted, automation.run.started, automation.run.completed, automation.run.failed, automation.run.cancelled, automation.auto_paused, message.received, message.received.spam, message.sent, message.delivered, message.bounced, message.complained, message.rejected, message.opened.
- `format` (string): How deliveries are built. `sendio` (default): the payload below, signed with `svix-*` headers. Provider formats (`sendgrid`, `postmark`, `mailgun`, `mailchimp`, `mailchimp_list`, `mailjet`, `brevo`) are set by the compatible APIs when you create a webhook through them.
- `options` (object): Format settings: `basic_auth` ({username, password}) or `bearer_token` (sent as the Authorization header), `signing_key` (for provider signatures), and for formats that batch `batch_size` and `batch_max_wait_ms` (up to 30000). Backup URL for any format: `backup_endpoint` (public HTTPS URL, no credentials), `backup_after_attempts` (1 to 8, default 3) and `backup_basic_auth` ({username, password}, used instead of `basic_auth` for the backup). Other keys depend on the format; unknown keys return 422. Passwords, tokens and keys are stored encrypted and returned masked as `********`.
- `headers` (object): Custom request headers sent with every delivery, as `{name: value}` (at most 50 headers, 4,096 characters per value, 8 KB in all). Values cannot contain line breaks or other control characters. `Content-Type`, `Content-Length`, `Host`, `User-Agent` and `svix-*` cannot be set. Values are write-only: responses show them as `********`.
- `streams` (string[]): Message stream ids (see Streams). When set, email events of other streams are not sent to this webhook; events without a stream (domains, contacts, suppressions) still are. Default: every stream.
- `include_subaccounts` (boolean): Also send your subaccounts' events to this webhook, with `subaccount_id` added at the top level of the payload. Default: false (each subaccount's events go to its own webhooks).

Response fields:

- `status` (string): `enabled` or `disabled`. send.io disables an endpoint after 3 days of failed deliveries.
- `disabled_reason` (string | null): Why send.io disabled the endpoint, for example after 3 days of failed deliveries. null while enabled or when you disabled it yourself.
- `failing_since` (string | null): When the current run of failed deliveries started (RFC 3339). null when the last delivery succeeded.
- `health` (string): `healthy`, `failing` (the last delivery failed: see `last_failure_reason`) or `disabled`.
- `last_success_at` (string | null): When a delivery last succeeded (RFC 3339).
- `last_failure_at` (string | null): When a delivery last failed (RFC 3339).
- `last_failure_reason` (string | null): Why the last delivery failed, for example `HTTP 404` or `No response from the endpoint`.
- `previous_secret_expires_at` (string | null): When the secret replaced by the last rotation stops signing (RFC 3339). null when only the current secret signs.

Example request body:

```json
{
  "endpoint": "https://acme.com/webhooks/sendio",
  "events": [
    "email.delivered",
    "email.bounced",
    "email.complained"
  ]
}
```

- The number of webhooks depends on your plan: 20 for an account, 10 for a subaccount. Every webhook of the account counts, including those made through the compatible APIs and agent inbox webhooks. Over the limit returns 422 "The webhook limit for this plan has been reached."
- send.io extension: `streams`, a per-stream webhook like Postmark's. Email events carry their stream in `data.stream` (`inbound` for `email.received`).
- A delivery counts as successful on any HTTP 2xx response (200 to 299), for example 200, 201, 202 or 204. Any other answer (a redirect included: redirects are not followed), a timeout or a connection error is a failed delivery. Failed deliveries are retried with backoff.
- If deliveries to an endpoint fail continuously for 24 hours, we email the workspace Admins. After 3 days of failures we disable the endpoint and show the reason in the dashboard. Turn it back on from the webhook page once the endpoint works again.
- Extra send.io event types: `email.replied`, `contact.segment_entered`, `contact.segment_left`, `automation.*`, the agent inbox `message.*` events, and the billing events `credits.low`, `credits.depleted` and `credits.purchased`.
- `contact.segment_entered` and `contact.segment_left`: the rule of a rule-based segment moved a contact in or out. `data` is `{ contact_id, email, segment_id, segment_name, source: "rule" }`. They are sent within seconds of the change that moved the contact (a property, an event, a time in the rule passing), and not for a segment's first build or a rule change unless it asked for `run_automations`, nor for history loaded with Import event history. Adding or removing a contact by hand in a manual segment does not send them. Provider formats: Brevo webhooks get `contact.segment_entered` as `list_addition`, Mailchimp list webhooks (created since rule-based segments were added) as `subscribe` for their own list; no provider format sends `contact.segment_left`, and the Mailchimp transactional, Mailjet, SendGrid, Mailgun and Postmark formats send neither.
- Two shapes: `email.*`, `contact.*`, `domain.*` and the other events use `{type, created_at, data}` with the event name in `type`. The agent inbox `message.*` events use the AgentMail shape `{type: "event", event_type, event_id, message, thread}`: read the event name from `event_type`. One received email sends both `email.received` and `message.received` when you subscribe to both, so subscribe to one of them.
- Received-mail events (`email.received`, `message.received`) are at most 256 KB. For a larger mail the body fields are left out (HTML first, `extracted_text` last) and `bodies_omitted` lists them: read the full message through the API. Accept request bodies of at least 1 MB on your endpoint (for example `express.raw({ type: "application/json", limit: "1mb" })`).
- `streams` also applies to `message.received`: it is on the `inbound` stream, like `email.received`.
- send.io extension: `format`, `options` and `headers`. Formats: sendio (default); provider formats are set by the compatible APIs. Formats that batch hold events up to `batch_max_wait_ms` and send up to `batch_size` per request; a failed request retries each of its events. Some provider formats send one request per recipient: the event is delivered when every request gets an HTTP 2xx response, and a retry sends them all again.
- Backup endpoint: when a delivery to `endpoint` gets no HTTP response (connection refused, DNS failure, timeout), or fails on attempt `backup_after_attempts` or later, the same events are sent to `backup_endpoint` in that attempt. An HTTP 2xx response from either counts as delivered; otherwise the normal retry schedule continues.
- `email.opened` events carry `detail.first_open`: true on the first open of the email (or of the recipient the event names), false afterwards.

### List webhooks

`GET /webhooks` (https://developer.send.io/docs/api#list-webhooks)

List your webhooks, newest first.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. All webhooks are returned when left out.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

Response fields:

- `data[].status` (string): `enabled` or `disabled`. send.io disables an endpoint after 3 days of failed deliveries.
- `data[].disabled_reason` (string | null): Why send.io disabled the endpoint. null while enabled or when you disabled it yourself.
- `data[].failing_since` (string | null): When the current run of failed deliveries started (RFC 3339). null when the last delivery succeeded.
- `data[].health` (string): `healthy`, `failing` or `disabled`. With `data[].last_failure_reason` and `data[].last_failure_at`, says why deliveries fail.

- If deliveries to an endpoint fail continuously for 24 hours, we email the workspace Admins. After 3 days of failures we disable the endpoint and show the reason in the dashboard. Turn it back on from the webhook page once the endpoint works again.
- While a webhook is disabled, its events are not sent. They are kept as `held` for up to 30 days after it was disabled. Once you enable the webhook again, send them with Recover missed events (`POST /webhooks/{webhook_id}/recover`).

### Retrieve webhook

`GET /webhooks/{webhook_id}` (https://developer.send.io/docs/api#retrieve-webhook)

Get one webhook, including its current signing secret.

Path parameters:

- `webhook_id` (string, required): The webhook id.

Response fields:

- `status` (string): `enabled` or `disabled`. send.io disables an endpoint after 3 days of failed deliveries.
- `disabled_reason` (string | null): Why send.io disabled the endpoint, for example after 3 days of failed deliveries. null while enabled or when you disabled it yourself.
- `failing_since` (string | null): When the current run of failed deliveries started (RFC 3339). null when the last delivery succeeded.
- `health` (string): `healthy`, `failing` (the last delivery failed: see `last_failure_reason`) or `disabled`.
- `last_success_at` (string | null): When a delivery last succeeded (RFC 3339).
- `last_failure_at` (string | null): When a delivery last failed (RFC 3339).
- `last_failure_reason` (string | null): Why the last delivery failed, for example `HTTP 404` or `No response from the endpoint`.
- `previous_secret_expires_at` (string | null): When the secret replaced by the last rotation stops signing (RFC 3339). null when only the current secret signs.
- `signing_secret` (string): The current signing secret. Left out for workspace Members, who see `signing_secret_hidden: true` instead; Admins and API keys get it.
- `signing_secret_hidden` (boolean): true when the signing secret is left out because the caller is a workspace Member. Not present otherwise.

- If deliveries to an endpoint fail continuously for 24 hours, we email the workspace Admins. After 3 days of failures we disable the endpoint and show the reason in the dashboard. Turn it back on from the webhook page once the endpoint works again.

### Update webhook

`PATCH /webhooks/{webhook_id}` (https://developer.send.io/docs/api#update-webhook)

Change a webhook's endpoint, events or status. Only the fields you send are changed.

Path parameters:

- `webhook_id` (string, required): The webhook id.

Body:

- `endpoint` (string): New endpoint URL.
- `events` (string | string[]): New list of event types. Replaces the old list. Same allowed values as Create webhook.
- `status` (string): `enabled` or `disabled`. Enabling resets the failure counter and clears `disabled_reason` and `failing_since`. Turn an endpoint that send.io disabled back on this way once it works again, then send the events it missed with Recover missed events.
- `format` (string): New format (see Create webhook). The current options must be valid for it, or send new `options`.
- `options` (object): New options. Replaces the old object; send a masked value (`********`) back unchanged to keep the stored secret.
- `headers` (object): New custom headers. Replaces the old object; `{}` or `null` removes them all. Send a masked value (`********`) back unchanged to keep the stored value of that header.
- `streams` (string[]): New stream filter. Replaces the old list; `[]` sends events of every stream.

Example request body:

```json
{
  "status": "disabled"
}
```

### Delete webhook

`DELETE /webhooks/{webhook_id}` (https://developer.send.io/docs/api#delete-webhook)

Delete a webhook. No more events are sent to it.

Path parameters:

- `webhook_id` (string, required): The webhook id.

### Rotate signing secret

`POST /webhooks/{webhook_id}/signing-secret/rotate` (https://developer.send.io/docs/api#rotate-webhook-secret)

Create a new signing secret. The old secret keeps working for 24 hours so you can switch over without dropping events. You can rotate again at any time, for example when the new secret leaked.

Path parameters:

- `webhook_id` (string, required): The webhook id.

Body:

- `expire_previous` (boolean): true stops every older secret at once, so only the new secret signs. Use it when a secret leaked. Default false.

Response fields:

- `signing_secret` (string): The new signing secret. It signs every request from now on.
- `previous_secret_expires_at` (string | null): When the old secret stops signing (RFC 3339). null when only the new secret signs.

- send.io extension.
- Rotating again within 24 hours replaces only the newest secret. The secret you had before the first rotation keeps its original expiry, so receivers that still use it keep working.

### Recover missed events

`POST /webhooks/{webhook_id}/recover` (https://developer.send.io/docs/api#recover-webhook-events)

Send the events a webhook missed while it was disabled. Enable the webhook first. Events are sent oldest first, with the usual retries.

Path parameters:

- `webhook_id` (string, required): The webhook id.

Body:

- `since` (string): Send held events from this time on (RFC 3339, a date or Unix seconds). Default and earliest: 30 days ago.
- `after` (string): Continue after this event id: the `next_after` of the previous call.

Response fields:

- `queued` (number): How many held events were queued, at most 1,000 per call.
- `has_more` (boolean): true when more held events are waiting. Call again with `after` set to `next_after`.
- `next_after` (string | null): The event id to continue after.

Example request body:

```json
{
  "since": "2026-10-01T00:00:00Z"
}
```

- send.io extension.
- While a webhook is disabled, its events are not sent. They are kept as `held` for up to 30 days after it was disabled. Once you enable the webhook again, send them with Recover missed events (`POST /webhooks/{webhook_id}/recover`).
- An event is never queued twice: once queued its status changes from held to pending. A webhook that is still disabled answers 409.

### List webhook events

`GET /webhooks/{webhook_id}/events` (https://developer.send.io/docs/api#list-webhook-events)

List the events sent (or being sent) to a webhook, newest first, with their delivery status and payload.

Path parameters:

- `webhook_id` (string, required): The webhook id.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. Default 20.
- `after` (string): Return events older than the event with this id. `before` is not supported.

Response fields:

- `data[].last_attempt` (object | null): The latest delivery attempt: `http_status_code` (null when the endpoint did not answer), `error` (why it failed, for example a timeout), `kind` (`scheduled` or `replay`) and `sent_at`. null before the first attempt. Use it to see why an event is still pending.

- send.io extension. `status` is pending, success or failed, skipped when the webhook's format has no equivalent for the event, or held when the event happened while the webhook was disabled (not sent: see Recover missed events).
- Events and their delivery attempts are kept for 30 days. Older events are not listed and cannot be retrieved or replayed (404).

### Retrieve webhook event

`GET /webhooks/{webhook_id}/events/{event_id}` (https://developer.send.io/docs/api#retrieve-webhook-event)

Get one event of a webhook, with its delivery status and payload.

Path parameters:

- `webhook_id` (string, required): The webhook id.
- `event_id` (string, required): The event id.

Response fields:

- `last_attempt` (object | null): The latest delivery attempt: `http_status_code` (null when the endpoint did not answer), `error` (why it failed, for example a timeout), `kind` (`scheduled` or `replay`) and `sent_at`. null before the first attempt. Use it to see why an event is still pending.

- send.io extension.

### Replay webhook event

`POST /webhooks/{webhook_id}/events/{event_id}/replay` (https://developer.send.io/docs/api#replay-webhook-event)

Send an event to the webhook's endpoint once more, with the same payload.

Path parameters:

- `webhook_id` (string, required): The webhook id.
- `event_id` (string, required): The event id.

Response fields:

- `status` (string): `queued`: the replay is sent within seconds. It shows in the event's attempts with `kind: "replay"` and in `last_attempt`.
- `event_status` (string): The event's own status. A replay does not change it or its scheduled retries.
- `replay_queued_at` (string): When the replay was queued (RFC 3339).

- send.io extension.
- A replay is sent as a new delivery: the JSON body is serialized again, so its whitespace can differ from the original delivery, and it is signed with a new timestamp. Verify each delivery against the raw bytes you received, never against a stored copy of an earlier one.

### List delivery attempts

`GET /webhooks/{webhook_id}/events/{event_id}/attempts` (https://developer.send.io/docs/api#list-webhook-event-attempts)

List each attempt to deliver one event, newest first, with your endpoint's HTTP status and response.

Path parameters:

- `webhook_id` (string, required): The webhook id.
- `event_id` (string, required): The event id.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. Default 20.
- `after` (string): Return attempts older than the attempt with this id. `before` is not supported.

Response fields:

- `data[].http_status_code` (number | null): Your endpoint's HTTP status. null when it did not answer.
- `data[].response` (string): The start of your endpoint's answer (up to 4 KB).
- `data[].error` (string): Why the request failed when there was no answer, for example a timeout or a DNS failure. Empty otherwise.
- `data[].kind` (string): `scheduled` (the first try or a retry) or `replay`.

- send.io extension.

## Senders

Sender identities: a From address with its display name, reply-to and postal address. A sender on a verified domain is verified at once; any other address is confirmed by a link emailed to it. Use one on a send with `sender_id`.

### Create sender

`POST /senders` (https://developer.send.io/docs/api#create-sender)

Add a sender. When its domain is a verified sending domain of your team it is verified at once (`verification_method: "domain"`); otherwise send.io emails the address a confirmation link that expires in 7 days.

Body:

- `email` (string, required): The From address (`from_email` works too). `Name <address>` sets the name when `name` is left out. One sender per address.
- `name` (string): Display name, up to 200 characters.
- `reply_to` (string): Reply-To address used when a send names this sender and no `reply_to`.
- `nickname` (string): Your label for the sender, up to 200 characters.
- `address` (string): Postal address line (for compliance footers), up to 300 characters.
- `address2` (string): Second address line.
- `city` (string): City.
- `state` (string): State or region.
- `zip` (string): Postal code, up to 30 characters.
- `country` (string): Country.

Example request body:

```json
{
  "email": "ada@acme.com",
  "name": "Ada Lovelace",
  "reply_to": "support@acme.com",
  "address": "1 Main St",
  "city": "London",
  "country": "GB"
}
```

- send.io extension (Postmark sender signatures, SendGrid verified senders, Brevo and Mailjet senders).
- `can_send` (same as `domain_verified`) says whether the sender's domain is a verified sending domain of your team. Only then can mail be sent from it: a single sender confirmed by email proves the mailbox, but send.io signs mail (DKIM, SPF alignment) only for verified domains, so a send from it answers 403 until you verify the domain. It is still usable as a profile (reply-to, name, postal address).
- The confirmation email comes from send.io's system address; opening the link (`GET /senders/verify/{token}`, no API key) verifies the sender. A resent link replaces the previous one.
- A team can have up to 1000 senders. A second sender with the same address answers 409.

### List senders

`GET /senders` (https://developer.send.io/docs/api#list-senders)

List senders, newest first.

Query parameters:

- `verified` (boolean): `true` for verified senders only, `false` for the ones waiting for confirmation.
- `email` (string): Only addresses containing this text.
- `domain` (string): Only senders on this domain.
- `limit` (number): Number of items to return, from 1 to 100. All senders are returned when left out.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

### Retrieve sender

`GET /senders/{sender_id}` (https://developer.send.io/docs/api#retrieve-sender)

Get one sender by id or by address.

Path parameters:

- `sender_id` (string, required): The sender id, or its email address.

### Update sender

`PATCH /senders/{sender_id}` (https://developer.send.io/docs/api#update-sender)

Change a sender's fields. Only the fields you send change; `null` clears one. A new `email` must be verified again (at once when its domain is verified, otherwise by a new confirmation email).

Path parameters:

- `sender_id` (string, required): The sender id, or its email address.

Body:

- `email` (string): New address. Resets verification.
- `name` (string): Display name.
- `reply_to` (string | null): Reply-To address.
- `nickname` (string | null): Your label.
- `address` (string | null): Postal address fields: also `address2`, `city`, `state`, `zip`, `country`.

Example request body:

```json
{
  "name": "Ada L.",
  "reply_to": "help@acme.com"
}
```

### Delete sender

`DELETE /senders/{sender_id}` (https://developer.send.io/docs/api#delete-sender)

Delete a sender. Emails already sent are not changed; sends that name it answer 422.

Path parameters:

- `sender_id` (string, required): The sender id, or its email address.

### Resend sender verification

`POST /senders/{sender_id}/resend-verification` (https://developer.send.io/docs/api#resend-sender-verification)

Send a new confirmation email (the previous link stops working). A sender whose domain has been verified since is verified at once instead.

Path parameters:

- `sender_id` (string, required): The sender id, or its email address.

- 422 when the sender is already verified; 429 within a minute of the previous email; 503 when confirmation emails are unavailable.

## Streams

Message streams separate kinds of mail, as Postmark's do: every team has `outbound` (transactional), `broadcast` and `inbound`, and you can add your own transactional and broadcast streams. Sends name one with `stream`; emails, metrics, suppressions and webhooks can be filtered by it.

### List streams

`GET /streams` (https://developer.send.io/docs/api#list-streams)

List the team's streams, the default ones first. Archived streams are left out unless `include_archived=true`.

Query parameters:

- `include_archived` (boolean): `true` also lists archived streams.
- `type` (string): Only streams of this type: `transactional`, `broadcast`, `inbound` (or `all`).

- send.io extension. The default streams are made the first time you use streams. They cannot be archived or deleted.
- A broadcast stream's emails ride the bulk sending lane; transactional streams keep the usual lanes (an OTP tag still takes the OTP lane).

### Create stream

`POST /streams` (https://developer.send.io/docs/api#create-stream)

Add a transactional or broadcast stream.

Body:

- `name` (string, required): Display name, up to 100 characters.
- `stream_id` (string): The id used on sends: 1 to 100 lowercase letters, digits, `-` and `_`. Default: made from the name (`Product Updates` becomes `product-updates`). Cannot be changed.
- `type` (string): `transactional` (default) or `broadcast`. A team has one inbound stream, `inbound`. Cannot be changed.
- `description` (string): Up to 1000 characters.

Example request body:

```json
{
  "name": "Product Updates",
  "type": "broadcast",
  "description": "Monthly product news"
}
```

- Up to 50 custom streams per team. An existing `stream_id` answers 409.

### Retrieve stream

`GET /streams/{stream_id}` (https://developer.send.io/docs/api#retrieve-stream)

Get one stream by its `stream_id` (or `uuid`).

Path parameters:

- `stream_id` (string, required): The stream id (`outbound`, `product-updates`...).

### Update stream

`PATCH /streams/{stream_id}` (https://developer.send.io/docs/api#update-stream)

Rename a stream or change its description. The type and `stream_id` cannot change.

Path parameters:

- `stream_id` (string, required): The stream id.

Body:

- `name` (string): New display name.
- `description` (string): New description.

Example request body:

```json
{
  "name": "Product news"
}
```

### Archive stream

`POST /streams/{stream_id}/archive` (https://developer.send.io/docs/api#archive-stream)

Archive a custom stream: sends that name it answer 422 until it is unarchived. Its emails, suppressions and webhook filters are kept.

Path parameters:

- `stream_id` (string, required): The stream id.

### Unarchive stream

`POST /streams/{stream_id}/unarchive` (https://developer.send.io/docs/api#unarchive-stream)

Make an archived stream usable again.

Path parameters:

- `stream_id` (string, required): The stream id.

### Delete stream

`DELETE /streams/{stream_id}` (https://developer.send.io/docs/api#delete-stream)

Delete a custom stream. Its own suppressions are removed and it is taken out of webhook stream filters; emails sent on it keep its id.

Path parameters:

- `stream_id` (string, required): The stream id.

## Suppressions

Addresses you never send to. Hard bounces and complaints are added for you, soft bounces for 24 hours; you can also add and remove addresses yourself, and keep an allow-list of addresses and domains that are never suppressed.

### Add suppression

`POST /suppressions` (https://developer.send.io/docs/api#create-suppression)

Add an address to the suppression list. Adding an address that is already suppressed returns the existing entry, with the fields you sent (`origin`, `comment`, `expires_at`) updated.

Body:

- `email` (string, required): The email address to suppress.
- `origin` (string): Why it is suppressed: `manual` (default), `bounce` (hard bounce), `soft_bounce`, `complaint`, `invalid` (bad syntax or no such mailbox) or `block` (provider or policy block).
- `comment` (string): Your note, up to 500 characters.
- `expires_at` (string): When the suppression ends (RFC 3339, a date or Unix seconds; must be in the future). Any origin may expire. `soft_bounce` defaults to 24 hours from now; the others never expire unless you set it.
- `stream` (string): Suppress on this message stream only (see Streams). Left out: every stream. An address can have one suppression for every stream and one per stream.

Response fields:

- `stream` (string | null): The message stream, or null for every stream.
- `source_id` (string | null): The email that caused a bounce or complaint entry, or null.
- `comment` (string | null): Your note, or null.
- `expires_at` (string | null): When the suppression ends, or null when it does not.

Example request body:

```json
{
  "email": "grace@example.com",
  "origin": "invalid",
  "comment": "Mailbox does not exist"
}
```

- send.io extension.
- Sending a new `origin` without `expires_at` resets the expiry to that origin's default (24 hours for `soft_bounce`, none otherwise).
- An address on the allow-list can still be added, but sends to it are not suppressed.
- `stream` is null for a suppression of every stream. Bounces and complaints found by send.io always suppress on every stream.

### List suppressions

`GET /suppressions` (https://developer.send.io/docs/api#list-suppressions)

List suppressed addresses, newest first. Expired entries (a soft bounce after its 24 hours) are left out unless `include_expired=true`.

Query parameters:

- `origin` (string): Only entries with this origin, or one of a comma-separated list: `bounce`, `soft_bounce`, `complaint`, `manual`, `invalid`, `block`.
- `email` (string): Only addresses containing this text. Case does not matter.
- `created_after` (string): Only entries created at or after this time (RFC 3339, a date or Unix seconds).
- `created_before` (string): Only entries created before this time.
- `include_expired` (boolean): `true` also lists entries past their `expires_at` (they no longer suppress).
- `stream` (string): Only the entries that apply on this message stream: its own and the ones of every stream (`stream` null).
- `limit` (number): Number of items to return, from 1 to 100. All entries are returned when left out.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

Response fields:

- `data[].stream` (string | null): The message stream, or null for every stream.
- `data[].source_id` (string | null): The email that caused a bounce or complaint entry, or null.
- `data[].comment` (string | null): Your note, or null.
- `data[].expires_at` (string | null): When the suppression ends, or null when it does not.

- `source_id` is the id of the email that caused a bounce, soft bounce or complaint entry.
- A transient (4xx) bounce adds a `soft_bounce` entry that expires after 24 hours; a later hard bounce or complaint turns it into a permanent one. Allow-listed addresses are never added.
- `expired` is true for an entry past its `expires_at` (only listed with `include_expired=true`).

### Retrieve suppression

`GET /suppressions/{suppression_id}` (https://developer.send.io/docs/api#retrieve-suppression)

Get one suppression entry by its id or by the email address. An expired entry answers 404 unless `include_expired=true`. By address, the entry of every stream comes first; `stream` picks one stream's entry.

Path parameters:

- `suppression_id` (string, required): The suppression id, or the suppressed email address.

Query parameters:

- `include_expired` (boolean): `true` also finds an entry past its `expires_at`.
- `stream` (string): With an address: that stream's own entry.

Response fields:

- `stream` (string | null): The message stream, or null for every stream.
- `source_id` (string | null): The email that caused a bounce or complaint entry, or null.
- `comment` (string | null): Your note, or null.
- `expires_at` (string | null): When the suppression ends, or null when it does not.

### Remove suppression

`DELETE /suppressions/{suppression_id}` (https://developer.send.io/docs/api#delete-suppression)

Remove an address from the suppression list so you can send to it again. Expired entries can be removed too. By address, `?stream=` removes that stream's entry (otherwise the entry of every stream first).

Path parameters:

- `suppression_id` (string, required): The suppression id, or the suppressed email address.

### Clear suppressions

`DELETE /suppressions` (https://developer.send.io/docs/api#bulk-delete-suppressions)

Remove every suppression that matches the filters (expired ones included) and get the count. Give at least one filter, or `all=true` to clear the whole list.

Query parameters:

- `origin` (string): Only entries with this origin, or one of a comma-separated list (`bounce,soft_bounce`).
- `before` (string): Only entries created before this time (RFC 3339, a date or Unix seconds). `created_before` works too.
- `created_after` (string): Only entries created at or after this time.
- `email` (string): Only addresses containing this text.
- `stream` (string): Only this message stream's own entries (not the ones of every stream).
- `all` (boolean): `true` to clear everything when no other filter is given.

- send.io extension.
- Each removed entry sends a `suppression.removed` webhook.
- No filter and no `all=true` answers 422.

### Add suppressions in bulk

`POST /suppressions/batch/add` (https://developer.send.io/docs/api#batch-add-suppressions)

Add up to 100 addresses in one request.

Body:

- `emails` (string[], required): 1 to 100 email addresses.
- `origin` (string): Origin for every address (as on Add suppression). Default `manual`.
- `comment` (string): Comment for every address, up to 500 characters.
- `expires_at` (string): Expiry for every address.
- `stream` (string): Message stream for every address (as on Add suppression). Default: every stream.

Example request body:

```json
{
  "emails": [
    "grace@example.com",
    "alan@example.com"
  ]
}
```

### Remove suppressions in bulk

`POST /suppressions/batch/remove` (https://developer.send.io/docs/api#batch-remove-suppressions)

Remove up to 100 entries in one request, by email address or by id.

Body:

- `emails` (string[]): 1 to 100 email addresses. Send `emails` or `ids`, not both.
- `ids` (string[]): 1 to 100 suppression ids.

Example request body:

```json
{
  "emails": [
    "grace@example.com",
    "alan@example.com"
  ]
}
```

- The whole batch fails with 404 if any entry is not found.

### Add to allow-list

`POST /suppressions/allowlist` (https://developer.send.io/docs/api#add-allowlist-entry)

Add an address or a whole domain that is never suppressed. Sends to it skip the suppression check, and bounces or complaints do not add it. Adding an existing entry updates its comment.

Body:

- `email` (string): An address to allow. Send one of `email`, `domain` or `value`.
- `domain` (string): A domain to allow (exact match: `acme.com` does not cover `mail.acme.com`).
- `value` (string): An address, `@domain` or a bare domain; the type is worked out from it.
- `comment` (string): Your note, up to 500 characters.

Example request body:

```json
{
  "domain": "partner.example",
  "comment": "Our reseller"
}
```

- send.io extension.
- Addresses are stored in canonical form (domain lower-cased); domains lower-cased.
- Existing suppressions of an allowed address stay listed but no longer stop sends.

### List allow-list

`GET /suppressions/allowlist` (https://developer.send.io/docs/api#list-allowlist)

List allow-list entries, newest first.

Query parameters:

- `type` (string): `email` or `domain`.
- `value` (string): Only entries containing this text.
- `limit` (number): Number of items to return, from 1 to 100. All entries are returned when left out.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

### Retrieve allow-list entry

`GET /suppressions/allowlist/{entry_id}` (https://developer.send.io/docs/api#retrieve-allowlist-entry)

Get one allow-list entry by its id, address or domain.

Path parameters:

- `entry_id` (string, required): The entry id, or the allowed address or domain.

### Remove from allow-list

`DELETE /suppressions/allowlist/{entry_id}` (https://developer.send.io/docs/api#delete-allowlist-entry)

Remove an allow-list entry. Existing suppressions of the address apply again.

Path parameters:

- `entry_id` (string, required): The entry id, or the allowed address or domain.

## Templates

Reusable email designs with variables. Edits create a new draft version; publish it to use it in a transactional email or a broadcast. A template is the content: its From, subject, preview text and Reply-To are optional defaults, so it can be published without them. Templates use the `simple` engine (`{{NAME}}`) by default, or `handlebars` for conditions, loops and helpers.

### Create template

`POST /templates` (https://developer.send.io/docs/api#create-template)

Create a template. It starts as a draft; publish it before sending with it.

Body:

- `name` (string, required): Name of the template.
- `html` (string, required): HTML body. Use `{{NAME}}` for an HTML-escaped variable and `{{{NAME}}}` to insert the value as-is.
- `alias` (string): A unique alias. You can use it in place of the id in every template endpoint and when sending. Up to 100 characters: lowercase letters (a-z), digits, hyphens and underscores, starting with a letter or digit (for example welcome-email).
- `from` (string): Optional default sender, such as `Ada <ada@acme.com>`, for sends that do not give one. Can contain variables. A template is a design: it can be published without a From, and a send or test then needs its own `from`.
- `subject` (string): Optional default subject for sends that do not give one. Can contain variables.
- `reply_to` (string | string[]): Default Reply-To address or addresses.
- `text` (string): Plain text body.
- `preview_text` (string): Inbox preview snippet. It is added as a hidden block at the top of the HTML.
- `template_engine` (string): `simple` (the default) or `handlebars`. `simple` fills `{{NAME}}` and `{{{NAME}}}`. `handlebars` adds conditions, loops, helpers and nested variables; see Template language below. Stored on the version this call saves; an update that leaves it out keeps the current engine.
- `variables` (object[]): Variables the template uses. At most 50. Optional with `handlebars`, where any variable may be passed at send time.
- `variables[].key` (string, required): Variable name, as used in `{{key}}`.
- `variables[].type` (string, required): `string` or `number`. With `template_engine: "handlebars"` also `boolean`, `object` or `array`.
- `variables[].fallback_value` (any): Value used when a send does not provide one.
- `design` (object): Editor design JSON, stored with the version. Used by the send.io template editor.
- `version_name` (string): A name for the version this call saves, shown in the version list. At most 100 characters.
- `version_comment` (string): A comment for the version this call saves. At most 1000 characters.

Example request body:

```json
{
  "name": "Order receipt",
  "alias": "order-receipt",
  "from": "Ada <ada@acme.com>",
  "subject": "Receipt for order {{ORDER_ID}}",
  "html": "<p>Hi {{NAME}}, thanks for order {{ORDER_ID}}.</p>",
  "variables": [
    {
      "key": "NAME",
      "type": "string",
      "fallback_value": "there"
    },
    {
      "key": "ORDER_ID",
      "type": "string"
    }
  ]
}
```

- Template language. `template_engine: "simple"` (the default, and every template saved before engines existed): `{{NAME}}` inserts the value HTML-escaped in the HTML part, `{{{NAME}}}` inserts it as-is. Unknown names stay as written.
- `template_engine: "handlebars"`: Handlebars. Values: `{{name}}` (escaped in HTML), `{{{html}}}` (as-is), dotted paths `{{order.total}}`, `{{items.[0]}}`, `{{items.length}}`, `this`, `../parent`, `@root.x`. Blocks: `{{#if x}}…{{else if y}}…{{else}}…{{/if}}`, `{{#unless x}}`, `{{#each list}}` over arrays and objects with `@index`, `@key`, `@first`, `@last` and block params `{{#each list as |item i|}}`, `{{#with obj}}`, Mustache sections `{{#x}}` / `{{^x}}`. Comments `{{!-- … --}}` and whitespace control `{{~ … ~}}`. Missing values render empty; `#if` treats `false`, `null`, `""`, `0` and `[]` as false (`includeZero=true` keeps 0).
- Handlebars helpers: `eq`, `ne`, `lt`, `gt`, `lte`, `gte` (also SendGrid's `equals`, `notEquals`, `lessThan`, `greaterThan`; numbers compare with numeric strings), `and`, `or`, `not`, `length`, `lookup obj key`, `default value "fallback"`, `uppercase`, `lowercase`, `insert name "default=x"` (SendGrid) and `formatDate date "MMMM D, YYYY" ["-0800"]` (moment-style tokens; ISO 8601 dates or Unix timestamps). Use them inline (`{{default name "there"}}`), as subexpressions (`{{#if (gt total 100)}}`) or as blocks (`{{#eq plan "pro"}}…{{else}}…{{/eq}}`). Objects iterate in key order.
- Handlebars templates are parsed strictly when saved and when sent inline: an unclosed or mismatched block, an unknown helper, a wrong argument count, a partial (`{{> x}}`) or a decorator answers 422 naming the part, line and column, such as `Template syntax error in html at line 3, column 5: {{#if}} is never closed (missing {{/if}})`. Values a helper cannot use (a date `formatDate` cannot read) answer 422 at send time. `{{name|fallback}}` also works, and per-contact tags (`{{{contact.first_name|there}}}`, `{{{unsubscribe_url}}}`) are left in place for broadcast and automation personalization when the variables have no `contact` key.

### Retrieve template

`GET /templates/{template_id}` (https://developer.send.io/docs/api#retrieve-template)

Get a template by id or alias. Content comes from the draft version if there is one, otherwise from the published version.

Path parameters:

- `template_id` (string, required): The template id or alias.

Response fields:

- `published_version_id` (string | null): The version sends, transactional emails and new broadcasts use. Null until the template is published.
- `published_version_number` (number | null): That version's `version_number`.
- `owner_automation_id` (string | null): The automation that owns this template (an automation email), or null for a template of your own.
- `from` (string | null): The default sender, null when the template has none.
- `subject` (string | null): The default subject, null when the template has none.

- `status` is `draft` until the first publish, then `published`. send.io adds `preview_text`, `design`, `version_number`, `template_engine`, `published_version_id` and `published_version_number`.

### List templates

`GET /templates` (https://developer.send.io/docs/api#list-templates)

List templates, newest first.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. Default 20.
- `after` (string): Return items created before the item with this id (the next page). Cannot be combined with `before`.
- `before` (string): Return items created after the item with this id (the previous page). Cannot be combined with `after`.

Response fields:

- `data[].published_version_id` (string | null): The version sends use; null until published.
- `data[].published_version_number` (number | null): That version's `version_number`.
- `data[].owner_automation_id` (string | null): The automation that owns this template (an automation email), or null for a template of your own.

### Update template

`PATCH /templates/{template_id}` (https://developer.send.io/docs/api#update-template)

Change a template. Fields you leave out keep their current values. Each update saves a new draft version; sends keep using the published version until you publish.

Path parameters:

- `template_id` (string, required): The template id or alias.

Body:

- `name` (string): Name of the template.
- `html` (string): HTML body. Use `{{NAME}}` for an HTML-escaped variable and `{{{NAME}}}` to insert the value as-is.
- `alias` (string): A unique alias. You can use it in place of the id in every template endpoint and when sending. Up to 100 characters: lowercase letters (a-z), digits, hyphens and underscores, starting with a letter or digit (for example welcome-email).
- `from` (string): Optional default sender, such as `Ada <ada@acme.com>`, for sends that do not give one. Can contain variables. A template is a design: it can be published without a From, and a send or test then needs its own `from`.
- `subject` (string): Optional default subject for sends that do not give one. Can contain variables.
- `reply_to` (string | string[]): Default Reply-To address or addresses.
- `text` (string): Plain text body.
- `preview_text` (string): Inbox preview snippet. It is added as a hidden block at the top of the HTML.
- `template_engine` (string): `simple` (the default) or `handlebars`. `simple` fills `{{NAME}}` and `{{{NAME}}}`. `handlebars` adds conditions, loops, helpers and nested variables; see Template language below. Stored on the version this call saves; an update that leaves it out keeps the current engine.
- `variables` (object[]): Variables the template uses. At most 50. Optional with `handlebars`, where any variable may be passed at send time.
- `variables[].key` (string, required): Variable name, as used in `{{key}}`.
- `variables[].type` (string, required): `string` or `number`. With `template_engine: "handlebars"` also `boolean`, `object` or `array`.
- `variables[].fallback_value` (any): Value used when a send does not provide one.
- `design` (object): Editor design JSON, stored with the version. Used by the send.io template editor.
- `version_name` (string): A name for the version this call saves, shown in the version list. At most 100 characters.
- `version_comment` (string): A comment for the version this call saves. At most 1000 characters.

Example request body:

```json
{
  "subject": "Your receipt for order {{ORDER_ID}}"
}
```

- `variables`, when sent, replaces the whole list for the new version.

### Publish template

`POST /templates/{template_id}/publish` (https://developer.send.io/docs/api#publish-template)

Publish the current draft so sends use it. A template is a design: it needs content (HTML or text), and its From and subject are optional. Transactional emails that use the template switch to the new version within 10 seconds; broadcasts keep the version they were made from.

Path parameters:

- `template_id` (string, required): The template id or alias.

Body:

- `checks` (string): `enforce` runs the template check (static link checks) on the version first and refuses it when the check finds an error. Without it nothing is checked, as before. Early access: while template checks have not reached your workspace, the field is ignored.

- Returns 422 "No draft to publish." when there are no unpublished changes.
- Returns 422 when the version has no content, when a `handlebars` part does not parse, or when a default From is set but is not a valid address. The From domain is checked when an email is sent and when a transactional email is saved, not at publish.
- Returns 422 when an automation's Send email step sends this template without a From (or subject) of its own and the version has none: "This template is sent by workflow X, whose Send email step has no From address of its own. Keep a default From address on the template or set one on the step."
- A version that was ever published never changes: later edits save a new version. Call Get publish impact first to see what a publish would change.
- With `checks: "enforce"`, returns 422 `template_check_failed` when the template check finds an error, with the errors in `findings` (the same objects as Check template). Nothing is published. Any other `checks` value returns 422.

### Unpublish template

`POST /templates/{template_id}/unpublish` (https://developer.send.io/docs/api#unpublish-template)

Take a template's published version back to a draft, so sends that name the template fail until it is published again.

Path parameters:

- `template_id` (string, required): The template id or alias.

- send.io extension. Returns 409 `template_in_use` while an automation's Send email step or a transactional email uses the template; the body lists them in `automations` (always an array) and `transactional_emails` (`id`, `name`). Broadcasts never block it: they keep their own copy.

### Get publish impact

`GET /templates/{template_id}/publish-impact` (https://developer.send.io/docs/api#template-publish-impact)

What publishing a version would change for what sends the template now, compared with the version published now. Read only.

Path parameters:

- `template_id` (string, required): The template id or alias.

Query parameters:

- `version` (string | number): The version to check, by id or `version_number`. Default: the draft (or the published version when there is no draft).

Response fields:

- `new_required_variables` (string[]): Variables the version requires (used, no fallback) that the published version does not: sends without them will fail with "Missing template variable".
- `removed_defaults` (string[]): Defaults the published version sets and this one leaves empty: `from`, `subject`, `preview_text` or `reply_to`. Sends that relied on them must pass their own.
- `transactional_emails` (object[]): Transactional emails that use the template (`id`, `name`). They switch to the version within 10 seconds of a publish.
- `automations` (object[]): Automations whose Send email step sends the template (`id`, `name`, `blocking`). `blocking` is true when the publish would be refused, because the step has no From or subject of its own and the version has none.
- `recent_template_sends` (number): Emails sent with the template in the last 30 days, at most 10,000. Counted only when `removed_defaults` is not empty, otherwise 0.

- send.io extension. Members may call it. Broadcasts are not listed: they keep the version they were made from.

### Duplicate template

`POST /templates/{template_id}/duplicate` (https://developer.send.io/docs/api#duplicate-template)

Copy a template into a new draft template named "<name> (copy)". The alias is not copied.

Path parameters:

- `template_id` (string, required): The template id or alias.

### Send test email

`POST /templates/{template_id}/test` (https://developer.send.io/docs/api#test-template)

Send the template to up to 5 addresses to check how it looks. Uses the draft if there is one. The subject is prefixed with "[Test]" (the template's name stands in when it has no subject).

Path parameters:

- `template_id` (string, required): The template id or alias.

Body:

- `to` (string | string[], required): 1 to 5 recipient addresses.
- `variables` (object): Values for the template variables.
- `from` (string): Sender for the test, on a verified domain of your team. Overrides the template's default From; required when the template has none.
- `reply_to` (string | string[]): Reply-To for the test. Overrides the template's default.

Example request body:

```json
{
  "to": [
    "ada@acme.com"
  ],
  "from": "Ada <ada@acme.com>",
  "variables": {
    "NAME": "Ada",
    "ORDER_ID": "1042"
  }
}
```

- send.io extension. Test emails are real sends and count toward your quota.
- Without `from` on a template with no default From: 422 `missing_required_field` "The `from` field is required: template X has no default From address."

### Render template

`POST /templates/{template_id}/render` (https://developer.send.io/docs/api#render-template)

Fill a template with variables and return the result, without sending. Uses the same renderer as sends, so missing variables and wrong types fail the same way.

Path parameters:

- `template_id` (string, required): The template id or alias.

Body:

- `variables` (object): Values for the template variables. Fallbacks fill the rest.
- `version_id` (string | number): The version to render, by id or version_number. Defaults to the published version, or the draft when nothing is published yet.
- `template_engine` (string): Preview the version with `simple` or `handlebars` instead of its own engine.

Example request body:

```json
{
  "variables": {
    "NAME": "Ada",
    "ORDER_ID": "1042"
  }
}
```

- send.io extension. Returns 422 "Missing template variable: KEY" when the content uses a variable that has no value and no fallback, and 422 with the part, line and column when a `handlebars` template cannot render (see Create template).

### Check template

`POST /templates/{template_id}/check` (https://developer.send.io/docs/api#check-template)

Check a template version before you publish or send it: undeclared variables, broken handlebars, links, accessibility, size and how email clients render it. Read only. Every finding has a level, a code, the part and line, and a sentence that says what to do. See [Template checks](https://developer.send.io/docs/template-checks) for every code.

Path parameters:

- `template_id` (string, required): The template id or alias.

Body:

- `version` (string | number): The version to check: a version id, a `version_number`, `"draft"` or `"published"`. Default: the draft, or the published version when there is no draft.
- `links` (string): `static` (default) checks the link addresses as written. `live` also requests each `http` and `https` link and image to see that it answers: at most 50 addresses and 12 seconds per check, and 10 live checks a minute per workspace.

Response fields:

- `ok` (boolean): True when no finding is an `error`. Warnings and info never make it false.
- `findings[].line` (number): 1-based line in the part. Left out when the finding is about the whole part.
- `findings[].column` (number): 1-based column, in characters. Left out when not known.
- `findings[].clients` (string[]): Compatibility findings: the email clients affected.
- `findings[].url` (string): Link findings: the link.
- `compatibility_data` (string): Date of the caniemail.com data the compatibility findings use.
- `links` (object | null): Null unless `links` is `live`. Then `checked` (number of addresses requested), `skipped` (addresses over the limits, not requested) and `results`: one per address, with `url`, `status` (the final HTTP status), `problem` (`broken`, `unreachable` or `blocked`, left out when the link works) and `detail`.

Example request body:

```json
{
  "version": "draft",
  "links": "static"
}
```

- send.io extension, in early access: it is being switched on step by step, and until it reaches your workspace the route answers like an unknown address (404 `not_found`).
- On the `simple` engine, a `{{{KEY}}}` that names one of your contact properties is not reported as undeclared: broadcasts and automations fill it from the contact. A transactional send does not, so declare it if a transactional email uses the template.
- With `links: "live"` each link that answers 4xx or 5xx, cannot be reached, or leads to a private network address is a warning (`broken_link`, `unreachable_link`, `blocked_link`), and `link_check_skipped` says how many were not checked. Links with a `{{variable}}` in them are filled at send time and are not requested. Over 10 live checks a minute: 429 `rate_limit_exceeded`.
- Returns 404 when the template, or the version asked for, does not exist (`"draft"` on a template with no draft, say).

### Check template content

`POST /templates/check` (https://developer.send.io/docs/api#check-template-content)

Run the same checks as Check template on content that is not saved yet, such as a file in your repository before you push it.

Body:

- `subject` (string): The subject.
- `html` (string): The HTML, at most 512 KB.
- `text` (string): The plain-text part.
- `template_engine` (string): `simple` (default) or `handlebars`.
- `variables` (object[]): The variables the template declares, as on Create template: `key`, `type` and `fallback_value`. At most 50.
- `links` (string): `static` (default) or `live`, as on Check template.

Response fields:

- `findings[].line` (number): 1-based line in the part. Left out when the finding is about the whole part.
- `findings[].column` (number): 1-based column, in characters. Left out when not known.
- `findings[].clients` (string[]): Compatibility findings: the email clients affected.
- `findings[].url` (string): Link findings: the link.
- `links` (object | null): Null unless `links` is `live`; the same shape as on Check template.

Example request body:

```json
{
  "subject": "Your order {{ORDER_ID}}",
  "html": "<html lang=\"en\"><body><p>Use {{{COUPON}}} on <a href=\"https://acme.com/orders/{{ORDER_ID}}\">your next order</a>.</p></body></html>",
  "text": "Use {{{COUPON}}} on your next order: https://acme.com/orders/{{ORDER_ID}}",
  "variables": [
    {
      "key": "ORDER_ID",
      "type": "string"
    }
  ]
}
```

- send.io extension, in early access: it is being switched on step by step, and until it reaches your workspace the route answers like an unknown address.
- Returns 422 for a `template_engine` other than `simple` or `handlebars`, an `html` over 512 KB, more than 50 variables, a variable type the engine does not take, or a `fallback_value` of the wrong type. A handlebars syntax error is not a 422: it is a `handlebars_syntax` finding with its line and column.

### Template stats

`GET /templates/{template_id}/stats` (https://developer.send.io/docs/api#template-stats)

Delivery and engagement of the emails sent with a template in a period: totals and rates, a series per day (or hour), the split by version and the most clicked links.

Path parameters:

- `template_id` (string, required): The template id or alias.

Query parameters:

- `from` (string): Start of the period: a date (`2026-11-01`) or an ISO 8601 timestamp, in `timezone`. Default: 7 days before `to`.
- `to` (string): End of the period. A bare date covers that whole day. Default: now. The period is at most 90 days.
- `timezone` (string): IANA time zone for the dates and the series. Default `UTC`.
- `version` (string | number): Only this version, by id or version_number: narrows `totals`, `daily` and `top_links` (`per_version` always lists every version).
- `granularity` (string): `daily` (default) or `hourly`: one `daily` entry per day or per hour.

- send.io extension. The numbers are GET /emails/metrics' numbers for this template's emails: counted by the time an email was created, rates as fractions (open and click rates over delivered, delivery and bounce rates over sent). `bounced_hard` counts permanent bounces. Answers are cached for 30 seconds.
- Counts emails sent with the template through the API (single and batch), transactional emails, automations and account emails. A transactional email's sends therefore count here and in its own stats. Test sends and broadcasts (which copy a template's content) are not counted.
- `per_version` lists the versions that sent in the period, newest first, and the live version even when it sent nothing. `top_links` holds the five most clicked links.
- Returns 422 for a period over 90 days and 404 for an unknown template or version.

### List template versions

`GET /templates/{template_id}/versions` (https://developer.send.io/docs/api#list-template-versions)

Every saved version of a template, newest first. Each create or update of the template saves one.

Path parameters:

- `template_id` (string, required): The template id or alias.

Query parameters:

- `limit` (number): Number of items to return, from 1 to 100. Default: all versions.

- send.io extension. `published` marks the version sends use; `draft` marks the newest unpublished edit.

### Retrieve template version

`GET /templates/{template_id}/versions/{version_id}` (https://developer.send.io/docs/api#retrieve-template-version)

One version with its full content and variables.

Path parameters:

- `template_id` (string, required): The template id or alias.
- `version_id` (string, required): The version id, or its version_number.

- send.io extension.

### Update template version

`PATCH /templates/{template_id}/versions/{version_id}` (https://developer.send.io/docs/api#update-template-version)

Rename a version or change its comment. A version's content cannot change: update the template to save a new version.

Path parameters:

- `template_id` (string, required): The template id or alias.
- `version_id` (string, required): The version id, or its version_number.

Body:

- `name` (string | null): Version name. At most 100 characters.
- `comment` (string | null): Version comment. At most 1000 characters.

Example request body:

```json
{
  "name": "Shorter subject",
  "comment": "Tested better in March."
}
```

- send.io extension. Any other field returns 422.

### Activate template version

`POST /templates/{template_id}/versions/{version_id}/activate` (https://developer.send.io/docs/api#activate-template-version)

Make this version the published one, so sends use it. Use it to roll back to an earlier version. The same rules as Publish template apply: the version needs content, and its From and subject are optional.

Path parameters:

- `template_id` (string, required): The template id or alias.
- `version_id` (string, required): The version id, or its version_number.

Body:

- `checks` (string): `enforce` runs the template check (static link checks) on the version first and refuses it when the check finds an error. Without it nothing is checked, as before. Early access: while template checks have not reached your workspace, the field is ignored.

- send.io extension. Activating an older version leaves a newer draft in place; activating the draft is the same as publishing.
- Transactional emails that use the template switch to the version within 10 seconds. Call Get publish impact with `version` first to see what changes.
- With `checks: "enforce"`, returns 422 `template_check_failed` when the template check finds an error, with the errors in `findings` (the same objects as Check template). Nothing changes. Any other `checks` value returns 422.

### Delete template version

`DELETE /templates/{template_id}/versions/{version_id}` (https://developer.send.io/docs/api#delete-template-version)

Remove a version from the list. Emails already sent from it keep their history. Deleting the draft discards the unpublished changes.

Path parameters:

- `template_id` (string, required): The template id or alias.
- `version_id` (string, required): The version id, or its version_number.

- send.io extension. Returns 409 for the published version (activate another one first) and for the only version of a template that was never published.

### Delete template

`DELETE /templates/{template_id}` (https://developer.send.io/docs/api#delete-template)

Delete a template. Sends that reference it fail from then on.

Path parameters:

- `template_id` (string, required): The template id or alias.

- send.io extension. A template that an automation's Send email step or a transactional email uses returns 409 `template_in_use`, with the automations (`automations`: id, name, status; always an array) and, when there are any, the transactional emails (`transactional_emails`: id, name). Change or remove those steps, and choose another template for those transactional emails, first.
- send.io extension. An automation email (`owner_automation_id` set) returns 403 `template_owned_by_automation`: it is deleted with its automation.

## Contacts

Contacts are the people you send broadcasts to. A team has one contact per email address, and a contact can be in many segments and subscribed to topics.

### Get audience stats

`GET /audience/stats` (https://developer.send.io/docs/api#get-audience-stats)

Counts for the whole audience: contacts, subscribed and unsubscribed, then the contacts and subscribed contacts of each segment and the subscribers of each topic, newest first.

- send.io extension. The numbers can be up to 10 seconds old.

### Create contact

`POST /contacts` (https://developer.send.io/docs/api#create-contact)

Create a contact. You can add it to segments and set its topic subscriptions in the same call.

Body:

- `email` (string, required): Email address. Must be unique within your team.
- `first_name` (string | null): First name. At most 200 characters; a longer one is refused with 422 `validation_error`, never cut short.
- `last_name` (string | null): Last name. At most 200 characters; a longer one is refused with 422 `validation_error`, never cut short.
- `unsubscribed` (boolean): Whether the contact is unsubscribed from all broadcasts. Defaults to false.
- `properties` (object): Custom property values keyed by property key. Each key must exist (create it with Create contact property) and the value must match its type, unless `create_missing_properties` is true. A `boolean` property takes true, false, or the text "true" or "false" (any case). A `date` property takes an RFC 3339 time (2026-01-31T09:30:00Z), a time without a zone (2026-01-31T09:30:00, read as UTC) or a day (2026-01-31, read as 00:00 UTC); it is stored and returned as RFC 3339 in UTC. A string value is at most 2,000 characters; a longer one is refused with 422 `validation_error` naming the property.
- `create_missing_properties` (boolean): send.io extension. When true, a key in `properties` with no contact property yet creates one instead of failing: `number` for a number value, otherwise `string` (booleans are stored as given, ISO dates as text). A property made this way is never `boolean` or `date`; create those with Create contact property. Values are also converted to an existing `string` or `number` property's type when that is unambiguous, such as "42" for a number property. Defaults to false.
- `segments` (object[]): Segments to add the contact to, as `[{ id }]`. Manual segments only: a rule-based segment is a 422.
- `segments[].id` (string, required): Segment id.
- `segments[].status` (string): send.io extension. The contact's status in this segment: `subscribed` (the default), `unsubscribed`, `cleaned` or `pending`.
- `topics` (object[]): Topic subscriptions, as `[{ id, subscription }]`.
- `topics[].id` (string, required): Topic id.
- `topics[].subscription` (string, required): `opt_in` or `opt_out`.
- `audience_id` (string): Older way to add the contact to one segment. Cannot be combined with `segments` or `topics`.

Example request body:

```json
{
  "email": "steve.wozniak@acme.com",
  "first_name": "Steve",
  "last_name": "Wozniak",
  "unsubscribed": false,
  "properties": {
    "company": "Acme",
    "seats": 25
  },
  "segments": [
    {
      "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf"
    }
  ],
  "topics": [
    {
      "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
      "subscription": "opt_in"
    }
  ]
}
```

- A second contact with the same email (case-insensitive) fails with 409 and "A contact with this email already exists."
- Property keys must already exist; an unknown key or a value of the wrong type fails the whole call with 422. On a `string` or `number` property, boolean values are accepted and stored as given.
- A value a `boolean` or `date` property cannot read fails the whole call with 422 `validation_error` naming the property, with or without `create_missing_properties`. A number is not accepted as a date.
- With `create_missing_properties: true`, the response also lists the properties it created as `created_properties: [{ key, type }]`.
- `segments` and `audience_id` take manual segments only. A rule-based segment is refused with 422 `validation_error` "This segment is rule-based: its members are decided by its rule." Its members are added and removed by its rule.

### Retrieve contact

`GET /contacts/{contact_id}` (https://developer.send.io/docs/api#get-contact)

Get a contact by id or by email address.

Path parameters:

- `contact_id` (string, required): The contact id or the contact's email address.

- `properties` lists only the properties set on the contact, each as `{ value, type }`. `type` is `string`, `number`, `boolean` or `date`; a boolean value is true or false and a date value an RFC 3339 time in UTC.
- A request whose `User-Agent` starts with `resend-` (Resend's own SDKs, which only know `string` and `number`) is shown `boolean` and `date` properties as `type: "string"`, and boolean values as the text `"true"` or `"false"`. Every other client, send.io's SDKs included, gets the real types.

### List contacts

`GET /contacts` (https://developer.send.io/docs/api#list-contacts)

List contacts, newest first. Filter by segment, topic, status or a search term.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. When omitted, all items are returned.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.
- `segment_id` (string): Only contacts in this segment.
- `audience_id` (string): Same as `segment_id`, for older SDKs. Ignored when `segment_id` is set.
- `search` (string): Case-insensitive match on email or full name.
- `status` (string): `subscribed` or `unsubscribed`.
- `topic_id` (string): Only contacts whose effective subscription to this topic is `opt_in`.

- send.io extension: the `search`, `status` and `topic_id` filters.
- List items do not include `properties`; retrieve a contact to get them.

### Update contact

`PATCH /contacts/{contact_id}` (https://developer.send.io/docs/api#update-contact)

Update a contact by id or by email address. Only the fields you send change.

Path parameters:

- `contact_id` (string, required): The contact id or the contact's email address.

Body:

- `first_name` (string | null): First name. At most 200 characters; a longer one is refused with 422 `validation_error`, never cut short. Send null to clear it.
- `last_name` (string | null): Last name. At most 200 characters; a longer one is refused with 422 `validation_error`, never cut short. Send null to clear it.
- `unsubscribed` (boolean): Whether the contact is unsubscribed from all broadcasts. Must be a boolean.
- `properties` (object): Property values to set, merged into the existing ones. Send null for a key to remove it from the contact. `boolean` and `date` properties take the same values as on Create contact. A string value is at most 2,000 characters (422 `validation_error` otherwise).
- `create_missing_properties` (boolean): send.io extension. When true, a key in `properties` with no contact property yet creates one instead of failing: `number` for a number value, otherwise `string` (booleans are stored as given, ISO dates as text). A property made this way is never `boolean` or `date`; create those with Create contact property. Values are also converted to an existing `string` or `number` property's type when that is unambiguous, such as "42" for a number property. Defaults to false.

Example request body:

```json
{
  "first_name": "Stephen",
  "unsubscribed": true,
  "properties": {
    "seats": 40,
    "company": null
  }
}
```

- The email of a contact cannot be changed. Sending a different `email` fails with 422.
- With `create_missing_properties: true`, the response also lists the properties it created as `created_properties: [{ key, type }]`.

### Delete contact

`DELETE /contacts/{contact_id}` (https://developer.send.io/docs/api#delete-contact)

Permanently delete a contact by id or by email address. It is removed from every segment.

Path parameters:

- `contact_id` (string, required): The contact id or the contact's email address.

### List contact segments

`GET /contacts/{contact_id}/segments` (https://developer.send.io/docs/api#list-contact-segments)

List the segments a contact belongs to, with its status in each (send.io extension).

Path parameters:

- `contact_id` (string, required): The contact id or the contact's email address.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. Defaults to 20.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.

- `type` is `manual` or `rule`. A rule-based segment lists the contact while its rule matches it.

### Add contact to segment

`POST /contacts/{contact_id}/segments/{segment_id}` (https://developer.send.io/docs/api#add-contact-to-segment)

Add a contact to a segment. Adding a contact that is already in the segment succeeds and changes nothing.

Path parameters:

- `contact_id` (string, required): The contact id or the contact's email address.
- `segment_id` (string, required): The segment id.

- `id` is the segment's id (kept for existing clients); `contact_id` and `segment_id` name both sides.
- A rule-based segment is refused with 422 `validation_error` "This segment is rule-based: its members are decided by its rule." Its members are added and removed by its rule.

### Remove contact from segment

`DELETE /contacts/{contact_id}/segments/{segment_id}` (https://developer.send.io/docs/api#remove-contact-from-segment)

Remove a contact from a segment. The contact itself is kept.

Path parameters:

- `contact_id` (string, required): The contact id or the contact's email address.
- `segment_id` (string, required): The segment id.

- `id` is the contact's id and `audienceId` the segment's (both kept for existing clients); `contact_id` and `segment_id` name both sides.
- Fails with 404 "The contact is not in this segment." when the contact is not a member.
- A rule-based segment is refused with 422 `validation_error` "This segment is rule-based: its members are decided by its rule." Its members are added and removed by its rule.

### Retrieve contact topics

`GET /contacts/{contact_id}/topics` (https://developer.send.io/docs/api#get-contact-topics)

List every topic with the contact's subscription to it. When the contact has no choice saved, the topic's default subscription is shown.

Path parameters:

- `contact_id` (string, required): The contact id or the contact's email address.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. Defaults to 20.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.

### Update contact topics

`PATCH /contacts/{contact_id}/topics` (https://developer.send.io/docs/api#update-contact-topics)

Set a contact's subscription to one or more topics. Topics you do not list are left as they are.

Path parameters:

- `contact_id` (string, required): The contact id or the contact's email address.

Body:

- `topics` (object[], required): The subscriptions to set. A bare array of the same objects is also accepted as the body.
- `topics[].id` (string, required): Topic id.
- `topics[].subscription` (string, required): `opt_in` or `opt_out`.

Example request body:

```json
{
  "topics": [
    {
      "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
      "subscription": "opt_out"
    },
    {
      "id": "e2a9c7f1-5d3b-4a8e-b6c4-0f7d1e2a3b9c",
      "subscription": "opt_in"
    }
  ]
}
```

### Import contacts

`POST /contacts/imports` (https://developer.send.io/docs/api#create-contact-import)

Upload a CSV file of contacts, or create the import with `upload` = `url` (the example) and PUT the file to its `upload_url` next. The import runs in the background in batches of 1,000 rows; check its progress with Retrieve contact import. A row that cannot be imported (an invalid address, a first or last name over 200 characters, a string property value over 2,000 characters, a value a number property cannot hold) is not imported and is counted in `failed`; values are never cut short. With `start=false` the import is staged instead: the file is stored and nothing runs until Start contact import.

Body:

- `file` (file): The CSV file. At most 200 MB. Required unless `upload` is `url`.
- `column_map` (string (JSON)): Maps contact fields to CSV columns, e.g. {"email":"Email","first_name":"First name"}: header names, or zero-based column positions ({"email":0}). `email` is required; `first_name`, `last_name` and `unsubscribed` are optional. Required unless `start` is false (then give it to Start contact import).
- `start` (boolean): `false` stages the import (status `staged`, kept 24 hours) until Start contact import. Defaults to `true`.
- `file_url` (string): Instead of `file`: a public https URL of the CSV, which send.io downloads now (at most 50 MB, status 200 without a redirect or sign-in, 20 an hour per team). For larger files use `upload`.
- `upload` (string): `url`: send no file; the answer's `upload_url` takes it later as a plain PUT, without an API key. With `start` true (the default) the import starts when the file arrives.
- `has_header` (boolean): `false` when the first row is data. column_map then uses column positions. Defaults to `true`.
- `delimiter` (string): `,` `;` `|` or `tab`. Guessed from the first line when omitted.
- `unsubscribed` (boolean): Give every imported contact this subscription state (instead of an `unsubscribed` column).
- `create_missing_properties` (boolean): Create the properties column_map.properties names that do not exist yet (as strings, or numbers with "type":"number"). A property made by an import is never `boolean` or `date`: create those first with Create contact property.
- `source` (string): A label stored on the import (lowercase letters, digits, `_ . : -`, at most 40). Defaults to `api`.
- `column_map.properties` (object): Property columns, as {"<property key>": {"column": "<CSV column>"}}. Only properties that already exist are imported. For an existing `boolean` or `date` property the cell must be true or false, or a day (2026-01-31) or time (2026-01-31T09:30:00Z); a row with another value fails with that reason.
- `on_conflict` (string): What to do when a contact with the email exists: `upsert` (update it) or `skip`. Defaults to `upsert`.
- `segments` (string (JSON)): Segments to add every imported contact to, as [{"id":"..."}] or ["..."] (segment ids). Manual segments only: a rule-based segment is a 422.
- `topics` (string (JSON)): Topic subscriptions to set on every imported contact, as [{"id":"...","subscription":"opt_in"}].

Example request body:

```json
{
  "upload": "url",
  "column_map": {
    "email": "Email",
    "first_name": "First name"
  }
}
```

- send.io extension.
- Send the request as multipart/form-data. Without a file (`upload` = `url`) a JSON body with the same fields works too.
- Every column named in `column_map` must exist in the file. A staged import shows the file's first row as `columns`, to map against.
- Rows with an invalid email count as `failed`. In the `unsubscribed` column, true, 1, yes and y mean unsubscribed.
- With `upload` = `url` the answer has `upload_url` (valid while the import is staged, 24 hours; one upload). PUT the CSV there as the raw body; gzip is accepted.

### List contact imports

`GET /contacts/imports` (https://developer.send.io/docs/api#list-contact-imports)

List the workspace's contact imports, newest first, with their status and row counts (the console's Contacts > Imports). The list leaves out `failed_rows`; retrieve one import to get them.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. Defaults to 20.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.
- `status` (string): Only imports with this status: `staged`, `queued`, `in_progress`, `completed` or `failed`.

- send.io extension.

### Retrieve contact import

`GET /contacts/imports/{import_id}` (https://developer.send.io/docs/api#get-contact-import)

Get the status, options and row counts of a contact import. `status` is `staged`, `queued`, `in_progress`, `completed` or `failed`; `error` explains a failure. A staged import waiting for its file has its `upload_url`. With `verify`, `verification` counts the imported addresses by verification result (`pending`, `valid`, `invalid`, `risky`, `unknown`) and says whether verification is `paused` for lack of credits; it is null without `verify`. `failed_rows` lists the first 1,000 rows that were not imported, each with its `line` in the file, its `email` and the `reason`.

Path parameters:

- `import_id` (string, required): The import id.

- send.io extension.

### Start contact import

`POST /contacts/imports/{import_id}/start` (https://developer.send.io/docs/api#start-contact-import)

Start a staged import. Every field is optional and replaces what the import was created with; the import is queued and runs like any other. If its file has not arrived at `upload_url` yet, it starts when it does.

Path parameters:

- `import_id` (string, required): The import id.

Body:

- `column_map` (object): As on Import contacts (header names or zero-based positions). Required if the import has none yet.
- `segments` (object[]): Segments to add every imported contact to, as [{"id":"..."}] or ["..."] (segment ids). Manual segments only: a rule-based segment is a 422.
- `topics` (object[]): Topic subscriptions to set, as [{"id":"...","subscription":"opt_in"}].
- `on_conflict` (string): `upsert` or `skip`.
- `unsubscribed` (boolean | null): Give every contact this subscription state; null uses the mapped column again.
- `has_header` (boolean): `false` when the first row is data.
- `create_missing_properties` (boolean): Create the mapped properties that do not exist yet.

Example request body:

```json
{
  "column_map": {
    "email": "Email",
    "first_name": "First name",
    "properties": {
      "plan": {
        "column": "Plan"
      }
    }
  },
  "segments": [
    {
      "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf"
    }
  ],
  "create_missing_properties": true
}
```

- send.io extension.
- Only a `staged` import can be started (409 otherwise). A staged import not started within 24 hours is deleted with its file (404).

### Upload an import file

`PUT /uploads/{token}` (https://developer.send.io/docs/api#upload-contact-import-file)

The `upload_url` of an import created with `upload` = `url`: PUT the CSV as the raw body (gzip accepted). No API key: the signed token is the authority, once, while the import is staged.

Path parameters:

- `token` (string, required): The signed token in `upload_url`.

- send.io extension.
- A second upload answers 409; an expired or unknown link 404. If the import was started (or created with `start` true) it is queued now.

### Export contacts

`GET /contacts/export` (https://developer.send.io/docs/api#export-contacts)

Download contacts as CSV (or JSON lines). With `signed=true` the answer is a short-lived link instead, which serves the same export without an API key.

Query parameters:

- `segment_id` (string): Only contacts in this segment. Repeat it for contacts in any of several segments (each once).
- `status` (string): `subscribed` or `unsubscribed`.
- `topic_id` (string): Only contacts subscribed to this topic.
- `search` (string): Matches email and name.
- `format` (string): `csv` (default) or `json` (one object per line, property values under `properties`).
- `column_names` (string (JSON)): Rename output columns, e.g. {"email":"EMAIL"} (with format json, "properties" renames the property object).
- `signed` (boolean): `true`: answer {url, expires_at}; the url works for one hour without an API key.

- send.io extension.
- Without `signed` the response is the file itself. Columns: id, email, first_name, last_name, unsubscribed, created_at, then one per contact property. One file holds at most 200,000 contacts, newest first; a larger export comes in parts: add `part=2`, `part=3` and so on for the rest. `summary=true` answers `{total, parts, part_rows, as_of}` without the file; pass the same `as_of` to every part.
- The signed link builds the file when it is fetched, from the contacts at that time.

## Audiences

The older Resend audience API, kept for existing code and SDKs. On send.io an audience is a segment: the same records, ids and data. Use Segments and Contacts for new code.

### Create audience

`POST /audiences` (https://developer.send.io/docs/api#create-audience)

Create an audience. This creates a segment.

Body:

- `name` (string, required): The audience name.

Example request body:

```json
{
  "name": "Registered users"
}
```

### Retrieve audience

`GET /audiences/{audience_id}` (https://developer.send.io/docs/api#get-audience)

Get an audience by id.

Path parameters:

- `audience_id` (string, required): The audience id. Audiences are segments, so a segment id works here.

### List audiences

`GET /audiences` (https://developer.send.io/docs/api#list-audiences)

List audiences, newest first. This returns all segments.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. When omitted, all items are returned.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.

- Rule-based segments are listed too, with `type: "rule"`, their `rule` and `sync`. They are read, renamed and deleted here like any audience; their rule is changed with Update segment, and contacts cannot be added to them by hand.

### Update audience

`PATCH /audiences/{audience_id}` (https://developer.send.io/docs/api#update-audience)

Rename an audience.

Path parameters:

- `audience_id` (string, required): The audience id. Audiences are segments, so a segment id works here.

Body:

- `name` (string, required): The new name.

Example request body:

```json
{
  "name": "All registered users"
}
```

- send.io extension.

### Delete audience

`DELETE /audiences/{audience_id}` (https://developer.send.io/docs/api#delete-audience)

Delete an audience. Its contacts are kept; only their membership is removed.

Path parameters:

- `audience_id` (string, required): The audience id. Audiences are segments, so a segment id works here.

### Create audience contact

`POST /audiences/{audience_id}/contacts` (https://developer.send.io/docs/api#create-audience-contact)

Create a contact and add it to the audience.

Path parameters:

- `audience_id` (string, required): The audience id. Audiences are segments, so a segment id works here.

Body:

- `email` (string, required): Email address. Must be unique within your team.
- `first_name` (string | null): First name. At most 200 characters; a longer one is refused with 422 `validation_error`, never cut short.
- `last_name` (string | null): Last name. At most 200 characters; a longer one is refused with 422 `validation_error`, never cut short.
- `unsubscribed` (boolean): Whether the contact is unsubscribed from all broadcasts. Defaults to false.
- `properties` (object): Custom property values keyed by property key. Each key must exist (create it with Create contact property) and the value must match its type, unless `create_missing_properties` is true. A `boolean` property takes true, false, or the text "true" or "false" (any case). A `date` property takes an RFC 3339 time (2026-01-31T09:30:00Z), a time without a zone (2026-01-31T09:30:00, read as UTC) or a day (2026-01-31, read as 00:00 UTC); it is stored and returned as RFC 3339 in UTC. A string value is at most 2,000 characters; a longer one is refused with 422 `validation_error` naming the property.
- `create_missing_properties` (boolean): send.io extension. When true, a key in `properties` with no contact property yet creates one instead of failing: `number` for a number value, otherwise `string` (booleans are stored as given, ISO dates as text). A property made this way is never `boolean` or `date`; create those with Create contact property. Values are also converted to an existing `string` or `number` property's type when that is unambiguous, such as "42" for a number property. Defaults to false.

Example request body:

```json
{
  "email": "steve.wozniak@acme.com",
  "first_name": "Steve",
  "last_name": "Wozniak",
  "unsubscribed": false
}
```

- Contacts are global per team, not per audience. If a contact with the email already exists, this fails with 409 even when it is not in this audience; use Add contact to segment instead.
- A rule-based segment is refused with 422 `validation_error` "This segment is rule-based: its members are decided by its rule." Its members are added and removed by its rule.

### List audience contacts

`GET /audiences/{audience_id}/contacts` (https://developer.send.io/docs/api#list-audience-contacts)

List the contacts in an audience, newest first.

Path parameters:

- `audience_id` (string, required): The audience id. Audiences are segments, so a segment id works here.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. When omitted, all items are returned.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.

### Retrieve audience contact

`GET /audiences/{audience_id}/contacts/{contact_id}` (https://developer.send.io/docs/api#get-audience-contact)

Get a contact by id or by email address. Same as Retrieve contact.

Path parameters:

- `audience_id` (string, required): The audience id. Audiences are segments, so a segment id works here.
- `contact_id` (string, required): The contact id or the contact's email address.

- The audience id is not checked; the contact is returned even if it is not in that audience.

### Update audience contact

`PATCH /audiences/{audience_id}/contacts/{contact_id}` (https://developer.send.io/docs/api#update-audience-contact)

Update a contact by id or by email address. Same body and rules as Update contact.

Path parameters:

- `audience_id` (string, required): The audience id. Audiences are segments, so a segment id works here.
- `contact_id` (string, required): The contact id or the contact's email address.

Body:

- `first_name` (string | null): First name, at most 200 characters. Send null to clear it.
- `last_name` (string | null): Last name, at most 200 characters. Send null to clear it.
- `unsubscribed` (boolean): Whether the contact is unsubscribed from all broadcasts.
- `properties` (object): Property values to set, merged into the existing ones. Send null for a key to remove it.
- `create_missing_properties` (boolean): send.io extension. Create properties for unknown keys and convert values to existing types. See Update contact.

Example request body:

```json
{
  "unsubscribed": true
}
```

- The audience id is not checked. The change applies to the contact everywhere.

### Delete audience contact

`DELETE /audiences/{audience_id}/contacts/{contact_id}` (https://developer.send.io/docs/api#delete-audience-contact)

Permanently delete the contact. The audience must exist.

Path parameters:

- `audience_id` (string, required): The audience id. Audiences are segments, so a segment id works here.
- `contact_id` (string, required): The contact id or the contact's email address.

- This deletes the contact from your team, not just from the audience. To only remove it from the audience, use Remove contact from segment.

## Segments

A segment is a group of contacts that broadcasts are sent to. A manual segment is a list you keep: add and remove contacts with the contact segment endpoints. A rule-based segment (send.io extension) keeps itself up to date: its members are the contacts that match its rule, such as "plan is pro and last logged in more than 30 days ago". When a contact changes, an event arrives or a time in the rule passes, the contact joins or leaves within a few seconds, not inside the request that made the change.

### Create segment

`POST /segments` (https://developer.send.io/docs/api#create-segment)

Create an empty manual segment, or a rule-based segment that fills itself from its rule.

Body:

- `name` (string, required): The segment name, at most 100 characters.
- `type` (string): send.io extension. `manual` (the default) or `rule`.
- `rule` (object): send.io extension. Required with `type: "rule"` and refused without it. Who the segment holds; see the notes for the format.
- `run_automations` (boolean): send.io extension, with a rule. Whether the contacts the first build puts in the segment start the automations and webhooks for entering it. Defaults to false: the segment fills silently, and only later joins and leaves start them.

Response fields:

- `sync` (object): Rule-based segments only: `status` is `building` until the first full pass has filled the segment, usually within seconds.

Example request body:

```json
{
  "name": "Dormant pros",
  "type": "rule",
  "rule": {
    "type": "and",
    "rules": [
      {
        "field": "contact.properties.plan",
        "operator": "eq",
        "value": "pro"
      },
      {
        "field": "events.user.logged_in.last_at",
        "operator": "more_than_days_ago",
        "value": 30
      }
    ]
  }
}
```

- A manual segment answers `{ object, id, name, type: "manual" }`.
- A rule is a group `{ type: "and" | "or", rules: [...] }` or one test `{ field, operator, value }`. Groups can be nested up to 5 levels deep, and a rule can hold up to 250 tests. A rule is at most 32 KB as JSON, an `in` or `not_in` list at most 1,000 values, and a text value at most 2,000 characters (the longest property value). These limits only keep one request from stalling the server. A workspace can have 500 rule-based segments at once; one more answers 422 `segment_limit_reached` (delete one, or ask support to raise the limit).
- Fields: `contact.email`, `contact.first_name`, `contact.last_name` (text), `contact.unsubscribed` (true or false), `contact.created_at` (date), `contact.properties.<key>` (a property that exists, in its type), and for an event you send, `events.<name>.last_at` and `events.<name>.first_at` (dates) and `events.<name>.count` (a number, 0 when it never happened). An event name may contain dots: `events.user.logged_in.last_at` reads the event `user.logged_in`.
- Operators: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `in`, `not_in`, `contains`, `not_contains`, `starts_with`, `ends_with`, `exists`, `not_exists`, `is_empty`, `is_not_empty`, and for dates `more_than_days_ago` and `within_last_days` with a whole number of days N as the value (0 to 3650 for `more_than_days_ago`, 1 to 3650 for `within_last_days`). A `boolean` field takes `eq`, `neq`, `exists` and `not_exists`; a `number` field the comparisons, `in`, `not_in`, `exists` and `not_exists`; a `date` field `gt`, `gte`, `lt`, `lte`, the two day operators, `exists` and `not_exists` (no `eq`: a date is a moment, not a day). A text field takes every operator.
- A value is fixed: it cannot read another field. A test that can never match (text compared with `gt`, a date that is not a date) is refused. A missing value matches only `not_exists`, so an event that never happened is not "more than 30 days ago"; add `{ field: "events.<name>.last_at", operator: "not_exists" }` in an `or` group to include those contacts. The rule reads a property's stored value, never its `fallback_value`.
- A rule that is not valid fails with 422 `validation_error` ("The rule is not valid: ...") and lists each problem in `errors`.
- A rule-based segment is created on `/segments` only; `POST /audiences` makes manual segments.
- Broadcasts to or excluding a segment that is still `building` wait for it (`hold_reason: "segment_building"`) and are sent when it is ready.
- No limit on the number of rule-based segments. Creating, changing and recounting one needs an Admin; any member may preview a rule.

### Retrieve segment

`GET /segments/{segment_id}` (https://developer.send.io/docs/api#get-segment)

Get a segment by id, with its member counts now.

Path parameters:

- `segment_id` (string, required): The segment id.

Response fields:

- `type` (string): send.io extension. `manual` or `rule`.
- `updated_at` (string): send.io extension. When the name or rule last changed.
- `rule` (object): Rule-based segments only. The rule, as it was sent.
- `sync` (object): Rule-based segments only. Whether the stored members match the rule now.
- `sync.status` (string): `building`: the segment is being filled after it was created or its rule changed, and its members do not match the rule yet. `ready`: built. `failed`: the build gave up; `error` says why, and Recount segment tries again.
- `sync.synced_at` (string | null): When the last full pass finished. Null before the first one.
- `sync.next_run_at` (string | null): When the next full pass is due: now while building, then a weekly check.
- `sync.error` (string | null): Why the build failed. Null unless `status` is `failed`.
- `contacts` (number): send.io extension. Members now.
- `subscribed` (number): send.io extension. Members a broadcast reaches now: `subscribed` in this segment and not unsubscribed from all email.
- `mass_moves` (array): Rule-based segments only. The clock hours in the last 7 days in which the rule moved more than 1,000 contacts and more than 25% of the segment's members in or out at once, newest first; empty when there were none. The team's admins are emailed about each one. Not on List segments.
- `mass_moves[].hour` (string): The start of the clock hour, in UTC.
- `mass_moves[].entered` (number): Contacts the rule moved into the segment in that hour (so far, while the hour is still running).
- `mass_moves[].left` (number): Contacts the rule moved out of the segment in that hour (so far, while the hour is still running).

- A manual segment has `type: "manual"` and no `rule`, `sync` or `mass_moves`.

### List segments

`GET /segments` (https://developer.send.io/docs/api#list-segments)

List segments, newest first.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. When omitted, all items are returned.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.
- `search` (string): send.io extension. Case-insensitive contains match on the segment name. Leading and trailing spaces are trimmed; at most 100 characters (longer is a 422). Combines with `limit`, `after` and `before`.
- `type` (string): send.io extension. `manual` or `rule`: only segments of that type. Any other value is a 422.

Response fields:

- `data[].type` (string): send.io extension. `manual` or `rule`.
- `data[].rule` (object): Rule-based segments only.
- `data[].sync` (object): Rule-based segments only; as on Retrieve segment.
- `data[].contacts` (number | null): Rule-based segments only. Members as of the last full pass; null before the first. Retrieve segment counts them now.
- `data[].subscribed` (number | null): Rule-based segments only. Subscribed members as of the last full pass; null before the first.

### Update segment

`PATCH /segments/{segment_id}` (https://developer.send.io/docs/api#update-segment)

Rename a segment, or change the rule of a rule-based segment.

Path parameters:

- `segment_id` (string, required): The segment id.

Body:

- `name` (string): The new name. Required unless `rule` is sent.
- `rule` (object): send.io extension, rule-based segments only. The new rule, in the format of Create segment. The segment builds again: contacts that no longer match leave and new matches join. A rule equal to the current one changes nothing. On a manual segment it is a 422: the type of a segment cannot be changed.
- `run_automations` (boolean): send.io extension, with `rule`. Whether the contacts the rebuild moves start the automations and webhooks for entering and leaving. Defaults to false.

Response fields:

- `type` (string): Rule-based segments only.
- `sync` (object): Rule-based segments only; `building` after a changed rule.

Example request body:

```json
{
  "rule": {
    "type": "and",
    "rules": [
      {
        "field": "contact.properties.plan",
        "operator": "eq",
        "value": "pro"
      },
      {
        "field": "events.user.logged_in.last_at",
        "operator": "more_than_days_ago",
        "value": 30
      }
    ]
  },
  "run_automations": false
}
```

- send.io extension.
- A manual segment answers `{ object, id }`.
- Use Preview segment rule with `segment_id` first to see how many contacts would join and leave.
- The rule of a segment is changed on `/segments` only; through `/audiences` it is a 422.

### Delete segment

`DELETE /segments/{segment_id}` (https://developer.send.io/docs/api#delete-segment)

Delete a segment. Its contacts are kept; only their membership is removed.

Path parameters:

- `segment_id` (string, required): The segment id.

- A segment that a pending broadcast or a running or paused automation uses is refused with 409 `resource_in_use`. Stopped and draft automations do not block the delete; they need a new segment before they can start again.
- Deleting a rule-based segment starts no automation and sends no `contact.segment_left`.

### Preview segment rule

`POST /segments/preview` (https://developer.send.io/docs/api#preview-segment-rule)

send.io extension. Count who a rule matches now, without saving anything. With `segment_id`, also how many contacts would join and leave that segment if it had this rule.

Body:

- `rule` (object, required): The rule, in the format of Create segment.
- `segment_id` (string): A segment to compare with: adds `entering` and `leaving`.

Response fields:

- `complete` (boolean): Whether every contact was read. False when the 5-second budget ran out: the counts are then estimates scaled from the contacts read.
- `scanned` (number): Contacts read.
- `total` (number): Contacts in the workspace.
- `matches` (number): Contacts the rule matches.
- `entering` (number): With `segment_id` only. Contacts the rule matches that are not members.
- `leaving` (number): With `segment_id` only. Members the rule does not match.
- `tracked_since` (object): Per event the rule reads (name in lower case): when send.io's record of it starts, or null when unknown. Older history can be loaded with Import event history.
- `no_record` (object): Per event the rule reads (name in lower case): contacts with no record of it.

Example request body:

```json
{
  "rule": {
    "type": "and",
    "rules": [
      {
        "field": "contact.properties.plan",
        "operator": "eq",
        "value": "pro"
      },
      {
        "field": "events.user.logged_in.last_at",
        "operator": "more_than_days_ago",
        "value": 30
      }
    ]
  },
  "segment_id": "d2b7f4e1-6a3c-4e8d-b1f5-9c0a2e4d6b8f"
}
```

- Any workspace member may call it. One preview runs at a time per workspace; a second one sent while the first is still running gets 429 `rate_limit_exceeded` at once.
- A rule that is not valid fails with 422, as on Create segment.

### Recount segment

`POST /segments/{segment_id}/recount` (https://developer.send.io/docs/api#recount-segment)

send.io extension. Check every contact against the rule of a rule-based segment now, and move the ones that changed. Contacts that join or leave start their automations and webhooks, as a change would. Normally not needed: membership already follows each change.

Path parameters:

- `segment_id` (string, required): The segment id.

Example request body:

```json
{}
```

- The recount runs in the background; Retrieve segment shows the new counts when it is done.
- Calling it again while a recount is waiting or running changes nothing: it answers 202 with the segment's current `sync`, and the running recount goes on (it is not started over).
- A segment that is `building` is refused with 409 `conflict`. A `failed` build or recount is tried again instead, from where it stopped (a build stays silent unless it was started with `run_automations`).
- A manual segment is refused with 422 "This segment is manual: it has no rule to count."

### List segment contacts

`GET /segments/{segment_id}/contacts` (https://developer.send.io/docs/api#list-segment-contacts)

List the contacts in a segment, newest first.

Path parameters:

- `segment_id` (string, required): The segment id.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. When omitted, all items are returned.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.

- send.io extension. `GET /contacts?segment_id=` returns the same list and also takes the other contact filters.
- send.io extension: each contact's `status` in this segment and `status_changed_at`, and the `status` filter (`subscribed`, `unsubscribed`, `cleaned` or `pending`).

### Update segment contact status

`PATCH /segments/{segment_id}/contacts/{contact_id}` (https://developer.send.io/docs/api#update-segment-contact)

send.io extension. Set a contact's subscription to one segment only, like a list member status: `subscribed`, `unsubscribed`, `cleaned` or `pending`. Broadcasts skip members that are not `subscribed` in the segments they target. A contact not in a manual segment is added with that status.

Path parameters:

- `segment_id` (string, required): The segment id.
- `contact_id` (string, required): The contact id or the contact's email address.

Body:

- `status` (string, required): `subscribed`, `unsubscribed`, `cleaned` or `pending`.

Response fields:

- `added` (boolean): Whether the contact was added to the segment by this call.
- `member` (boolean): Whether the contact is a member. False only for a rule-based segment the contact is not in (see the notes).
- `created_at` (string | null): When the contact joined the segment. Null when `member` is false.

Example request body:

```json
{
  "status": "unsubscribed"
}
```

- The contact-wide `unsubscribed` flag is unchanged: an unsubscribed contact gets no broadcast whatever its segment status.
- In a rule-based segment, a member's status can be set as in a manual one, but a contact the rule does not match is never added. For such a contact, `unsubscribed` and `cleaned` are kept for the day it joins, and the answer has `member: false` and `added: false`; `subscribed` and `pending` are refused with 422 `validation_error` "This segment is rule-based: its members are decided by its rule." A member that leaves keeps a status other than `subscribed` the same way, so a contact that unsubscribed from the segment is still unsubscribed when it joins again.
- Webhooks: `contact.updated` on any change, and `contact.list_unsubscribed` when the status becomes `unsubscribed` (the contact, plus `unsubscribed_segment_ids`, `source` and, from a broadcast's unsubscribe link, `broadcast_id`).
- Create contact accepts a status per segment too: `segments: [{ id, status }]`.

## Topics

Topics are subscription preferences, such as "Product updates". An `opt_in` topic reaches every contact who has not opted out; an `opt_out` topic reaches only contacts who opted in.

### Create topic

`POST /topics` (https://developer.send.io/docs/api#create-topic)

Create a topic.

Body:

- `name` (string, required): The topic name. At most 50 characters.
- `default_subscription` (string, required): `opt_in` or `opt_out`: the subscription of contacts who have made no choice. Cannot be changed later.
- `description` (string): Shown to contacts on the preferences page. At most 200 characters.
- `visibility` (string): `public` (shown on the preferences page) or `private`. Defaults to `private`.

Example request body:

```json
{
  "name": "Product updates",
  "default_subscription": "opt_in",
  "description": "New features and changes, about once a month.",
  "visibility": "public"
}
```

### Retrieve topic

`GET /topics/{topic_id}` (https://developer.send.io/docs/api#get-topic)

Get a topic by id.

Path parameters:

- `topic_id` (string, required): The topic id.

### List topics

`GET /topics` (https://developer.send.io/docs/api#list-topics)

List topics, newest first.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. Defaults to 20.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.
- `search` (string): send.io extension. Case-insensitive contains match on the topic name or description. Leading and trailing spaces are trimmed; at most 100 characters (longer is a 422). Combines with `limit`, `after` and `before`.

### Update topic

`PATCH /topics/{topic_id}` (https://developer.send.io/docs/api#update-topic)

Change a topic's name, description or visibility. Only the fields you send change.

Path parameters:

- `topic_id` (string, required): The topic id.

Body:

- `name` (string): The topic name. At most 50 characters; cannot be empty.
- `description` (string | null): At most 200 characters. Send null or an empty string to clear it.
- `visibility` (string): `public` or `private`.

Example request body:

```json
{
  "name": "Product news",
  "visibility": "private"
}
```

- `default_subscription` cannot be changed; sending it fails with 422.
- A `topic.updated` webhook is sent only when a value actually changes. A request that changes nothing (the same values again, or an empty body) still answers 200 with the topic id, but sends no webhook.

### Delete topic

`DELETE /topics/{topic_id}` (https://developer.send.io/docs/api#delete-topic)

Delete a topic.

Path parameters:

- `topic_id` (string, required): The topic id.

- A topic that a running or paused automation sends marketing email under, or starts on when a contact opts in, is refused with 409 `resource_in_use`. Stopped and draft automations do not block the delete; they need a new topic before they can start again.

## Contact properties

Contact properties define the custom fields a contact can have, such as `company`. Define a property before you set it on contacts, and use it in broadcasts as {{{contact.company}}}. A property has one of four types: `string`, `number`, `boolean` or `date`.

### Create contact property

`POST /contact-properties` (https://developer.send.io/docs/api#create-contact-property)

Define a custom contact property.

Body:

- `key` (string, required): Letters, digits and underscores, at most 50 characters. Unique within your team. Cannot be changed later.
- `type` (string, required): `string`, `number`, `boolean` or `date`. Cannot be changed later. Any other value fails with 422 "type must be string, number, boolean or date."
- `fallback_value` (string | number | boolean | null): Used in broadcasts when a contact has no value. Must match `type`: text for `string`, a number for `number`, true or false (or the text "true" or "false") for `boolean`, and for `date` an RFC 3339 time or a day such as 2026-01-31, stored as RFC 3339 in UTC. Anything else fails with 422 "fallback_value must be a <type>."

Example request body:

```json
{
  "key": "company",
  "type": "string",
  "fallback_value": "your company"
}
```

- A second property with the same key fails with 409.
- `boolean` and `date` are send.io extensions (Resend has `string` and `number`). Their values are checked on every write: a contact's value for a `boolean` property is stored as true or false, and for a `date` property as an RFC 3339 time in UTC. See Create contact for the accepted forms.
- In a CSV import, a cell for a `boolean` property must be true or false (any case) and a cell for a `date` property a day (2026-01-31) or a time (2026-01-31T09:30:00Z); a row with another value is not imported and reports the reason.

### Retrieve contact property

`GET /contact-properties/{contact_property_id}` (https://developer.send.io/docs/api#get-contact-property)

Get a contact property by id.

Path parameters:

- `contact_property_id` (string, required): The contact property id.

Response fields:

- `type` (string): `string`, `number`, `boolean` or `date`.
- `fallback_value` (string | number | boolean | null): The fallback, in the property's type; a date fallback is an RFC 3339 time in UTC. Null when there is none.

- A request whose `User-Agent` starts with `resend-` (Resend's own SDKs, which only know `string` and `number`) is shown `boolean` and `date` properties as `type: "string"`, and boolean values as the text `"true"` or `"false"`. Every other client, send.io's SDKs included, gets the real types.

### List contact properties

`GET /contact-properties` (https://developer.send.io/docs/api#list-contact-properties)

List contact properties, newest first.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. Defaults to 20.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.
- `search` (string): send.io extension. Case-insensitive contains match on the property key. Leading and trailing spaces are trimmed; at most 100 characters (longer is a 422). Combines with `limit`, `after` and `before`.

Response fields:

- `data[].type` (string): `string`, `number`, `boolean` or `date`.
- `data[].fallback_value` (string | number | boolean | null): The fallback, in the property's type. Null when there is none.

- A request whose `User-Agent` starts with `resend-` (Resend's own SDKs, which only know `string` and `number`) is shown `boolean` and `date` properties as `type: "string"`, and boolean values as the text `"true"` or `"false"`. Every other client, send.io's SDKs included, gets the real types.

### Update contact property

`PATCH /contact-properties/{contact_property_id}` (https://developer.send.io/docs/api#update-contact-property)

Change a property's fallback value.

Path parameters:

- `contact_property_id` (string, required): The contact property id.

Body:

- `fallback_value` (string | number | boolean | null): The new fallback. Must match the property's type, as on Create contact property. Null or omitted clears it.

Example request body:

```json
{
  "fallback_value": "your team"
}
```

- `key` and `type` cannot be changed; sending either fails with 422.

### Delete contact property

`DELETE /contact-properties/{contact_property_id}` (https://developer.send.io/docs/api#delete-contact-property)

Delete a property. Its value is removed from every contact.

Path parameters:

- `contact_property_id` (string, required): The contact property id.

## Broadcasts

A broadcast sends one email to every subscribed contact in a segment, personalized per contact, with an unsubscribe link and one-click List-Unsubscribe headers. Statuses: `draft`, `scheduled`, `queued` (sending), `sent` and `canceled`.

### Create broadcast

`POST /broadcasts` (https://developer.send.io/docs/api#create-broadcast)

Create a draft broadcast. Every field may be left out: a draft is saved as it is and completed later. Set `send: true` to send it right away or at `scheduled_at`; that needs `from`, `subject`, an `html` or `text` body and recipients.

Body:

- `segment_id` (string): The segment to send to (the single-segment form of `segment_ids`). `audience_id` is accepted as an alias. One of `segment_id`, `segment_ids` or `audience: "all"` is required to send the broadcast (with `send: true`, on create); a draft can be saved without recipients.
- `audience_id` (string): Older name for `segment_id`.
- `segment_ids` (string[]): send.io extension. Several segments to send to: a contact in more than one gets one email. Combined with `segment_id` when both are sent. Replaces the broadcast's segments on update.
- `exclude_segment_ids` (string[]): send.io extension. Members of these segments are never sent the broadcast, whatever their status in them. Send an empty array or null to remove the exclusions.
- `audience` (string): send.io extension. `segments` (the default: the subscribed members of the segments) or `all` (every contact of the team, minus exclusions). `all` cannot be combined with `segment_id` or `segment_ids`; setting segments later switches back to `segments`.
- `unsubscribe_scope` (string): send.io extension. What the broadcast's unsubscribe link and one-click List-Unsubscribe do: `all` (the default: the contact is unsubscribed from everything, or opted out of `topic_id` when one is set) or `list` (the contact's status becomes `unsubscribed` in the broadcast's segments only, and `contact.list_unsubscribed` is sent). With `list`, the preference page also offers "Unsubscribe from everything".
- `from` (string | null): Sender address, e.g. "Acme <news@acme.com>". Required to send the broadcast, and its domain must be verified by then. A draft can be saved without it; an empty string clears it.
- `subject` (string | null): Subject line. Cannot contain line breaks. Merge tags such as {{{contact.first_name|there}}} are filled in per contact. Required to send the broadcast; a draft can be saved without it.
- `reply_to` (string | string[]): One or more reply-to addresses.
- `html` (string): HTML body. Supports contact merge tags and {{{unsubscribe_url}}}.
- `template_engine` (string): send.io extension. How the subject, HTML and text are filled in for each contact: `simple` (the default: contact merge tags such as {{{contact.first_name|there}}} and {{{unsubscribe_url}}}) or `handlebars` (Handlebars with the contact as data: `contact.first_name`, `contact.<property>`, `unsubscribe_url`, plus `if`, `each` and the other helpers templates support). Handlebars content that does not parse is refused with a 422 naming the part.
- `template_id` (string | null): send.io extension. Make the broadcast from a published template (id or alias): its HTML, text, design and template engine become the broadcast's content, and its subject, preview text, From and Reply-To fill those the request and the broadcast leave empty. The content is a copy of the exact version (`template_version_id`): later publishes do not change the broadcast.
- `template_version_id` (string): send.io extension. The published version of the template to copy (a version that was published, even if another one is live now). Default: the template's published version.
- `text` (string): Plain text body. When omitted on create and `html` is set, a text version is generated from the HTML. Send an empty string to have no text part.
- `name` (string | null): Internal name, shown only to you.
- `preview_text` (string | null): Preview text shown by mail clients after the subject.
- `topic_id` (string | null): Send only to contacts subscribed to this topic. Send null to remove the topic.
- `tracking` (boolean): send.io extension. Count opens and clicks when the sender domain's tracking subdomain is active. Defaults to true.
- `send_time_optimization` (object | null): send.io extension. `{"enabled": true, "window_hours": 24}` sends each contact's copy shortly before the hour that contact usually opens email, learned from their past opens and clicks. The scheduled time becomes the earliest send time, and every copy goes out within `window_hours` (6, 12 or 24) of it. Contacts with too little history get it at the scheduled time, or at the hour your audience opens most; one contact in ten always gets it at the scheduled time, so the broadcast's stats can compare. While it waits between rounds the broadcast stays `queued` with `hold_reason` `send_time_wait` and `hold_until` set to the next round. Defaults to off; null turns it off. Can also be set on `POST /broadcasts/{id}/send`.
- `version_name` (string): send.io extension. A name for the version this save records (see List broadcast versions). At most 100 characters.
- `version_comment` (string): send.io extension. A comment for the version this save records. At most 1000 characters.
- `send` (boolean): Send the broadcast after creating it. Defaults to false (a draft).
- `scheduled_at` (string): When to send: an ISO 8601 timestamp or a relative time like "in 30 minutes", "in 2 hours" or "in 3 days". Must be in the future and within 30 days. Requires `send: true`.

Example request body:

```json
{
  "name": "October newsletter",
  "segment_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "from": "Acme <news@acme.com>",
  "subject": "What's new at Acme, {{{contact.first_name|there}}}",
  "reply_to": "support@acme.com",
  "preview_text": "Three new features and a webinar invite.",
  "html": "<p>Hi {{{contact.first_name|there}}},</p><p>Here is what's new.</p><p><a href=\"{{{unsubscribe_url}}}\">Unsubscribe</a></p>",
  "topic_id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
  "tracking": true
}
```

- Without `send: true` nothing is required (send.io extension: a draft can be saved before it is complete). With `send: true`, a missing `from`, `subject`, body or recipients is a 422 and no broadcast is created.
- Each create and each later update of a draft or scheduled broadcast saves a version (see List broadcast versions).
- send.io extension: `tracking` (boolean, default true). Opens and clicks are counted only when the sender domain's tracking subdomain is active. Broadcasts follow this field, not the domain's open and click tracking settings.
- Merge tags: {{{contact.first_name}}}, {{{contact.last_name}}}, {{{contact.email}}}, {{{contact.<property key>}}} with an optional |fallback, and {{{unsubscribe_url}}} (also {{{RESEND_UNSUBSCRIBE_URL}}}). A bare {{{<property key>}}} that names one of your contact properties is that property too, so a template variable with a property's key is filled per contact.
- Without `text`, a text part is generated from `html` with every link address kept. Updating `html` alone regenerates a generated text part; a `text` you wrote is kept. The sent text part always carries the unsubscribe link when the html has one.
- `subject` can be at most 998 characters.
- Unsubscribed contacts, and contacts not subscribed to `topic_id` when one is set, are skipped.
- send.io extension: the audience is the union of `segment_ids` (or every contact with `audience: "all"`) minus members of `exclude_segment_ids`, one email per contact. A contact is sent the broadcast when its status is `subscribed` in at least one targeted segment (see Update segment contact status); with `audience: "all"` only the contact-wide unsubscribe and the topic apply.

### Retrieve broadcast

`GET /broadcasts/{broadcast_id}` (https://developer.send.io/docs/api#get-broadcast)

Get a broadcast by id, including its content.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

Response fields:

- `template_id` (string | null): The template the broadcast was made from; null for a broadcast with its own content.
- `template_version_id` (string | null): The exact published template version whose content the broadcast copied.
- `template_name` (string | null): That template's name.
- `template_version_number` (number | null): That version's number.
- `template_version_name` (string | null): That version's name, when it has one.
- `template_deleted` (boolean): True when the template was deleted since. The broadcast keeps its copy and still sends.
- `unfillable_variables` (string[]): Only on a broadcast made from a template: the template variables its content uses that have no value in a broadcast (not a contact field and no fallback value in the template). While it is not empty, the broadcast cannot be sent or scheduled.

- `audience_id` and `segment_id` hold the same value: the first of `segment_ids` (null with `audience: "all"`). `design` holds the dashboard editor's document and is null for broadcasts created by API.
- send.io extension: `segment_ids`, `exclude_segment_ids`, `audience` and `unsubscribe_scope`.
- send.io extension: the template link (`template_id`, `template_version_id`, `template_name`, `template_version_number`, `template_version_name`, `template_deleted`) and, for a broadcast made from a template, `unfillable_variables`.
- Template variables in a broadcast: a broadcast fills contact fields per contact. A variable the template declares that is not a contact field is filled with the fallback value the template version gives it; one with no fallback cannot be filled and is listed in `unfillable_variables`.
- send.io extension: `updated_at` and `version_number`, the state an update made from this read expects (see `expected_updated_at` on Update broadcast).
- send.io extension: `warnings` lists each segment or topic the broadcast still names that was deleted since it was chosen, as `{code: "segment_deleted", field: "segment_ids" | "exclude_segment_ids", segment_id, message}` or `{code: "topic_deleted", field: "topic_id", topic_id, message}`. The broadcast cannot be sent until they are removed.
- send.io extension: `unknown_merge_tags` lists the merge tags in the subject or preview text that are neither a contact field nor a variable of the linked template, as `{part: "subject" | "preview_text", tag}`. They would be sent as typed, so sending is refused until they are fixed.
- send.io extension: `tracking_status` says whether its opens and clicks can be counted with its From and `tracking` as they are now: `tracked`, `off` (`tracking` is false), or `no_tracking_host` (the sending domain has no active tracking subdomain and the sender is not a free mailbox, so opens and clicks stay at 0); null while it has no valid From. A free mailbox's broadcast is tracked on its pool's shared tracking host.

### List broadcasts

`GET /broadcasts` (https://developer.send.io/docs/api#list-broadcasts)

List broadcasts, newest first. Content fields are left out; retrieve a broadcast to get them.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. When omitted, all items are returned.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.
- `status` (string): Only broadcasts with this status: `draft`, `scheduled`, `queued`, `sent`, `canceled` or `failed`.
- `segment_id` (string): Only broadcasts sent to this segment (any of their `segment_ids`).
- `search` (string): send.io extension. Case-insensitive contains match on the broadcast name. Leading and trailing spaces are trimmed; at most 100 characters (longer is a 422). Combines with `status`, `segment_id`, `limit`, `after` and `before`.

Response fields:

- `data[].template_name` (string | null): The name of the template the broadcast was made from; null for one with its own content.

- send.io extension: the `status` and `segment_id` filters, and `template_name` on each item.

### Update broadcast

`PATCH /broadcasts/{broadcast_id}` (https://developer.send.io/docs/api#update-broadcast)

Update a draft or scheduled broadcast. Only the fields you send change, and each update saves a new version. Once a broadcast is sending or sent, only `name` can be changed.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

Body:

- `segment_id` (string): The segment to send to (the single-segment form of `segment_ids`). `audience_id` is accepted as an alias. One of `segment_id`, `segment_ids` or `audience: "all"` is required to send the broadcast.
- `audience_id` (string): Older name for `segment_id`.
- `segment_ids` (string[]): send.io extension. Several segments to send to: a contact in more than one gets one email. Combined with `segment_id` when both are sent. Replaces the broadcast's segments on update.
- `exclude_segment_ids` (string[]): send.io extension. Members of these segments are never sent the broadcast, whatever their status in them. Send an empty array or null to remove the exclusions.
- `audience` (string): send.io extension. `segments` (the default: the subscribed members of the segments) or `all` (every contact of the team, minus exclusions). `all` cannot be combined with `segment_id` or `segment_ids`; setting segments later switches back to `segments`.
- `unsubscribe_scope` (string): send.io extension. What the broadcast's unsubscribe link and one-click List-Unsubscribe do: `all` (the default: the contact is unsubscribed from everything, or opted out of `topic_id` when one is set) or `list` (the contact's status becomes `unsubscribed` in the broadcast's segments only, and `contact.list_unsubscribed` is sent). With `list`, the preference page also offers "Unsubscribe from everything".
- `from` (string | null): Sender address, e.g. "Acme <news@acme.com>". Required to send the broadcast, and its domain must be verified by then. A draft can be saved without it; an empty string clears it.
- `subject` (string | null): Subject line. Cannot contain line breaks. Merge tags such as {{{contact.first_name|there}}} are filled in per contact. Required to send the broadcast; a draft can be saved without it.
- `reply_to` (string | string[]): One or more reply-to addresses.
- `html` (string): HTML body. Supports contact merge tags and {{{unsubscribe_url}}}.
- `template_engine` (string): send.io extension. How the subject, HTML and text are filled in for each contact: `simple` (the default: contact merge tags such as {{{contact.first_name|there}}} and {{{unsubscribe_url}}}) or `handlebars` (Handlebars with the contact as data: `contact.first_name`, `contact.<property>`, `unsubscribe_url`, plus `if`, `each` and the other helpers templates support). Handlebars content that does not parse is refused with a 422 naming the part.
- `template_id` (string | null): send.io extension. Make the broadcast from a published template (id or alias): its HTML, text, design and template engine become the broadcast's content, and its subject, preview text, From and Reply-To fill those the request and the broadcast leave empty. The content is a copy of the exact version (`template_version_id`): later publishes do not change the broadcast. `null` detaches the broadcast from its template (the content stays). Cannot be combined with `html`, `text`, `design` or `template_engine` (422).
- `template_version_id` (string): send.io extension. The published version of the template to copy (a version that was published, even if another one is live now). Default: the template's published version. Sent alone, it switches the broadcast to another version of its template (422 when the broadcast is not made from a template).
- `text` (string): Plain text body. When omitted on create and `html` is set, a text version is generated from the HTML. Send an empty string to have no text part.
- `name` (string | null): Internal name, shown only to you.
- `preview_text` (string | null): Preview text shown by mail clients after the subject.
- `topic_id` (string | null): Send only to contacts subscribed to this topic. Send null to remove the topic.
- `tracking` (boolean): send.io extension. Count opens and clicks when the sender domain's tracking subdomain is active. Defaults to true.
- `send_time_optimization` (object | null): send.io extension. `{"enabled": true, "window_hours": 24}` sends each contact's copy shortly before the hour that contact usually opens email, learned from their past opens and clicks. The scheduled time becomes the earliest send time, and every copy goes out within `window_hours` (6, 12 or 24) of it. Contacts with too little history get it at the scheduled time, or at the hour your audience opens most; one contact in ten always gets it at the scheduled time, so the broadcast's stats can compare. While it waits between rounds the broadcast stays `queued` with `hold_reason` `send_time_wait` and `hold_until` set to the next round. Defaults to off; null turns it off. Can also be set on `POST /broadcasts/{id}/send`.
- `version_name` (string): send.io extension. A name for the version this save records (see List broadcast versions). At most 100 characters.
- `version_comment` (string): send.io extension. A comment for the version this save records. At most 1000 characters.
- `expected_updated_at` (string): send.io extension. The `updated_at` you loaded. When the broadcast changed since (in another tab, by a teammate or through the API), the update is refused with 409 `conflict` instead of overwriting the other change. An `If-Match` header holding the same value works too.

Example request body:

```json
{
  "subject": "October at Acme: three new features",
  "tracking": false,
  "expected_updated_at": "2026-10-08T14:58:03.120451+00:00"
}
```

- send.io extension: the response carries the new `updated_at` (send it as `expected_updated_at` on the next update), the `version_number` of the version this save recorded, `warnings` (deleted segments and topic), `unknown_merge_tags`, `from` and `tracking_status`, as on Retrieve broadcast, and `unfillable_variables` for a broadcast made from a template.
- Returns 409 `conflict` when `expected_updated_at` (or `If-Match`) does not match: reload the broadcast and try again. Without either, the update behaves as before.
- A segment or topic deleted since it was chosen is kept and listed in `warnings`, so a draft still saves. A scheduled broadcast must stay sendable: an update that leaves it incomplete, adds a deleted segment or topic, or adds a merge tag that would be sent as typed is refused with 422 and changes nothing. One that only keeps a deleted segment or topic it already named saves. When it falls due, a deleted segment under Send to only reaches nobody, so the rest are sent to; a deleted segment under Except, or a deleted topic, pauses it instead (see Resume broadcast). An id that never was a segment or topic of the team is a 404.
- A broadcast made from a template: sending `html`, `text`, `design` or `template_engine` gives it its own content and detaches it from the template (`template_id` becomes null). `template_id` or `template_version_id` together with those fields is a 422.
- Since November 2026, `template_id` on an update no longer overwrites a subject, preview text, From or Reply-To the broadcast already has: those are filled from the template only where the broadcast has none. Send them explicitly to change them.

### Delete broadcast

`DELETE /broadcasts/{broadcast_id}` (https://developer.send.io/docs/api#delete-broadcast)

Delete a draft or scheduled broadcast. A scheduled broadcast is deleted before it sends.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

- Broadcasts that are sending, sent or canceled cannot be deleted (422).

### Send broadcast

`POST /broadcasts/{broadcast_id}/send` (https://developer.send.io/docs/api#send-broadcast)

Send a draft broadcast now, or schedule it with `scheduled_at`.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

Body:

- `scheduled_at` (string): When to send: an ISO 8601 timestamp or a relative time like "in 30 minutes", "in 2 hours" or "in 3 days". Must be in the future and within 30 days. Omit to send now.
- `now` (boolean): send.io extension. `true` sends a `scheduled` broadcast now, in one step: when that is refused, the broadcast stays scheduled at its time. Not with `scheduled_at` (422).

Example request body:

```json
{
  "scheduled_at": "in 1 hour"
}
```

- Send a `scheduled` broadcast again to move it: with a new `scheduled_at` it is rescheduled, with `now: true` it sends now (send.io extension). With neither, a second send is refused with 422, so a double send never queues it twice.
- A broadcast that names a segment or topic deleted since it was chosen (see `warnings` on Retrieve broadcast) is refused with 422 `validation_error` naming it; remove it first. A merge tag in the subject or preview text that would be sent as typed is refused with 422 `unknown_merge_tags`: "`{{{FIRST_NAM}}}` in the subject is not a contact field or a variable of the template, so it would be sent as typed. Fix the tag or remove it."
- Only a `draft` or `scheduled` broadcast can be sent. It must have a `from` address, a `subject`, an `html` or `text` body and recipients (422 naming what is missing), and the `from` domain must be verified, or the call fails with 403.
- A broadcast made from a template whose content uses a variable with no value in a broadcast (see `unfillable_variables` on Retrieve broadcast) is refused, now or scheduled, with 422 `unfillable_variables`: "`{{{RESET_URL}}}` has no value in a broadcast: give it a fallback value in the template, or use a contact field instead." The body lists the keys in `unfillable_variables`.
- It sends the broadcast's current content: the newest saved version.
- A broadcast to or excluding a rule-based segment that is being built waits, with `hold_reason: "segment_building"`, and is sent when the segment is ready. If the build fails, the broadcast fails with `failed_reason` `segment_sync_failed`. A contact that changed a second or two before the send may not have joined or left yet.
- The request body is required, even though every field is optional: send `{}` to send now. A request with no body is refused with 422.
- A broadcast created in the dashboard cannot be sent with an API key; send it from the dashboard.

### Cancel broadcast

`POST /broadcasts/{broadcast_id}/cancel` (https://developer.send.io/docs/api#cancel-broadcast)

Stop a broadcast. A scheduled broadcast goes back to `draft`; a sending (`queued`) broadcast stops and becomes `canceled`.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

- send.io extension.
- Emails already handed off before a cancel are still delivered.
- A paused broadcast can be canceled too: nobody after where it paused gets the email.

### Pause broadcast

`POST /broadcasts/{broadcast_id}/pause` (https://developer.send.io/docs/api#pause-broadcast)

Pause a sending (`queued`) broadcast after the batch in flight. It stays `queued` with `paused_at` set and resumes from the next recipient.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

- send.io extension. Answers with the whole broadcast.
- Pausing a paused broadcast changes nothing. A broadcast just sent now (or whose scheduled time has come) pauses before its first recipient. A scheduled broadcast still in the future, or one that is not sending, is a 409.
- Up to one batch (1,000 recipients) that was already being handed off still goes out.

### Resume broadcast

`POST /broadcasts/{broadcast_id}/resume` (https://developer.send.io/docs/api#resume-broadcast)

Resume a paused broadcast from the next recipient. `paused_at` becomes null.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

Body:

- `remove_deleted` (string[]): The deleted segment and topic ids, as the broadcast's `warnings` list them (`segment_id`, `topic_id`), to take out of its audience before it goes on. Only ids that are deleted and named are removed.

Example request body:

```json
{
  "remove_deleted": [
    "78261eea-8f8b-4381-83c6-79fa7120f1cf"
  ]
}
```

- send.io extension. Answers with the whole broadcast.
- Resuming a broadcast that is sending and not paused changes nothing. A broadcast that is not sending is a 409.
- A segment under Except, or the topic, deleted while a broadcast is due or sending would no longer leave anybody out, so the broadcast is paused where it is (`paused_at` set, nothing more sent). It resumes only once they are out of its audience: pass them in `remove_deleted`, or it is a 422 `audience_deleted` that names them. Contacts it already emailed do not get it again.

### Continue broadcast

`POST /broadcasts/{broadcast_id}/continue` (https://developer.send.io/docs/api#continue-broadcast)

Continue a broadcast that stopped part way: one that was canceled while sending, or failed with `failed_reason` `insufficient_credits` or `send_error`. It is `queued` again and sends only to the contacts of its audience it has not emailed yet, so nobody it reached gets it twice.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

Body:

- `remove_deleted` (string[]): The deleted segment and topic ids, as the broadcast's `warnings` list them, to take out of its audience before it goes on (as on Resume broadcast).

- send.io extension. Answers with the whole broadcast.
- The audience is read as it is now: contacts that joined since are included, contacts that left are not.
- Any other status or failure (for example `all_recipients_failed` or `no_audience`) is a 422 `validation_error`: duplicate the broadcast instead. The copy goes to everyone in its audience again.
- Its audience can no longer be edited, so a segment or topic deleted since is handled here: a deleted segment under Send to reaches nobody and is left as it is; a deleted segment under Except, or a deleted topic, is a 422 `audience_deleted` unless `remove_deleted` lists it.
- It must still be sendable, as on Send broadcast (From on a verified domain, subject, body, recipients). With a credits plan and no credits left it is refused with 422 `insufficient_credits` before anything is queued.
- Right after a stop, while the batch that was in flight is still being handed off (up to about a minute), it is refused with 422; try again shortly.
- A broadcast created in the dashboard cannot be continued with an API key.

### Duplicate broadcast

`POST /broadcasts/{broadcast_id}/duplicate` (https://developer.send.io/docs/api#duplicate-broadcast)

Copy a broadcast into a new draft with the same segment, topic, sender, content and tracking setting. The copy's name ends in "(copy)".

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

- send.io extension. The copy starts its own version history.
- The copy is a new broadcast: it goes to everyone in its audience again, including contacts the original already emailed. To reach only the rest of a broadcast that stopped part way, use Continue broadcast.

### List broadcast versions

`GET /broadcasts/{broadcast_id}/versions` (https://developer.send.io/docs/api#list-broadcast-versions)

Every saved version of a broadcast, newest first. Each create, update, duplicate and restore of a draft or scheduled broadcast saves one, with the whole broadcast as saved: content, sender and audience.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

Query parameters:

- `limit` (number): Number of versions to return, 1 to 100. Defaults to 20.
- `after` (string): Return the versions older than this version id or version number (the next page). Cannot be used with `before`.
- `before` (string): Return the versions newer than this version id or version number (the previous page). Cannot be used with `after`.

- send.io extension. `current` marks the version the broadcast holds now, the one it sends. There is no published version: a broadcast sends its current content when it sends.

### Retrieve broadcast version

`GET /broadcasts/{broadcast_id}/versions/{version}` (https://developer.send.io/docs/api#retrieve-broadcast-version)

One version with its full content, sender and audience.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.
- `version` (string, required): The version id or its `version_number`.

- send.io extension.

### Update broadcast version

`PATCH /broadcasts/{broadcast_id}/versions/{version}` (https://developer.send.io/docs/api#update-broadcast-version)

Rename a version or change its comment. A version's content cannot change: update the broadcast to save a new version.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.
- `version` (string, required): The version id or its `version_number`.

Body:

- `name` (string | null): Version name. At most 100 characters.
- `comment` (string | null): Version comment. At most 1000 characters.

Example request body:

```json
{
  "name": "Final copy",
  "comment": "Approved by marketing."
}
```

- send.io extension. Any other field returns 422.

### Restore broadcast version

`POST /broadcasts/{broadcast_id}/versions/{version}/restore` (https://developer.send.io/docs/api#restore-broadcast-version)

Copy a saved version (content, sender and audience) back into a draft or scheduled broadcast. The result is saved as a new version, so the history only grows. Nothing is sent: a scheduled broadcast keeps its time.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.
- `version` (string, required): The version id or its `version_number`.

Body:

- `version_name` (string): A name for the new version.
- `version_comment` (string): A comment for the new version.

- send.io extension. A broadcast that is sending, sent or canceled cannot be restored (422).
- Segments and a topic deleted since the version was saved are left out.

### Estimate recipients

`POST /broadcasts/estimate` (https://developer.send.io/docs/api#estimate-broadcast)

How many contacts an audience reaches right now, before you create or send the broadcast, and how many it skips because their address is marked invalid.

Body:

- `segment_id` (string): One segment to send to.
- `segment_ids` (string[]): Several segments: a contact in more than one counts once.
- `exclude_segment_ids` (string[]): Members of these segments are not counted.
- `audience` (string): `all` counts every contact (minus exclusions); `segments` (the default) the segments' subscribed members.
- `topic_id` (string): Leave out contacts who are not subscribed to this topic.

Example request body:

```json
{
  "segment_ids": [
    "78261eea-8f8b-4381-83c6-79fa7120f1cf"
  ],
  "exclude_segment_ids": []
}
```

- send.io extension. Unsubscribed contacts are not counted. Suppressed addresses are skipped when the broadcast sends, so the number sent can be a little lower.
- Contacts whose address is marked invalid (it cannot receive mail) are never sent to and are counted in `skipped.invalid`.
- With no segment and no `audience: "all"` the estimate is 0.
- A segment or topic deleted since it was chosen is not an error: it is listed in `warnings` (as on Retrieve broadcast). A deleted segment has no members, and a deleted topic is left out of the count. An id that never was a segment or topic of the team is a 404.

### Send test broadcast

`POST /broadcasts/{broadcast_id}/test` (https://developer.send.io/docs/api#test-broadcast)

Send a test of a broadcast to up to 5 addresses. Each test is personalized with sample values (Ada Lovelace, ada@example.com), or with the contact you choose with `contact_id`, and its subject starts with `[Test]`.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

Body:

- `to` (string[], required): 1 to 5 addresses to send the test to.
- `contact_id` (string): A contact of the broadcast's audience (its id or email address) to personalize the test with. A contact outside the audience is a 404.

Example request body:

```json
{
  "to": [
    "you@example.com"
  ]
}
```

- send.io extension. Tests do not count as sends and do not change the broadcast.
- The broadcast needs a `from` address, a `subject` and an `html` or `text` body (422 naming what is missing).
- A test is not refused for `unfillable_variables`, so you can see the email without their values.

### Retrieve broadcast stats

`GET /broadcasts/{broadcast_id}/stats` (https://developer.send.io/docs/api#broadcast-stats)

The numbers of a broadcast: how many it was sent and delivered to, opens, clicks, bounces, complaints and unsubscribes, with rates and sending progress.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

- send.io extension. Rates are fractions: delivery over sent, opens, clicks and unsubscribes over delivered (unique), bounces over sent.
- Numbers are cached for up to 60 seconds (5 seconds while the broadcast is scheduled or sending).

### List broadcast recipients

`GET /broadcasts/{broadcast_id}/recipients` (https://developer.send.io/docs/api#list-broadcast-recipients)

The recipients of a broadcast, all of them or for one event: who it was sent or delivered to, who opened or clicked, bounced, complained, unsubscribed, or was suppressed. Each row has its latest `status`.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

Query parameters:

- `type` (string, required): `all`, `sent`, `delivered`, `opened`, `clicked`, `bounced`, `complained`, `unsubscribed` or `suppressed`. `all` (send.io extension) lists every recipient, suppressed and failed ones included.
- `email` (string): Only recipients whose address contains this text.
- `bounce_type` (string): `permanent`, `transient` or `undetermined`. Only with `type=bounced`.
- `limit` (number): Number of recipients to return, 1 to 100. Defaults to 20.
- `after` (string): Return the recipients after this `id` (the next page). Cannot be used with `before`.
- `before` (string): Return the recipients just before this `id` (the previous page). Cannot be used with `after`.

- `id` is a pagination cursor, not an entity id. `count` is returned for `opened` and `clicked`, `clicked_links` for `clicked`, `bounce_type` for `bounced`.
- `contact_id` is null when the recipient is not, or no longer, a contact.
- `status` (send.io extension) is the recipient's latest status, strongest first: `unsubscribed`, `complained`, `bounced`, `suppressed`, `failed`, `clicked`, `opened`, `delivered`, `delivery_delayed`, `sent` or `queued`. With `type=all` or `suppressed`, a suppressed row also has `suppression_reason`: `bounce`, `complaint` or `manual` (the origin of the suppression on the address), or null once that suppression was removed.

### List broadcast clicked links

`GET /broadcasts/{broadcast_id}/clicked-links` (https://developer.send.io/docs/api#list-broadcast-clicked-links)

The links clicked in a broadcast, most clicked first, with total clicks and the number of recipients who clicked.

Path parameters:

- `broadcast_id` (string, required): The broadcast id.

Query parameters:

- `limit` (number): Number of links to return, 1 to 100. Defaults to 20.
- `after` (string): Return the links after this `id` (the next page). Cannot be used with `before`.
- `before` (string): Return the links just before this `id` (the previous page). Cannot be used with `after`.

- `id` is a pagination cursor, not an entity id. `clicks` counts repeat clicks; `unique_clicks` counts recipients.

## Unsubscribe page

The branding of the page contacts see when they open a broadcast's unsubscribe link, where they can unsubscribe or change topic preferences.

### Retrieve unsubscribe page

`GET /unsubscribe-page` (https://developer.send.io/docs/api#get-unsubscribe-page)

Get your unsubscribe page settings. Fields you have not set show their defaults.

- send.io extension.

### Update unsubscribe page

`PATCH /unsubscribe-page` (https://developer.send.io/docs/api#update-unsubscribe-page)

Change your unsubscribe page settings. Only the fields you send change; null or an empty string resets a field to its default.

Body:

- `title` (string | null): Page heading. At most 100 characters.
- `description` (string | null): Text under the heading. At most 300 characters.
- `logo_url` (string | null): Logo image. Must be an https URL.
- `background_color` (string | null): Page background, as #rrggbb.
- `text_color` (string | null): Text color, as #rrggbb.
- `accent_color` (string | null): Button and link color, as #rrggbb.
- `show_footer` (boolean): Show the page footer.

Example request body:

```json
{
  "title": "Acme email preferences",
  "logo_url": "https://acme.com/logo.png",
  "accent_color": "#0f766e",
  "show_footer": false
}
```

- send.io extension.

## Transactional emails

A transactional email is a named, saved send of a published template: a sign-in code, a password reset, a receipt. It stores the From, subject, preview text, Reply-To and tracking; its content is always the template's published version. Your application sends it with `POST /emails` and `transactional_id`, passing only the recipient and the variables. Not to be confused with the `transactional` message stream or workflow templates of kind `transactional`.

### Create transactional email

`POST /transactional` (https://developer.send.io/docs/api#create-transactional-email)

Save a transactional email on a published template. Returns it, with its `tx_...` id to send it by.

Body:

- `name` (string, required): Your name for it, 1 to 255 characters. Shown only to you.
- `template_id` (string, required): The template (id or alias) whose published version is its content. The template must be published and not a workflow email. Sends always use the template's current published version.
- `from` (string, required): Sender, `Name <user@domain>` or an address, on a verified sending domain of your team (403 otherwise). `onboarding@send.io` is also accepted, to try the feature before you have a domain; sends from it only reach test addresses.
- `subject` (string, required): Subject line, without line breaks. May use the template's variables (`{{CODE}}`), filled from each send's `variables`.
- `preview_text` (string | null): Inbox preview text. Empty or null means none (the template's own preview text is not used).
- `reply_to` (string | string[] | null): Reply-To address or addresses, at most 50. Empty or null means none.
- `track_opens` (boolean): Count opens of its sends (when the domain's tracking subdomain is active). Default false: one-time codes and verification links are usually sent untracked. A send's own `track_opens` overrides it.
- `track_clicks` (boolean): Rewrite links to count clicks (when the domain's tracking subdomain is active). Default false. A send's own `track_clicks` overrides it.

Example request body:

```json
{
  "name": "Sign-in code",
  "template_id": "signin-code",
  "from": "Acme Security <security@acme.com>",
  "subject": "Your code is {{CODE}}",
  "preview_text": "It expires in 10 minutes.",
  "reply_to": "support@acme.com"
}
```

- Errors: 404 for an unknown template; 422 when the template has no published version ("Template X has no published version. Publish it first."), when it is a workflow email, or when a field is missing or invalid; 403 when the From domain is not a verified sending domain of your team.
- With a `handlebars` template the subject and preview text must parse as Handlebars (the 422 names the part, line and column). Variables the template does not declare are allowed: a send fills them from its `variables`.
- `html`, `text`, `react`, `design`, `template`, `template_engine` and `variables` are refused: the content comes from the template.
- Admins only (members may list, read and send a test). API keys with `sending_access` cannot use this endpoint; they can send a transactional email by id. Supports the `Idempotency-Key` header.

### List transactional emails

`GET /transactional` (https://developer.send.io/docs/api#list-transactional-emails)

List the team's transactional emails, newest first.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. Defaults to 20.
- `after` (string): Return items after this id (`tx_...`, the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.
- `search` (string): Case-insensitive contains match on the name and subject.
- `template_id` (string): Only the transactional emails of this template (id or alias).

### Retrieve transactional email

`GET /transactional/{id}` (https://developer.send.io/docs/api#retrieve-transactional-email)

Get one transactional email, with the variables of the template version its sends use now.

Path parameters:

- `id` (string, required): The transactional email id (`tx_...`).

Response fields:

- `preview_text` (string | null): Null when it has none.
- `published_version_id` (string | null): The template version sends use now; null when the template was unpublished or deleted.
- `published_version_number` (number | null): That version's number.
- `template_deleted` (boolean): True when its template was deleted: sends then fail with 422 until you choose another template.
- `variables` (object[]): The variables of the published version (`key`, `type`, `fallback_value`): what a send's `variables` fills. `[]` when there is no published version.

### Update transactional email

`PATCH /transactional/{id}` (https://developer.send.io/docs/api#update-transactional-email)

Change a transactional email. Only the fields you send change. Sends use the change within 10 seconds.

Path parameters:

- `id` (string, required): The transactional email id (`tx_...`).

Body:

- `name` (string): Your name for it, 1 to 255 characters. Shown only to you.
- `template_id` (string): The template (id or alias) whose published version is its content. The template must be published and not a workflow email. Sends always use the template's current published version.
- `from` (string): Sender, `Name <user@domain>` or an address, on a verified sending domain of your team (403 otherwise). `onboarding@send.io` is also accepted, to try the feature before you have a domain; sends from it only reach test addresses.
- `subject` (string): Subject line, without line breaks. May use the template's variables (`{{CODE}}`), filled from each send's `variables`.
- `preview_text` (string | null): Inbox preview text. Empty or null means none (the template's own preview text is not used).
- `reply_to` (string | string[] | null): Reply-To address or addresses, at most 50. Empty or null means none.
- `track_opens` (boolean): Count opens of its sends (when the domain's tracking subdomain is active). Default false: one-time codes and verification links are usually sent untracked. A send's own `track_opens` overrides it.
- `track_clicks` (boolean): Rewrite links to count clicks (when the domain's tracking subdomain is active). Default false. A send's own `track_clicks` overrides it.
- `expected_updated_at` (string): The `updated_at` you loaded. When the transactional email changed since, the update is refused with 409 `conflict` instead of overwriting the other change.

Example request body:

```json
{
  "subject": "{{CODE}} is your Acme code",
  "expected_updated_at": "2026-10-07T09:12:44.123456+00:00"
}
```

- Changing `template_id` checks the new template as on create. The same validation and permissions as Create transactional email apply; supports the `Idempotency-Key` header.
- Returns 409 `conflict` when `expected_updated_at` does not match: reload it and try again.

### Delete transactional email

`DELETE /transactional/{id}` (https://developer.send.io/docs/api#delete-transactional-email)

Delete a transactional email. Sends of it fail with 404 from then on (within 10 seconds); the emails it sent and its stats stay.

Path parameters:

- `id` (string, required): The transactional email id (`tx_...`).

- Admins only. While a transactional email uses a template, the template cannot be unpublished or deleted (409 `template_in_use`).

### Send test transactional email

`POST /transactional/{id}/test` (https://developer.send.io/docs/api#test-transactional-email)

Send the transactional email now to 1 to 5 addresses, as a send would make it, with "[Test] " before the subject.

Path parameters:

- `id` (string, required): The transactional email id (`tx_...`).

Body:

- `to` (string | string[], required): 1 to 5 recipient addresses.
- `variables` (object): Values for the template's variables.

Example request body:

```json
{
  "to": [
    "ada@acme.com"
  ],
  "variables": {
    "CODE": "123456"
  }
}
```

- Members may send a test. Test sends are real emails but are not counted in any stats.

### Transactional email stats

`GET /transactional/{id}/stats` (https://developer.send.io/docs/api#transactional-email-stats)

Delivery and engagement of a transactional email's sends in a period: totals and rates, a series per day (or hour), the split by template version and the most clicked links. The same numbers as Template stats.

Path parameters:

- `id` (string, required): The transactional email id (`tx_...`).

Query parameters:

- `from` (string): Start of the period: a date or an ISO 8601 timestamp, in `timezone`. Default: 7 days before `to`.
- `to` (string): End of the period. Default: now. The period is at most 90 days.
- `timezone` (string): IANA time zone for the dates and the series. Default `UTC`.
- `version` (string | number): Only this template version: an id of any template it used, or a `version_number` of its current template.
- `granularity` (string): `daily` (default) or `hourly`.

- A deleted transactional email stays readable. Its sends also count in their template's stats. Answers are cached for 30 seconds.
- Returns 422 for a period over 90 days and 404 for an unknown transactional email or version.

## Automations

Automations that start on an event or contact change and then send emails, wait, branch and update contacts. Compatible with Resend's automations API (steps and connections), plus send.io extensions: drafts, versions, pause and resume, validation, test runs and metrics.

### Create an automation

`POST /automations` (https://developer.send.io/docs/api#create-automation)

Creates an automation. Send a full graph to build it in one call, or only a name and fill in the graph later.

Body:

- `name` (string, required): 1 to 120 characters.
- `status` (string): enabled or disabled. Default disabled. enabled validates the graph and starts it at once.
- `steps` (object[]): The automation steps. Each is {key, type, config}. Keys use a-z, 0-9 and underscore (1 to 64 characters). Send together with `connections`.
- `steps[].key` (string, required): Unique key of the step, used by connections.
- `steps[].type` (string, required): One of trigger, send_email, delay, wait_for_event, condition, branch, contact_update, contact_delete, add_to_segment, remove_from_segment, webhook (an HTTP request to your own URL), app_action (an action in an app the workspace connected), exit. (notify and experiment are reserved and refused for now.)
- `steps[].config` (object): Step settings. trigger: {event_name}, or a contact trigger: {kind: "contact_created", source?: any | api | import | event | form}, {kind: "contact_added_to_segment", segment_id}, {kind: "contact_removed_from_segment", segment_id}, {kind: "contact_updated", property} where property is first_name, last_name, unsubscribed or the key of a contact property you created, or {kind: "topic_subscribed", topic_id}; each takes an optional filter. send_email: {template: {id, variables}, from?, subject?}, where subject replaces the template's subject and takes the same variables ({{NAME}}) and contact merge tags, plus run fields such as {{event.plan}}. delay: {duration: "3 days"} or {until: {var}, offset?} (a date more than 90 days away waits 90 days; the step output then has capped: true and requested_until). wait_for_event: {event_name, timeout?, filter_rule?}. condition: a rule {type: rule, field, operator, value} or {type: and | or, rules}; operator is one of eq, neq, gt, gte, lt, lte, contains, not_contains, starts_with, ends_with, in, not_in, exists, not_exists, is_empty, is_not_empty, more_than_days_ago, within_last_days; the field paths and how each operator compares are in the notes of Create an automation. branch: {branches: [{id, rule}]}. contact_update: {properties?, first_name?, last_name?, unsubscribed?}. add_to_segment / remove_from_segment: {segment_id} of a manual segment. webhook: {url, method?, headers?: [{name, value, secret?}], body_type?: json | form | text | none, body?, continue_on_failure?, timeout_seconds?}; see [HTTP request step](https://developer.send.io/docs/http-request-step). app_action: {app: {connection_id, app, action, input?, label?}, continue_on_failure?}, where connection_id is the workspace's connection of that app and input holds the action's fields; see [App actions](https://developer.send.io/docs/app-actions).
- `connections` (object[]): The links between steps: {from, to, type, branch_id?, variant_id?}. Send together with `steps`.
- `connections[].type` (string): default (the default), condition_met, condition_not_met, event_received, timeout, branch. Which types a step may start depends on its type.
- `type` (string): send.io extension. transactional (the default) or marketing. A marketing automation needs a `topic_id`.
- `topic_id` (string | null): send.io extension. The topic contacts can unsubscribe from. Required for marketing.
- `settings` (object): send.io extension. Merged into the current settings: reentry (once | every_time, default once), allow_parallel_runs (default false), exit_on_reply (default true for marketing), timezone (IANA, default UTC; the send window and wait-until dates without a zone are read in it), send_window {enabled, days, start, end} (when enabled, an email step outside the days and hours waits and sends when the window next opens; runs already waiting follow a changed window), verify_on_entry, description (max 500 characters).

Example request body:

```json
{
  "name": "Welcome series",
  "status": "enabled",
  "steps": [
    {
      "key": "start",
      "type": "trigger",
      "config": {
        "event_name": "user.created"
      }
    },
    {
      "key": "welcome",
      "type": "send_email",
      "config": {
        "template": {
          "id": "34a080c9-b17d-4187-ad80-5af20266e535",
          "variables": {
            "first_name": {
              "var": "event.first_name"
            }
          }
        }
      }
    },
    {
      "key": "wait_3d",
      "type": "delay",
      "config": {
        "duration": "3 days"
      }
    },
    {
      "key": "is_pro",
      "type": "condition",
      "config": {
        "type": "rule",
        "field": "event.plan",
        "operator": "eq",
        "value": "pro"
      }
    },
    {
      "key": "tag_pro",
      "type": "contact_update",
      "config": {
        "properties": {
          "plan": "pro"
        }
      }
    }
  ],
  "connections": [
    {
      "from": "start",
      "to": "welcome",
      "type": "default"
    },
    {
      "from": "welcome",
      "to": "wait_3d",
      "type": "default"
    },
    {
      "from": "wait_3d",
      "to": "is_pro",
      "type": "default"
    },
    {
      "from": "is_pro",
      "to": "tag_pro",
      "type": "condition_met"
    }
  ]
}
```

- A graph sent through the API is validated, as in Resend. Errors return 422 with the list of problems as `errors` (each has code, severity, message and step_key).
- A team can have at most 500 automations and 50 enabled at once. A graph can have at most 100 steps and 200 connections.
- Delays and wait timeouts are 1 minute to 90 days. A wait with no timeout gives up after 30 days. A wait until a date from the event is capped at 90 days too; a missing date fails the run with the reason in the step error.
- Condition rules: `field` is a path such as event.plan, event.user.plan, event.items.0 (a list position, from 0), contact.first_name, contact.<property> or contact.properties.<property>, wait_events.<event>.<field>, email.opened, run.id. Operators: eq, neq, in, not_in (a list), contains, not_contains, starts_with, ends_with, gt, gte, lt, lte, exists, not_exists, is_empty, is_not_empty, and the relative-date more_than_days_ago and within_last_days (below). eq, neq, in and not_in match case exactly; contains, starts_with and ends_with ignore case. Text is compared in one Unicode form (an accented letter typed either way matches). Numbers and numeric text compare as numbers ("3" eq 3), true matches "true". gt, gte, lt and lte compare numbers or dates and refuse any other value. A field that is missing never matches (except not_exists).
- Steps with contact_delete, webhook or app_action need an admin to enable, and so does a trigger that is a connected app's.
- Segment triggers: `contact_added_to_segment` starts when a contact enters the segment `segment_id` (added by hand, or moved in by the rule of a rule-based segment); `contact_removed_from_segment` when it leaves. An `add_to_segment` or `remove_from_segment` step on a rule-based segment cannot be published (issue `segment_rule_based`): the rule decides who is in it.
- send.io extension: the rule operators `more_than_days_ago` and `within_last_days` compare a date field with the time the rule is evaluated. Their `value` is a whole number of days N, as a JSON number (not text, a fraction or {var}): 0 to 3650 for `more_than_days_ago`, 1 to 3650 for `within_last_days`. `more_than_days_ago` is true when the date is N days ago or earlier; `within_last_days` when it is less than N days ago and not in the future. A day is 24 hours, a date without a zone is read as UTC, and a field that is missing or not a date never matches. Example: {type: rule, field: "contact.properties.renews_at", operator: "within_last_days", value: 30}.

### List automations

`GET /automations` (https://developer.send.io/docs/api#list-automations)

Lists the team's automations, newest first.

Query parameters:

- `status` (string): enabled or disabled.
- `limit` (number): 1 to 100. Default 20.
- `after` (string): Return items after this automation ID.
- `before` (string): Return items before this automation ID.

- `state` is send.io's full state (enabled, paused or disabled). `status` stays Resend-compatible: paused shows as disabled.
- `trigger`, `active_runs`, `runs_total` and `emails_7d` are send.io extensions. `active_runs` counts runs in progress; `runs_total` counts all runs except test runs, up to 10,000 (the exact number for a period is in the automation's metrics).

### Retrieve an automation

`GET /automations/{id}` (https://developer.send.io/docs/api#get-automation)

Returns an automation with its graph. While it is enabled or paused you get the live version; otherwise the draft.

Path parameters:

- `id` (string, required): The automation ID.

### Update an automation

`PATCH /automations/{id}` (https://developer.send.io/docs/api#update-automation)

Changes the name, settings or graph, or turns the automation on or off with `status`. Only the fields you send change.

Path parameters:

- `id` (string, required): The automation ID.

Body:

- `name` (string): 1 to 120 characters.
- `status` (string): enabled starts it; disabled stops new runs (runs in progress finish).
- `steps` (object[]): The automation steps. Each is {key, type, config}. Keys use a-z, 0-9 and underscore (1 to 64 characters). Send together with `connections`.
- `steps[].key` (string, required): Unique key of the step, used by connections.
- `steps[].type` (string, required): One of trigger, send_email, delay, wait_for_event, condition, branch, contact_update, contact_delete, add_to_segment, remove_from_segment, webhook (an HTTP request to your own URL), app_action (an action in an app the workspace connected), exit. (notify and experiment are reserved and refused for now.)
- `steps[].config` (object): Step settings. trigger: {event_name}, or a contact trigger: {kind: "contact_created", source?: any | api | import | event | form}, {kind: "contact_added_to_segment", segment_id}, {kind: "contact_removed_from_segment", segment_id}, {kind: "contact_updated", property} where property is first_name, last_name, unsubscribed or the key of a contact property you created, or {kind: "topic_subscribed", topic_id}; each takes an optional filter. send_email: {template: {id, variables}, from?, subject?}, where subject replaces the template's subject and takes the same variables ({{NAME}}) and contact merge tags, plus run fields such as {{event.plan}}. delay: {duration: "3 days"} or {until: {var}, offset?} (a date more than 90 days away waits 90 days; the step output then has capped: true and requested_until). wait_for_event: {event_name, timeout?, filter_rule?}. condition: a rule {type: rule, field, operator, value} or {type: and | or, rules}; operator is one of eq, neq, gt, gte, lt, lte, contains, not_contains, starts_with, ends_with, in, not_in, exists, not_exists, is_empty, is_not_empty, more_than_days_ago, within_last_days; the field paths and how each operator compares are in the notes of Create an automation. branch: {branches: [{id, rule}]}. contact_update: {properties?, first_name?, last_name?, unsubscribed?}. add_to_segment / remove_from_segment: {segment_id} of a manual segment. webhook: {url, method?, headers?: [{name, value, secret?}], body_type?: json | form | text | none, body?, continue_on_failure?, timeout_seconds?}; see [HTTP request step](https://developer.send.io/docs/http-request-step). app_action: {app: {connection_id, app, action, input?, label?}, continue_on_failure?}, where connection_id is the workspace's connection of that app and input holds the action's fields; see [App actions](https://developer.send.io/docs/app-actions).
- `connections` (object[]): The links between steps: {from, to, type, branch_id?, variant_id?}. Send together with `steps`.
- `connections[].type` (string): default (the default), condition_met, condition_not_met, event_received, timeout, branch. Which types a step may start depends on its type.
- `type` (string): send.io extension. transactional or marketing. Cannot change after first enable.
- `topic_id` (string | null): send.io extension. null clears it.
- `settings` (object): send.io extension. Merged into the current settings: reentry (once | every_time, default once), allow_parallel_runs (default false), exit_on_reply (default true for marketing), timezone (IANA, default UTC; the send window and wait-until dates without a zone are read in it), send_window {enabled, days, start, end} (when enabled, an email step outside the days and hours waits and sends when the window next opens; runs already waiting follow a changed window), verify_on_entry, description (max 500 characters).
- `if_updated_at` (string): Optional. The `updated_at` you last read. If someone changed it since, you get 409 instead of overwriting. The If-Unmodified-Since header works too: it takes the same `updated_at` value or an HTTP date (for example `Tue, 24 Nov 2026 10:00:00 GMT`), and you get 409 only if the automation was saved after that second. A value that is neither is a 422.

Example request body:

```json
{
  "name": "Welcome series v2",
  "status": "disabled"
}
```

- As in Resend, the graph of an enabled or paused automation is locked. Disable it first, or duplicate it and edit the copy.

### Delete an automation

`DELETE /automations/{id}` (https://developer.send.io/docs/api#delete-automation)

Deletes a stopped automation. Runs still in progress (Stop new runs lets them finish) are cancelled: none of their remaining steps run.

Path parameters:

- `id` (string, required): The automation ID.

- Stop the automation first: deleting an enabled or paused one returns 422.
- Cancelled runs end with `end_reason` `automation_deleted` and send `automation.run.cancelled`. `cancelled_runs` (how many) is a send.io extension.

### Duplicate an automation

`POST /automations/{id}/duplicate` (https://developer.send.io/docs/api#duplicate-automation)

Copies the automation's latest graph, type, topic and settings into a new disabled automation named "<name> (copy)".

Path parameters:

- `id` (string, required): The automation ID.

### Stop an automation

`POST /automations/{id}/stop` (https://developer.send.io/docs/api#stop-automation)

Disables the automation so no new runs start. Runs in progress finish on their version, unless you pass `cancel_running`.

Path parameters:

- `id` (string, required): The automation ID.

Query parameters:

- `cancel_running` (boolean): true also cancels every run in progress. Can be sent in the body instead.

Body:

- `cancel_running` (boolean): Same as the query parameter. Default false.

Example request body:

```json
{
  "cancel_running": true
}
```

- `cancel_running` and `cancelled_runs` are send.io extensions to Resend's stop.

### Enable an automation

`POST /automations/{id}/enable` (https://developer.send.io/docs/api#enable-automation)

Validates the draft, saves it as a new version if it changed, and turns the automation on. Returns the full automation.

Path parameters:

- `id` (string, required): The automation ID.

Body:

- `if_updated_at` (string): Optional. Refuse with 409 if the automation changed since.

- send.io extension. In Resend, use PATCH with status enabled (also supported here).
- A draft with validation errors returns 422 with the list of problems as `errors`.

### Pause an automation

`POST /automations/{id}/pause` (https://developer.send.io/docs/api#pause-automation)

Pauses an enabled automation. New entrants are skipped and runs in progress hold where they are until you resume.

Path parameters:

- `id` (string, required): The automation ID.

- send.io extension. Only an enabled automation can be paused.

### Resume an automation

`POST /automations/{id}/resume` (https://developer.send.io/docs/api#resume-automation)

Turns a paused automation back on. Held runs continue from where they stopped.

Path parameters:

- `id` (string, required): The automation ID.

- send.io extension. Returns 422 if the automation is not paused.

### Retrieve the draft

`GET /automations/{id}/draft` (https://developer.send.io/docs/api#get-automation-draft)

Returns the editable draft graph and its current validation issues (`issues` is null when there are none). The draft becomes a version when you enable the automation.

Path parameters:

- `id` (string, required): The automation ID.

- send.io extension.

### Save the draft

`PUT /automations/{id}/draft` (https://developer.send.io/docs/api#update-automation-draft)

Replaces the draft graph (and optionally name, type, topic and settings). Unlike PATCH, an incomplete graph is saved and its problems come back as `issues` (null when there are none).

Path parameters:

- `id` (string, required): The automation ID.

Body:

- `steps` (object[]): The automation steps. Each is {key, type, config}. Keys use a-z, 0-9 and underscore (1 to 64 characters). Send together with `connections`.
- `steps[].key` (string, required): Unique key of the step, used by connections.
- `steps[].type` (string, required): One of trigger, send_email, delay, wait_for_event, condition, branch, contact_update, contact_delete, add_to_segment, remove_from_segment, webhook (an HTTP request to your own URL), app_action (an action in an app the workspace connected), exit. (notify and experiment are reserved and refused for now.)
- `steps[].config` (object): Step settings. trigger: {event_name}, or a contact trigger: {kind: "contact_created", source?: any | api | import | event | form}, {kind: "contact_added_to_segment", segment_id}, {kind: "contact_removed_from_segment", segment_id}, {kind: "contact_updated", property} where property is first_name, last_name, unsubscribed or the key of a contact property you created, or {kind: "topic_subscribed", topic_id}; each takes an optional filter. send_email: {template: {id, variables}, from?, subject?}, where subject replaces the template's subject and takes the same variables ({{NAME}}) and contact merge tags, plus run fields such as {{event.plan}}. delay: {duration: "3 days"} or {until: {var}, offset?} (a date more than 90 days away waits 90 days; the step output then has capped: true and requested_until). wait_for_event: {event_name, timeout?, filter_rule?}. condition: a rule {type: rule, field, operator, value} or {type: and | or, rules}; operator is one of eq, neq, gt, gte, lt, lte, contains, not_contains, starts_with, ends_with, in, not_in, exists, not_exists, is_empty, is_not_empty, more_than_days_ago, within_last_days; the field paths and how each operator compares are in the notes of Create an automation. branch: {branches: [{id, rule}]}. contact_update: {properties?, first_name?, last_name?, unsubscribed?}. add_to_segment / remove_from_segment: {segment_id} of a manual segment. webhook: {url, method?, headers?: [{name, value, secret?}], body_type?: json | form | text | none, body?, continue_on_failure?, timeout_seconds?}; see [HTTP request step](https://developer.send.io/docs/http-request-step). app_action: {app: {connection_id, app, action, input?, label?}, continue_on_failure?}, where connection_id is the workspace's connection of that app and input holds the action's fields; see [App actions](https://developer.send.io/docs/app-actions).
- `connections` (object[]): The links between steps: {from, to, type, branch_id?, variant_id?}. Send together with `steps`.
- `connections[].type` (string): default (the default), condition_met, condition_not_met, event_received, timeout, branch. Which types a step may start depends on its type.
- `layout` (object): Optional editor positions per step key. Saved with the draft.
- `name` (string): 1 to 120 characters.
- `type` (string): transactional or marketing.
- `topic_id` (string | null): The topic for marketing automations.
- `settings` (object): send.io extension. Merged into the current settings: reentry (once | every_time, default once), allow_parallel_runs (default false), exit_on_reply (default true for marketing), timezone (IANA, default UTC; the send window and wait-until dates without a zone are read in it), send_window {enabled, days, start, end} (when enabled, an email step outside the days and hours waits and sends when the window next opens; runs already waiting follow a changed window), verify_on_entry, description (max 500 characters).
- `if_updated_at` (string): Optional. Refuse with 409 if the automation changed since.

Example request body:

```json
{
  "steps": [
    {
      "key": "start",
      "type": "trigger",
      "config": {
        "event_name": "user.created"
      }
    },
    {
      "key": "welcome",
      "type": "send_email",
      "config": {
        "template": {
          "id": "34a080c9-b17d-4187-ad80-5af20266e535",
          "variables": {
            "first_name": {
              "var": "event.first_name"
            }
          }
        }
      }
    },
    {
      "key": "wait_3d",
      "type": "delay",
      "config": {
        "duration": "3 days"
      }
    },
    {
      "key": "is_pro",
      "type": "condition",
      "config": {
        "type": "rule",
        "field": "event.plan",
        "operator": "eq",
        "value": "pro"
      }
    },
    {
      "key": "tag_pro",
      "type": "contact_update",
      "config": {
        "properties": {
          "plan": "pro"
        }
      }
    }
  ],
  "connections": [
    {
      "from": "start",
      "to": "welcome",
      "type": "default"
    },
    {
      "from": "welcome",
      "to": "wait_3d",
      "type": "default"
    },
    {
      "from": "wait_3d",
      "to": "is_pro",
      "type": "default"
    },
    {
      "from": "is_pro",
      "to": "tag_pro",
      "type": "condition_met"
    }
  ]
}
```

- send.io extension. The graph of a live (enabled or paused) automation cannot be changed: stop or duplicate it.

### Validate an automation

`POST /automations/{id}/validate` (https://developer.send.io/docs/api#validate-automation)

Checks the draft, or a graph you send, without saving anything. Errors block enabling; warnings do not.

Path parameters:

- `id` (string, required): The automation ID.

Body:

- `steps` (object[]): Optional graph to check instead of the saved draft. Send with `connections`.
- `connections` (object[]): Optional, with `steps`.

Example request body:

```json
{
  "steps": [
    {
      "key": "start",
      "type": "trigger",
      "config": {
        "event_name": "user.created"
      }
    },
    {
      "key": "welcome",
      "type": "send_email",
      "config": {
        "template": {
          "id": "34a080c9-b17d-4187-ad80-5af20266e535",
          "variables": {
            "first_name": {
              "var": "event.first_name"
            }
          }
        }
      }
    },
    {
      "key": "wait_3d",
      "type": "delay",
      "config": {
        "duration": "3 days"
      }
    },
    {
      "key": "is_pro",
      "type": "condition",
      "config": {
        "type": "rule",
        "field": "event.plan",
        "operator": "eq",
        "value": "pro"
      }
    },
    {
      "key": "tag_pro",
      "type": "contact_update",
      "config": {
        "properties": {
          "plan": "pro"
        }
      }
    }
  ],
  "connections": [
    {
      "from": "start",
      "to": "welcome",
      "type": "default"
    },
    {
      "from": "welcome",
      "to": "wait_3d",
      "type": "default"
    },
    {
      "from": "wait_3d",
      "to": "is_pro",
      "type": "default"
    },
    {
      "from": "is_pro",
      "to": "tag_pro",
      "type": "condition_met"
    }
  ]
}
```

- send.io extension. Each issue has code, severity, message and, when it is about one step, step_key.

### Test an automation

`POST /automations/{id}/test` (https://developer.send.io/docs/api#test-automation)

Runs the draft for one contact. A dry run sends and changes nothing and shows the path taken. A live run really runs, but its emails go only to `to`, and it is marked as a test.

Path parameters:

- `id` (string, required): The automation ID.

Body:

- `mode` (string): dry_run (the default) or live.
- `payload` (object): The event payload to test with (for event triggers).
- `contact_id` (string): Test as this existing contact.
- `email` (string): Test as the contact with this email. A dry run uses a sample contact if none exists; a live run creates it.
- `to` (string): Live only: the address that receives the test emails. Required with an API key.
- `wait_outcome` (string): Dry run only. timeout (the default) or event_received: which path wait steps follow.
- `first_name` (string): Dry run sample contact: first name.
- `last_name` (string): Dry run sample contact: last name.
- `properties` (object): Dry run sample contact: custom properties.

Example request body:

```json
{
  "mode": "dry_run",
  "email": "jane@acme.com",
  "payload": {
    "first_name": "Jane",
    "plan": "pro"
  }
}
```

- send.io extension.
- In a dry run, `issues` lists the problems found in the draft, or is null when there are none. A body field of the wrong type, or a `wait_outcome` that is not timeout or event_received, is a 422 naming the field.
- A live test returns {object: "automation_test", mode: "live", run_id, version, to}. In a live test, delays are shortened to 10 seconds.
- A live test validates the draft and saves it as a new version first if it changed.
- `entry` says whether a real event would start a run now, and why not (for example automation_disabled or reentry_not_allowed).

### Import an HTTP request

`POST /automations/http/import` (https://developer.send.io/docs/api#import-automation-http-step)

Turns a cURL command, or an HTTP Request node copied from n8n, into the config of an HTTP request (webhook) step. It only reads what you paste: it never calls the URL or runs anything.

Body:

- `curl` (string): A curl command, as copied from API docs or a browser's "Copy as cURL". Line breaks with a backslash are fine. Send this or `n8n`.
- `n8n` (object | string): What n8n puts on the clipboard when you copy a node ({nodes, connections}), or one node object, as JSON or a string. Send this or `curl`.
- `node` (string): With `n8n`: the name of the HTTP Request node to use when the paste holds more than one.

Example request body:

```json
{
  "curl": "curl https://api.hubapi.com/crm/v3/objects/contacts \\\n  -H 'Authorization: Bearer pat-na1-xxxx' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"properties\":{\"email\":\"jane@acme.com\"}}'"
}
```

- send.io extension. Review the config before you save it: swap fixed values for tokens such as {{contact.email}}.
- cURL: -X, -H, -d / --data / --data-raw / --data-binary, --data-urlencode, --json, -u (becomes a secret Basic Authorization header), -G and --url are read. -A, -k and -L are dropped with a warning. -F (multipart), -T, @file data, cookie files, http:// URLs and a second URL are refused with 422.
- n8n: HTTP Request nodes version 1 to 4.x. `={{ $json.field }}` expressions become {{event.field}} with a warning to check them; other expressions are kept as text with a warning. Credentials are not part of an n8n copy, so add your auth header.
- Headers that look like keys or tokens (Authorization, *key*, *token*, *secret*) come back marked secret.

### Send a test HTTP request

`POST /automations/http/test` (https://developer.send.io/docs/api#test-http-step)

Sends one real request with an HTTP request step's config, filled in for a contact and a sample event, and returns what came back. It uses the same client, signature and limits as a running automation.

Body:

- `config` (object, required): The step config to test (see the webhook step).
- `contact_id` (string): Fill {{contact.*}} from this contact.
- `email` (string): Fill {{contact.*}} from the contact with this email (or a sample one).
- `event` (object): A sample event payload for {{event.*}}.
- `automation_id` (string): Automation whose saved secret header values fill empty secret headers.
- `step_key` (string): With `automation_id`: the key of the HTTP request step whose saved values to use.

Example request body:

```json
{
  "automation_id": "5b0f6f2e-3c1d-4a8e-9f7b-2d6c8e1a4b90",
  "step_key": "http_1",
  "config": {
    "url": "https://api.hubapi.com/crm/v3/objects/contacts",
    "method": "POST",
    "headers": [
      {
        "name": "Authorization",
        "value": "",
        "secret": true,
        "has_value": true
      },
      {
        "name": "Content-Type",
        "value": "application/json"
      }
    ],
    "body_type": "json",
    "body": {
      "properties": {
        "email": "{{contact.email}}",
        "plan": "{{event.plan}}"
      }
    },
    "continue_on_failure": false,
    "timeout_seconds": 10
  },
  "email": "jane@acme.com",
  "event": {
    "plan": "pro"
  }
}
```

- send.io extension. Needs an admin. At most 10 tests a minute per team.
- Secret header values are masked in `request.headers`. A config read back from the API has empty secret values: send `automation_id` and `step_key` and the server fills them with the values saved on that automation's step.
- `ok` is false and `error` says why when the call failed; `status_code` is 0 on network errors and timeouts.

### Retrieve the signing secret

`GET /automations/signing-secret` (https://developer.send.io/docs/api#get-automation-signing-secret)

Returns the secret that signs every HTTP request step of the team, so your endpoint can check a request really came from your send.io automations.

- send.io extension. Needs an admin. See [Verify the signature](https://developer.send.io/docs/http-request-step#verify) for the check.
- The secret is created the first time it is read, so the first call returns a new secret rather than an error.

### Rotate the signing secret

`POST /automations/signing-secret/rotate` (https://developer.send.io/docs/api#rotate-automation-signing-secret)

Replaces the team's HTTP request signing secret with a new one and returns it.

- send.io extension. Needs an admin. Update your endpoint with the new secret.

### List versions

`GET /automations/{id}/versions` (https://developer.send.io/docs/api#list-automation-versions)

Lists the versions saved each time the automation was enabled with a changed graph, newest first.

Path parameters:

- `id` (string, required): The automation ID.

- send.io extension. Not paginated. `published_by` is null when an API key published it.

### Retrieve a version

`GET /automations/{id}/versions/{n}` (https://developer.send.io/docs/api#get-automation-version)

Returns one saved version: its graph, settings, type and topic.

Path parameters:

- `id` (string, required): The automation ID.
- `n` (number, required): The version number.

- send.io extension. Versions never change; runs always follow the version they started on.

### List runs

`GET /automations/{id}/runs` (https://developer.send.io/docs/api#list-automation-runs)

Lists the automation's runs (one per contact entry), newest first. Test runs are left out by default.

Path parameters:

- `id` (string, required): The automation ID.

Query parameters:

- `status` (string): Filter by status: running, completed, failed, cancelled or skipped. Comma-separate several.
- `email` (string): send.io extension. Contact email contains this text.
- `from` (string): send.io extension. Created at or after this time (ISO 8601).
- `to` (string): send.io extension. Created before this time (ISO 8601).
- `test` (string): send.io extension. Default excludes test runs; include adds them; only returns only them.
- `limit` (number): 1 to 100. Default 20.
- `after` (string): Return items after this run ID.
- `before` (string): Return items before this run ID.

- send.io extensions: `current_step_type` is the type of the step the run is at. `error` is set on a failed run: {step, code, message}. `holds` lists the times a paused automation held the run: {reason, step, started_at, ended_at}, the one still holding last with ended_at null. The step it held at does not count that time as its own.

### Retrieve a run

`GET /automations/{id}/runs/{run_id}` (https://developer.send.io/docs/api#get-automation-run)

Returns one run with every step it went through, including outputs and errors.

Path parameters:

- `id` (string, required): The automation ID.
- `run_id` (string, required): The run ID.

### Cancel a run

`POST /automations/{id}/runs/{run_id}/cancel` (https://developer.send.io/docs/api#cancel-automation-run)

Ends one run in progress. Its pending steps are skipped. Returns the run.

Path parameters:

- `id` (string, required): The automation ID.
- `run_id` (string, required): The run ID.

- send.io extension. Returns 422 if the run already ended.

### Retrieve metrics

`GET /automations/{id}/metrics` (https://developer.send.io/docs/api#get-automation-metrics)

Run counts, per-step counts and delivery stats of the emails the automation sent, for a time range. Test runs are left out.

Path parameters:

- `id` (string, required): The automation ID.

Query parameters:

- `from` (string): Start (RFC 3339). Default 7 days ago.
- `to` (string): End (RFC 3339). Default now. The range is at most 400 days.

- send.io extension.

### List automation templates

`GET /automation-templates` (https://developer.send.io/docs/api#list-automation-templates)

Prebuilt automations with their emails, owned by send.io. Using one (POST /automations/from-template) copies it into your team as a normal automation.

Query parameters:

- `category` (string): onboarding, billing, ecommerce, engagement, lead_capture, appointments, events, education, account, nonprofit or internal.

- send.io extension. `exists` says whether your team already has the event; `in_use_count` is how many of your automations were made from the template.

### Retrieve an automation template

`GET /automation-templates/{slug}` (https://developer.send.io/docs/api#get-automation-template)

One template in full: its steps, emails (subject, preview, HTML, themed with your team's brand), the waits and links setup asks for, and each event's schema and status in your team.

Path parameters:

- `slug` (string, required): The template's slug, for example email-verification-reminder.

- send.io extension. A `duration` param has a default; a `url` param has none and must be given at setup.
- Emails are filled with your brand (Settings › Brand: logo or name, and primary colour), as setup will create them.

### Create an automation from a template

`POST /automations/from-template` (https://developer.send.io/docs/api#create-automation-from-template)

Sets up a template in one transaction: creates the events your team does not have (or adds the template's fields to ones it has), the automation's emails, and the automation, disabled. If any part fails, nothing is created.

Body:

- `slug` (string, required): The template.
- `version` (number): The version you reviewed. A newer one returns 409 template_version_changed.
- `name` (string): 1 to 120 characters. Default: the template's name.
- `events` (object): Per event ref: {mode: "create" | "existing", name}. create (the default) uses or creates the event; existing maps the ref to an event your app already sends. A template may list apps on the event that starts it (the event's apps): connected apps whose trigger can start the automation instead. Starting from one is done in the console's setup for now: it needs the id of the workspace's connection to that app, and this API has no endpoint that lists connections.
- `sender` (object, required): {from, reply_to?}. from must be on one of your verified sending domains.
- `topic_id` (string): Required for a marketing template: the topic contacts can unsubscribe from.
- `params` (object): Per param ref. A duration: a number and minutes, hours, days or weeks (1 minute to 90 days); its default applies when left out. A url: required, a full http or https link.

Example request body:

```json
{
  "slug": "email-verification-reminder",
  "version": 2,
  "name": "Verify reminders",
  "events": {
    "verified": {
      "mode": "existing",
      "name": "account.confirmed"
    }
  },
  "sender": {
    "from": "Acme <hello@acme.com>",
    "reply_to": "help@acme.com"
  },
  "params": {
    "wait_1": "24 hours",
    "wait_2": "2 days",
    "resend_url": "https://app.acme.com/verify-email"
  }
}
```

- send.io extension. Send an Idempotency-Key: a retry with the same key returns the first answer instead of a second automation.
- The automation is created disabled and never started here. Event schemas are only added to: an existing field keeps its type.
- The automation's emails are templates owned by the automation: not listed by GET /templates, deleted with the automation.

### List an automation's emails

`GET /automations/{id}/emails` (https://developer.send.io/docs/api#list-automation-emails)

The automation emails the automation owns, in the order its steps send them. Edit one with PATCH /templates/{id} and publish it.

Path parameters:

- `id` (string, required): The automation ID.

- send.io extension.

### Insert a template into an automation email

`POST /automations/{id}/emails/{email}/insert-template` (https://developer.send.io/docs/api#insert-template-into-automation-email)

Copies a saved template's subject, preview text, body and variables into the automation email and publishes it. The email keeps its From and Reply-to; nothing stays linked.

Path parameters:

- `id` (string, required): The automation ID.
- `email` (string, required): The automation email's ID.

Body:

- `template_id` (string, required): A saved template's ID or alias (not another automation email).

- send.io extension.

### Save an automation email as a template

`POST /automations/{id}/emails/{email}/save-as-template` (https://developer.send.io/docs/api#save-automation-email-as-template)

Copies the automation email into a new draft template in Templates. Editing one never changes the other.

Path parameters:

- `id` (string, required): The automation ID.
- `email` (string, required): The automation email's ID.

Body:

- `name` (string, required): 1 to 120 characters.

- send.io extension.

## Events

Custom events are things that happened in your product (user.created, order.paid) for one contact. Sending an event starts automations that trigger on it and wakes runs waiting for it. send.io also keeps a summary per contact and event name: when it first happened, when it last happened and how many times. Rule-based segments read this summary (`events.<name>.last_at`, `.first_at`, `.count`). Compatible with Resend's events API.

### Send an event

`POST /events/send` (https://developer.send.io/docs/api#send-event)

Records an event for one contact and starts any automation it triggers. Identify the contact by `contact_id` or `email` (exactly one).

Body:

- `event` (string, required): The event name. Letters, digits, dot, colon, dash and underscore, 1 to 100 characters. `name` is accepted as an alias.
- `contact_id` (string): The contact's ID. Use this or `email`.
- `email` (string): The contact's email. An unknown email creates the contact. Use this or `contact_id`.
- `payload` (object): Event data, usable in automations as event.<field>. At most 100 keys and 64 KB.
- `id` (string): send.io extension. Your own ID for this event (max 200 characters). Sending the same id again does nothing, so retries are safe.
- `occurred_at` (string): send.io extension. When the event happened, as an RFC 3339 timestamp (2026-11-10T10:00:00Z), for an event you deliver late. At most 7 days in the past. Defaults to the time send.io receives the event.

Response fields:

- `event_created` (boolean): send.io extension. true when no event had this name, so this send created it. A `message` then says so: check the name for a typo.

Example request body:

```json
{
  "event": "user.created",
  "email": "jane@acme.com",
  "payload": {
    "first_name": "Jane",
    "plan": "pro",
    "trial_ends_at": "2026-10-21T00:00:00Z"
  },
  "id": "signup-8812",
  "occurred_at": "2026-10-07T09:10:00Z"
}
```

- If the event has a schema, payload values are converted to the schema type when the meaning is clear ("42" to 42); otherwise you get 422.
- send.io extension: sending a name that is not defined yet defines it, with a schema inferred from the payload. The answer has `event_created: true`.
- Text in the payload cannot contain the NUL character (\u0000): such a payload gets 422.
- A repeat of an `id` already seen returns 202 without `id` and is not processed again.
- `occurred_at` sets the time the event counts for in the contact's event summary (first time, last time). Automations start when the event is received, as without it, and a run waiting for the event is not affected. A time later than the receive time is stored as the receive time.
- An `occurred_at` that is not an RFC 3339 timestamp fails with 422 "occurred_at must be an RFC 3339 timestamp."; one more than 7 days old with 422 "occurred_at must be within the last 7 days; use POST /events/import for older history."

### Import event history

`POST /events/import` (https://developer.send.io/docs/api#import-events)

Loads the history of events that happened before you started sending them, one item per contact and event: when it last happened and, optionally, when it first happened and how many times. It only writes the contact's event summary: no automation starts, no webhook is sent and no contact is created.

Body:

- `events` (object[], required): 1 to 1,000 items. Send more in further requests.
- `events[].event` (string, required): The event name. Letters, digits, dot, colon, dash and underscore, 1 to 100 characters. A name that is not defined yet is defined, without a schema.
- `events[].contact_id` (string): The contact's ID (a UUID). Use this or `email`, exactly one.
- `events[].email` (string): The contact's email. Use this or `contact_id`, exactly one.
- `events[].last_at` (string, required): When the event last happened: an RFC 3339 timestamp (2025-03-02T10:00:00Z), a time without a zone (2025-03-02T10:00:00, read as UTC) or a day (2025-03-02, read as 00:00 UTC). Not in the future.
- `events[].first_at` (string): When the event first happened, in the same formats. Not after `last_at`. Defaults to `last_at`.
- `events[].count` (number): How many times the event happened: a whole number of at least 1. Defaults to 1.

Example request body:

```json
{
  "events": [
    {
      "event": "user.logged_in",
      "email": "jane@acme.com",
      "last_at": "2025-03-02T10:00:00Z",
      "first_at": "2024-01-05",
      "count": 41
    },
    {
      "event": "order.paid",
      "contact_id": "e4c1b2a3-5d6f-4a7b-8c9d-0e1f2a3b4c5d",
      "last_at": "2025-06-18"
    },
    {
      "event": "user.logged_in",
      "email": "nobody@acme.com",
      "last_at": "2025-02-11"
    }
  ]
}
```

- send.io extension. For workspace Admins and API keys; a workspace Member gets 403 `invalid_permission`.
- An item whose contact does not exist is not imported: it is listed in `skipped` with its position in `events` (from 0) and the reason `contact_not_found`, and the other items are imported.
- A malformed item fails the whole request with 422 `validation_error`, naming it ("events[3]: last_at must not be in the future."), and nothing is imported.
- Imported history is kept apart from the events you send, and the summary is both together: the earlier first time, the later last time, the sum of the counts. Importing a contact and event again replaces what was imported for them before, so a repeated request changes nothing and a wrong import is corrected by a second one. When one request names the same contact and event twice, the later item wins.

### Create an event

`POST /events` (https://developer.send.io/docs/api#create-event)

Defines an event name and, optionally, the types of its payload fields.

Body:

- `name` (string, required): Letters, digits, dot, colon, dash and underscore, 1 to 100 characters.
- `schema` (object): Flat map of field name to type: string, number, boolean or date. Field names use letters, digits and underscore (max 50). At most 100 fields.

Example request body:

```json
{
  "name": "order.paid",
  "schema": {
    "order_id": "string",
    "amount": "number",
    "paid_at": "date"
  }
}
```

- Names are case-insensitive. Creating a name that already exists, in any letter case, returns 409 `conflict`, unless it was only defined by sending (then your schema replaces the inferred one).

### List events

`GET /events` (https://developer.send.io/docs/api#list-events)

Lists the team's event definitions, newest first.

Query parameters:

- `limit` (number): 1 to 100. Without it, all events are returned.
- `after` (string): Return items after this event ID.
- `before` (string): Return items before this event ID.

- `last_received_at` and `count_7d` are send.io extensions.

### Retrieve an event

`GET /events/{id}` (https://developer.send.io/docs/api#get-event)

Returns one event definition, by ID or by name.

Path parameters:

- `id` (string, required): The event ID or its name.

### Update an event

`PATCH /events/{id}` (https://developer.send.io/docs/api#update-event)

Replaces the event's schema. Send `schema: null` to remove it.

Path parameters:

- `id` (string, required): The event ID or its name.

Body:

- `schema` (object | null, required): The new schema (field name to string, number, boolean or date), or null.

Example request body:

```json
{
  "schema": {
    "order_id": "string",
    "amount": "number",
    "currency": "string"
  }
}
```

### Delete an event

`DELETE /events/{id}` (https://developer.send.io/docs/api#delete-event)

Deletes an event definition.

Path parameters:

- `id` (string, required): The event ID or its name.

- An event that a running or paused automation's trigger or Wait for event step listens for (the name is not case sensitive) is refused with 409 `resource_in_use`. Stopped and draft automations do not block the delete; they need a new event before they can start again.
- Events already received are kept until they are 7 days old, then deleted. They no longer count: if the name is defined again, its count and recent events start from 0.

### List recent events

`GET /events/{id}/recent` (https://developer.send.io/docs/api#list-recent-events)

Returns the last 20 events received with this name, with their payloads. Handy for building and testing automations.

Path parameters:

- `id` (string, required): The event ID or its name.

- send.io extension. Not paginated.
- An event name that is not defined returns 404. Only events received since the event was defined are listed.

## Mailboxes

A mailbox is an address on one of your verified domains. Every mailbox works over the API and also has IMAP and SMTP login, so you can use it from any mail client.

### List mailboxes

`GET /mailboxes` (https://developer.send.io/docs/api#list-mailboxes)

Lists the team's mailboxes with 30-day sending stats and a health rating, most recently used first.

Response fields:

- `data[].agent_inbox_id` (string | null): The agent inbox on this address, or null when there is none.
- `data[].kind` (string): normal, or agent for a free mailbox or an agent inbox's mailbox.
- `data[].imap_smtp` (string): ready, pending (being set up), retrying, or unavailable (free mailboxes have no IMAP or SMTP login).
- `data[].domain_id` (string | null): The domain the address is on.
- `data[].domain` (string | null): That domain's name.
- `data[].last_sent_at` (string | null): When the mailbox last sent; null when it never has.
- `data[].can_send` (boolean): Whether POST /emails accepts the address as `from` right now.
- `data[].send_eligible` (boolean): Whether the address can send at all. False only for reasons that do not clear by themselves, such as a domain that is not verified. A paused mailbox or a reached daily cap keeps it true and sets `can_send` to false.
- `data[].send_code` (string | null): The error name POST /emails would answer with (for example `receive_only`, `sending_paused` or `daily_limit`); null when `can_send` is true.
- `data[].send_reason` (string | null): Why it cannot send, in a short line; null when `can_send` is true.
- `data[].pool` (boolean): Free mailboxes only: always true.
- `data[].origin` (string): Free mailboxes only: claimed (claimed from an agent key) or workspace (made by the workspace).
- `data[].free_claimed` (boolean): Free mailboxes only: true when it was claimed from an agent key.
- `data[].free_claimed_at` (string): Free mailboxes only: when it became the workspace's.
- `data[].receive_only` (boolean): Free mailboxes only: true while free mailboxes can receive but not send.
- `data[].sending` (object | null): Free mailboxes only: `status` (enabled, paused or disabled), `reason` when paused, `sent_today` and `daily_limit`.

- Not paginated.
- Sending from an address with `POST /emails` adds a mailbox for it here if it is not listed yet (a verified domain, any local part). Addresses on send.io test domains are not added.
- `sent`, `delivered`, `bounced` and `complained` cover the last 30 days; `sent_total` is all time.
- `health` is no_data, healthy, at_risk (bounces at or above 2%) or poor (bounces at or above 5% or complaints at or above 0.1%).
- `imap_smtp` is ready, pending (being set up) or retrying.
- `can_send` says whether POST /emails accepts the address as `from` right now, by the same rule the send applies: a verified sending domain, your own agent or free mailbox, free sending on, not paused, under the daily cap. When it is false, `send_reason` says why in a short line.

### Create a mailbox

`POST /mailboxes` (https://developer.send.io/docs/api#create-mailbox)

Adds a mailbox on a verified domain. The IMAP/SMTP password is returned once, in `credentials`.

Body:

- `address` (string): The full address. Or send `local_part` and `domain_id`.
- `local_part` (string): The part before the @. Use with `domain_id`.
- `domain_id` (string): The domain ID. Use with `local_part`.

Response fields:

- `agent_inbox_id` (string | null): The agent inbox on this address, or null when there is none.
- `kind` (string): normal, or agent for a free mailbox or an agent inbox's mailbox.
- `imap_smtp` (string): ready, pending (being set up), retrying, or unavailable (free mailboxes have no IMAP or SMTP login).
- `domain_id` (string | null): The domain the address is on.
- `domain` (string | null): That domain's name.
- `last_sent_at` (string | null): When the mailbox last sent; null when it never has.
- `can_send` (boolean): Whether POST /emails accepts the address as `from` right now.
- `send_eligible` (boolean): Whether the address can send at all. False only for reasons that do not clear by themselves, such as a domain that is not verified. A paused mailbox or a reached daily cap keeps it true and sets `can_send` to false.
- `send_code` (string | null): The error name POST /emails would answer with (for example `receive_only`, `sending_paused` or `daily_limit`); null when `can_send` is true.
- `send_reason` (string | null): Why it cannot send, in a short line; null when `can_send` is true.
- `pool` (boolean): Free mailboxes only: always true.
- `origin` (string): Free mailboxes only: claimed (claimed from an agent key) or workspace (made by the workspace).
- `free_claimed` (boolean): Free mailboxes only: true when it was claimed from an agent key.
- `free_claimed_at` (string): Free mailboxes only: when it became the workspace's.
- `receive_only` (boolean): Free mailboxes only: true while free mailboxes can receive but not send.
- `sending` (object | null): Free mailboxes only: `status` (enabled, paused or disabled), `reason` when paused, `sent_today` and `daily_limit`.

Example request body:

```json
{
  "address": "sales@acme.com"
}
```

- The domain must be verified (or partially verified). An address that already exists returns 409.
- The password is also an API key for this mailbox, limited to sending from its domain. Store it safely; it is not shown again.
- If IMAP/SMTP setup is delayed, `credentials` is missing and `imap_smtp` is pending. Use the password reset endpoint to get a password later.

### Delete a mailbox

`DELETE /mailboxes/{id}` (https://developer.send.io/docs/api#delete-mailbox)

Deletes the mailbox. IMAP and SMTP stop within a minute, its API key is revoked, and an agent inbox on it is deleted too.

Path parameters:

- `id` (string, required): The mailbox ID.

- Returns 503 if the mail servers cannot be reached; nothing is deleted then. Try again in a minute.

### Reset a mailbox password

`POST /mailboxes/{id}/password` (https://developer.send.io/docs/api#reset-mailbox-password)

Sets a new IMAP/SMTP password and returns it once. The old password stops working.

Path parameters:

- `id` (string, required): The mailbox ID.

- The new password is a new API key for the mailbox; the old key is revoked.

## Inboxes

Agent inboxes are email addresses your AI agents create and use through the API. Mail sent to an inbox is filed into threads; the agent reads, sends, replies and forwards. An inbox can live on your own verified domain or on send.io's shared agent domain, which needs no DNS setup.

### Create an inbox

`POST /inboxes` (https://developer.send.io/docs/api#create-inbox)

Creates an inbox. With no domain it is a free mailbox on your workspace's sendiomail.com address; with no username a random one is picked. An inbox on your own domain or the shared agent domain also returns IMAP/SMTP credentials once.

Body:

- `username` (string): On a free mailbox (the default, no `domain` given): a-z, 0-9, dot and dash, 2 to 32 characters, not starting or ending with a dot or dash. On your own domain or the shared agent domain: a-z, 0-9, dot, dash, underscore and plus, 1 to 64 characters. Random when left out.
- `domain` (string): Leave it out for a free mailbox at name@<org>.sendiomail.com (the label is your workspace's own; free mailboxes have no IMAP or SMTP login). Or give a domain verified for sending on your team, the shared agent domain (agents.send.io), or a company subdomain of it (acme.agents.send.io). GET /agent-domain names both domains.
- `display_name` (string): The name shown in the From header.
- `client_id` (string): Your own ID. If an inbox with this client_id exists, it is returned instead of creating a new one.
- `pod_id` (string): Put the inbox in this pod.

Example request body:

```json
{
  "username": "support-bot",
  "domain": "acme.com",
  "display_name": "Acme Support",
  "client_id": "support-bot-1"
}
```

- On the shared agent domain, reserved usernames (abuse, postmaster, support, admin, noreply and similar) are refused. A free mailbox's org label and a company subdomain belong to your workspace alone, so there only mail-system names (abuse, postmaster, hostmaster, webmaster, mailer-daemon, root) are refused.
- A taken address returns 409. An unverified domain returns 403.
- `credentials` (an IMAP/SMTP login; the password is an API key scoped to this inbox, shown only once) is returned for an inbox on your own domain or the shared agent domain. A free mailbox has no IMAP or SMTP login: it has no `credentials` and its `imap_smtp` is `unavailable`. Use the API, MCP or the Unibox with it.
- Use GET /agent-domain to find the shared agent domain and the free mailbox domain.
- Which free domain is which: name@<org>.sendiomail.com is your workspace's free mailbox, made here when you give no domain (GET /agent-domain returns it as `free_mailbox_domain`). name@org.sendioinbox.com is the no-signup agent mailbox (/docs/agent-mailbox), made with no account and sealed to its key; claimed into a workspace it keeps its sendioinbox.com address and counts as one of the workspace's free mailboxes.

### List inboxes

`GET /inboxes` (https://developer.send.io/docs/api#list-inboxes)

Lists the team's inboxes, newest first, with thread and unread counts.

Query parameters:

- `pod_id` (string): Only inboxes in this pod.

- Not paginated (up to 1,000 inboxes).
- A key limited to an inbox or pod sees only that inbox or pod.

### Retrieve an inbox

`GET /inboxes/{id}` (https://developer.send.io/docs/api#get-inbox)

Returns one inbox, by ID or by address.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

### Update an inbox

`PATCH /inboxes/{id}` (https://developer.send.io/docs/api#update-inbox)

Changes the display name or how long messages are kept.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Body:

- `display_name` (string): Max 100 characters, without quotes, angle brackets or line breaks.
- `message_ttl_hours` (number | null): Delete messages after this many hours (1 to 8760). 0 or null keeps them.

Example request body:

```json
{
  "display_name": "Acme Help",
  "message_ttl_hours": 720
}
```

- `auto_reply` is read-only: it is true only on the onboarding demo inbox, which answers by itself. send.io never replies from your inboxes on its own: nothing is sent unless you or your agent sends it or approves a draft. Setting it to true answers 422.

### Delete an inbox

`DELETE /inboxes/{id}` (https://developer.send.io/docs/api#delete-inbox)

Deletes the inbox: the address stops receiving and pending drafts are discarded. Existing threads stay readable.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Query parameters:

- `keep_mailbox` (boolean): true keeps the address as a plain mailbox (IMAP/SMTP keep working). Not allowed for addresses on the shared domain.

### List messages

`GET /inboxes/{id}/messages` (https://developer.send.io/docs/api#list-inbox-messages)

Lists the inbox's newest messages, received and sent, without bodies.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Query parameters:

- `limit` (number): 1 to 200. Default 50.

- `extracted_text` is the new text of a reply, without the quoted history.

### Retrieve a message

`GET /inboxes/{id}/messages/{message}` (https://developer.send.io/docs/api#get-inbox-message)

Returns one message of the inbox with its HTML and text bodies, headers and attachment list.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `message` (string, required): The message ID.

### Send a message

`POST /inboxes/{id}/messages` (https://developer.send.io/docs/api#send-inbox-message)

Sends a new email from the inbox and starts a new thread.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Body:

- `to` (string | string[], required): Recipients.
- `subject` (string, required): The subject.
- `cc` (string | string[]): Cc recipients.
- `bcc` (string | string[]): Bcc recipients.
- `text` (string): Plain text body.
- `html` (string): HTML body.
- `reply_to` (string | string[]): Reply-To addresses.
- `headers` (object): Custom headers.
- `attachments` (object[]): Attachments, as in POST /emails.
- `tags` (object[]): Tags, as in POST /emails.
- `labels` (string[]): Labels for the new thread (1 to 64 characters each, max 50).

Example request body:

```json
{
  "to": [
    "jane@example.com"
  ],
  "subject": "Your order has shipped",
  "text": "Hi Jane, your order is on its way.",
  "labels": [
    "orders"
  ]
}
```

- The From address is the inbox (with its display name).
- Recipients blocked by the inbox's send list are refused with 403.

### Retrieve an attachment

`GET /inboxes/{id}/messages/{message}/attachments/{attachment}` (https://developer.send.io/docs/api#get-inbox-attachment)

Returns an attachment's details, its extracted text when available, and a signed download link.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `message` (string, required): The message ID.
- `attachment` (string, required): The attachment ID.

### List threads

`GET /inboxes/{id}/threads` (https://developer.send.io/docs/api#list-inbox-threads)

Lists the inbox's threads, newest activity first.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Query parameters:

- `filter` (string): all (the default: not archived), unread, archived or trash.
- `label` (string): Only threads with this label.
- `q` (string): Search subject, snippet and participants.
- `before` (string): Only threads whose last message is older than this time (ISO 8601). Use it to page.
- `limit` (number): 1 to 200. Default 50.

### Retrieve a thread

`GET /inboxes/{id}/threads/{thread}` (https://developer.send.io/docs/api#get-inbox-thread)

Returns a thread of the inbox with all its messages (received and sent), oldest first, with bodies.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `thread` (string, required): The thread ID.

### Reply to a thread

`POST /inboxes/{id}/threads/{thread}/reply` (https://developer.send.io/docs/api#reply-inbox-thread)

Replies to the newest message in the thread, from the inbox. Threading headers are set for you and the reply is filed in the thread.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `thread` (string, required): The thread ID.

Body:

- `text` (string): Plain text body. `text` or `html` is required.
- `html` (string): HTML body.
- `reply_all` (boolean): true copies everyone on the last message (except the inbox). Default false.
- `to` (string | string[]): Override the recipients. Default: the sender (or its Reply-To).
- `cc` (string | string[]): Cc recipients.
- `bcc` (string | string[]): Bcc recipients.

Example request body:

```json
{
  "text": "Hi Jane, we refunded the second charge. Sorry for the trouble."
}
```

### Forward a thread

`POST /inboxes/{id}/threads/{thread}/forward` (https://developer.send.io/docs/api#forward-inbox-thread)

Forwards the thread's newest message, quoted below your note, as a new thread.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `thread` (string, required): The thread ID.

Body:

- `to` (string | string[], required): Recipients.
- `cc` (string | string[]): Cc recipients.
- `text` (string): A note above the forwarded message.

Example request body:

```json
{
  "to": [
    "billing@acme.com"
  ],
  "text": "Can you check this refund?"
}
```

### Retrieve inbox metrics

`GET /inboxes/{id}/metrics` (https://developer.send.io/docs/api#get-inbox-metrics)

Sent, delivered, bounced and received counts per day, with totals.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Query parameters:

- `days` (number): 1 to 90. Default 30. Other values answer 422.

- Deleting mail does not change past numbers: a deleted sent message still counts for the inbox it was sent from. `received` counts received messages still in the inbox; a permanently deleted or expired message is no longer counted.

### List inbox events

`GET /inboxes/{id}/events` (https://developer.send.io/docs/api#list-inbox-events)

Lists message events of the inbox (received, sent, delivered, bounced, complained, opened, rejected), newest first.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Query parameters:

- `start` (string): Start time (RFC 3339). Default 30 days ago.
- `end` (string): End time (RFC 3339). Default now.
- `event_types` (string): Only these types, comma-separated (for example message.received,message.bounced).
- `limit` (number): 1 to 100. Default 50.
- `page_token` (string): The `next_page_token` from the previous page.

- Paged with `limit`, `page_token` and `next_page_token`. At most the newest 1,000 events in the range.

### Retrieve inbox rates

`GET /inboxes/{id}/rates` (https://developer.send.io/docs/api#get-inbox-rates)

Delivery, bounce, complaint, rejection and open rates of the inbox's sent mail for a time range.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Query parameters:

- `start` (string): Start time (RFC 3339). Default 30 days ago.
- `end` (string): End time (RFC 3339). Default now.

### List inbox webhooks

`GET /inboxes/{id}/webhooks` (https://developer.send.io/docs/api#list-inbox-webhooks)

Lists the webhooks limited to this inbox.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Query parameters:

- `limit` (number): 1 to 100. Default 50.
- `page_token` (string): The `next_page_token` from the previous page.

### Create an inbox webhook

`POST /inboxes/{id}/webhooks` (https://developer.send.io/docs/api#create-inbox-webhook)

Creates a webhook that only fires for this inbox. The signing secret is returned once.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Body:

- `url` (string, required): The https endpoint. `endpoint` is accepted as an alias.
- `event_types` (string[]): Events to send. Default ["message.received"]. Others include message.sent, message.delivered, message.bounced, message.complained, message.rejected, message.opened, message.received.spam.
- `client_id` (string): Your own ID. If a webhook with this client_id exists with the same settings, it is returned instead; different settings answer 409.

Example request body:

```json
{
  "url": "https://acme.com/hooks/sendio",
  "event_types": [
    "message.received"
  ]
}
```

- Counts toward your plan's webhook limit.

### Delete an inbox webhook

`DELETE /inboxes/{id}/webhooks/{webhook_id}` (https://developer.send.io/docs/api#delete-inbox-webhook)

Deletes a webhook of this inbox.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `webhook_id` (string, required): The webhook ID.

### List inbox API keys

`GET /inboxes/{id}/api-keys` (https://developer.send.io/docs/api#list-inbox-api-keys)

Lists the active API keys limited to this inbox.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

### Create an inbox API key

`POST /inboxes/{id}/api-keys` (https://developer.send.io/docs/api#create-inbox-api-key)

Creates an API key that can only use this inbox. Give it to an agent so it cannot touch the rest of your account. The token is returned once.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Body:

- `name` (string): Max 50 characters. Default "agent key".
- `permissions` (object): Optional map of permission to true, to limit the key further (for example message_read, message_send, message_reply, draft_create, draft_send, webhook_read). Without it the key can do everything within the inbox.

Example request body:

```json
{
  "name": "support agent",
  "permissions": {
    "message_read": true,
    "message_reply": true,
    "draft_create": true
  }
}
```

- Needs an admin, and cannot be called with a key that is itself limited to an inbox or pod.
- An inbox key may only call /inboxes, /inbox/threads, /pods, /agent-domain and the /v0 API.

## Inbox drafts

Drafts let an agent write an email that a person approves before it goes out, or that sends itself at a set time.

### Create a draft

`POST /inboxes/{id}/drafts` (https://developer.send.io/docs/api#create-inbox-draft)

Creates a pending draft. With `thread_id` it is a reply in that thread; otherwise it starts a new thread and needs `to`.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Body:

- `thread_id` (string): Reply in this thread. The subject defaults to "Re: <thread subject>".
- `to` (string[]): Recipients. Required without `thread_id`.
- `cc` (string[]): Cc recipients.
- `bcc` (string[]): Bcc recipients.
- `subject` (string): The subject.
- `text` (string): Plain text body. `text` or `html` is required.
- `html` (string): HTML body.
- `send_at` (string): Send automatically at this time (RFC 3339). Must not be in the past. Without it, the draft waits for approval.

Example request body:

```json
{
  "thread_id": "f0e1d2c3-b4a5-4968-8776-655443322110",
  "text": "Hi Jane, sorry about that. We refunded the second charge."
}
```

### List drafts

`GET /inboxes/{id}/drafts` (https://developer.send.io/docs/api#list-inbox-drafts)

Lists the inbox's drafts, newest first.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Query parameters:

- `status` (string): pending (the default), sending, sent, failed, discarded, or all.

- Not paginated (up to 200 drafts).

### Retrieve a draft

`GET /inboxes/{id}/drafts/{draft}` (https://developer.send.io/docs/api#get-inbox-draft)

Returns one draft.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `draft` (string, required): The draft ID.

### Update a draft

`PATCH /inboxes/{id}/drafts/{draft}` (https://developer.send.io/docs/api#update-inbox-draft)

Changes a pending draft. Only the fields you send change.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `draft` (string, required): The draft ID.

Body:

- `to` (string[]): Recipients.
- `cc` (string[]): Cc recipients.
- `bcc` (string[]): Bcc recipients.
- `subject` (string): The subject.
- `text` (string): Plain text body.
- `html` (string): HTML body.
- `send_at` (string | null): Scheduled send time (RFC 3339), or null to clear.

Example request body:

```json
{
  "text": "Hi Jane, we refunded the second charge. It shows in 3 to 5 days."
}
```

- Only a pending draft can be changed (409 otherwise).

### Discard a draft

`DELETE /inboxes/{id}/drafts/{draft}` (https://developer.send.io/docs/api#discard-inbox-draft)

Discards a pending draft. Returns the draft with status discarded.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `draft` (string, required): The draft ID.

### Restore a discarded draft

`POST /inboxes/{id}/drafts/{draft}/restore` (https://developer.send.io/docs/api#restore-inbox-draft)

Undoes a discard: the draft is pending again and waits for approval. A schedule it had is cleared.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `draft` (string, required): The draft ID.

- Only a discarded draft can be restored; any other answers 409.

### Send a draft

`POST /inboxes/{id}/drafts/{draft}/send` (https://developer.send.io/docs/api#send-inbox-draft)

Approves a pending draft and sends it now. Returns the draft with the sent email.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `draft` (string, required): The draft ID.

## Inbox lists

Allow and block lists control who an inbox may send to and receive from. Blocked entries always lose; once any allow entry exists, only allowed addresses pass.

### List entries

`GET /inboxes/{id}/lists` (https://developer.send.io/docs/api#list-inbox-list-entries)

Lists the inbox's entries, plus team-wide entries (shown with inbox_id null).

Path parameters:

- `id` (string, required): The inbox ID or its email address.

### Add an entry

`POST /inboxes/{id}/lists` (https://developer.send.io/docs/api#add-inbox-list-entry)

Adds an email address or domain to the inbox's send or receive list.

Path parameters:

- `id` (string, required): The inbox ID or its email address.

Body:

- `direction` (string, required): send or receive.
- `kind` (string, required): allow or block.
- `entry` (string, required): An email address or a domain (a domain also matches its subdomains). Max 254 characters.

Example request body:

```json
{
  "direction": "receive",
  "kind": "block",
  "entry": "spammy.example"
}
```

### Remove an entry

`DELETE /inboxes/{id}/lists/{entry}` (https://developer.send.io/docs/api#remove-inbox-list-entry)

Removes an entry from the inbox's lists.

Path parameters:

- `id` (string, required): The inbox ID or its email address.
- `entry` (string, required): The entry ID.

## Inbox threads

The unified inbox: every received conversation across all your mailboxes and agent inboxes, grouped into threads.

### List inbox addresses

`GET /inbox/mailboxes` (https://developer.send.io/docs/api#list-inbox-mailboxes)

Lists every address that has threads, with its unread and thread counts, the labels in use and the agent inboxes with theirs, plus team totals.

- `unread` counts threads with at least one unread message, as the Unread view lists them; `unread_messages` counts the unread messages.
- Counts leave out archived and trashed threads.

### List threads

`GET /inbox/threads` (https://developer.send.io/docs/api#list-all-inbox-threads)

Lists threads across all addresses, newest activity first.

Query parameters:

- `mailbox` (string): Only threads of this address.
- `inbox_id` (string): Only threads of this agent inbox.
- `filter` (string): all (the default: not archived), unread, archived or trash.
- `label` (string): Only threads with this label.
- `q` (string): Search subject, snippet and participants.
- `before` (string): Only threads whose last message is older than this time (ISO 8601). Use it to page.
- `limit` (number): 1 to 200. Default 50.

- A search (`q`) in the default view also finds archived threads; trashed threads are only found with `filter=trash`.
- `label` matches however the label is typed: labels are stored lower-case.
- `participant_names` maps a participant's address to a display name: the newest name that address sent in the thread, else the name of your agent inbox at that address. Addresses with no known name are left out.

### Retrieve a thread

`GET /inbox/threads/{id}` (https://developer.send.io/docs/api#get-all-inbox-thread)

Returns a thread with all its received and sent messages, oldest first, with bodies.

Path parameters:

- `id` (string, required): The thread ID.

- `reply_defaults` is the From and To a reply to the thread goes out with when it names no `from` or `to`: the agent inbox, else the address that received the newest message; to that message's Reply-To, else its sender. It is null when the thread has no message to answer.

### Update a thread

`PATCH /inbox/threads/{id}` (https://developer.send.io/docs/api#update-inbox-thread)

Marks a thread read or unread, archives, trashes or relabels it. Returns the thread.

Path parameters:

- `id` (string, required): The thread ID.

Body:

- `read` (boolean): true marks every message read; false marks them unread.
- `read_up_to` (string): With `read: true`, marks read only the received messages up to and including this one (a message ID from the thread), so a message that arrived after you loaded the thread stays unread.
- `archived` (boolean): Archive or unarchive.
- `trashed` (boolean): Move to trash or restore.
- `labels` (string[]): Replace all labels.
- `add_labels` (string[]): Labels to add.
- `remove_labels` (string[]): Labels to remove.

Example request body:

```json
{
  "read": true,
  "add_labels": [
    "billing"
  ]
}
```

- Labels are lower-cased, 1 to 64 characters each, at most 50 per thread.

### Reply to a thread

`POST /inbox/threads/{id}/reply` (https://developer.send.io/docs/api#reply-all-inbox-thread)

Replies to the newest message in the thread with threading headers set. A thread of an agent inbox always replies from that inbox; otherwise from the address that received it.

Path parameters:

- `id` (string, required): The thread ID.

Body:

- `text` (string): Plain text body. `text` or `html` is required.
- `html` (string): HTML body.
- `from` (string): Sender for threads that are not on an agent inbox.
- `to` (string | string[]): Override the recipients. Default: the sender (or its Reply-To).
- `cc` (string | string[]): Cc recipients.
- `bcc` (string | string[]): Bcc recipients.
- `reply_all` (boolean): true copies everyone on the last message. Default false.
- `attachments` (object[]): Files to attach, same shape as Send email.
- `reply_to` (string | string[]): Reply-To addresses.
- `quote` (boolean): true adds the usual quoted history of the message you answer under your text ("On <date>, <sender> wrote:"). Default false.

Example request body:

```json
{
  "text": "Thanks, we will look into it today.",
  "quote": true
}
```

- Replying unarchives the thread.
- Size limits are the same as for Send email.

### Forward a thread

`POST /inbox/threads/{id}/forward` (https://developer.send.io/docs/api#forward-all-inbox-thread)

Forwards one message of the thread with its attachments, your note above it and a forwarded header (From, Date, Subject, To, Cc). It goes out from the address a reply would use and is filed in the thread.

Path parameters:

- `id` (string, required): The thread ID.

Body:

- `to` (string | string[], required): Recipients.
- `cc` (string | string[]): Cc recipients.
- `bcc` (string | string[]): Bcc recipients.
- `text` (string): Your note above the forwarded message.
- `message_id` (string): The message to forward. Default: the newest message in the thread.
- `subject` (string): Default is "Fwd: " plus the original subject.
- `attachments` (object[]): More files to attach, same shape as Send email.
- `from` (string): Sender for threads that are not on an agent inbox.

Example request body:

```json
{
  "to": [
    "accounts@acme.com"
  ],
  "text": "Can you check this one?"
}
```

- The forward is plain text; the original's files go with it, so a forward over the email size limit is refused with that error.
- Returns 422 when `message_id` is not a message of this thread.

## Pods

Pods are isolated groups of inboxes, for example one per end customer of your platform. A pod key can only see its own inboxes.

### Create a pod

`POST /pods` (https://developer.send.io/docs/api#create-pod)

Creates a pod.

Body:

- `name` (string): Max 100 characters.
- `client_id` (string): Your own ID. If a pod with this client_id exists, it is returned instead of creating a new one.

Example request body:

```json
{
  "name": "Customer: Globex",
  "client_id": "globex"
}
```

- Cannot be called with a key limited to an inbox or pod.

### List pods

`GET /pods` (https://developer.send.io/docs/api#list-pods)

Lists the team's pods, newest first, with their inbox counts.

- Not paginated (up to 1,000 pods). A pod key sees only its pod.

### Retrieve a pod

`GET /pods/{pod}` (https://developer.send.io/docs/api#get-pod)

Returns one pod.

Path parameters:

- `pod` (string, required): The pod ID.

### Delete a pod

`DELETE /pods/{pod}` (https://developer.send.io/docs/api#delete-pod)

Deletes an empty pod.

Path parameters:

- `pod` (string, required): The pod ID.

- Delete the pod's inboxes first: a pod with inboxes returns 409.

### List pod inboxes

`GET /pods/{pod}/inboxes` (https://developer.send.io/docs/api#list-pod-inboxes)

Lists the inboxes in the pod.

Path parameters:

- `pod` (string, required): The pod ID.

### Create a pod inbox

`POST /pods/{pod}/inboxes` (https://developer.send.io/docs/api#create-pod-inbox)

Creates an inbox in the pod. Takes the same body as POST /inboxes.

Path parameters:

- `pod` (string, required): The pod ID.

Body:

- `username` (string): The part before the @. Default agent-<random>.
- `domain` (string): A verified domain, or the shared agent domain (default).
- `display_name` (string): The name shown in the From header.
- `client_id` (string): Your own ID, for safe retries.

Example request body:

```json
{
  "username": "globex-support",
  "display_name": "Globex Support"
}
```

### Create a pod API key

`POST /pods/{pod}/api-keys` (https://developer.send.io/docs/api#create-pod-api-key)

Creates an API key that can only use this pod and its inboxes. The token is returned once.

Path parameters:

- `pod` (string, required): The pod ID.

Body:

- `name` (string): Max 50 characters. Default "agent key".
- `permissions` (object): Optional map of permission to true, to limit the key further (for example inbox_create, message_read, message_send).

Example request body:

```json
{
  "name": "globex agent"
}
```

- Needs an admin, and cannot be called with a key that is itself limited to an inbox or pod.

## Agent domain and AgentID

The shared agent domain, and AgentID apps: OAuth/OpenID clients that let your app sign users in with their agent inbox.

### Retrieve the agent domain

`GET /agent-domain` (https://developer.send.io/docs/api#get-agent-domain)

Returns the shared agent domain (`domain`), the free mailbox domain (`free_mailbox_domain`, null when free mailboxes are off) and the domain a new inbox gets when you give none (`default_domain`).

- With free mailboxes on, an inbox created with no domain is name@<org>.sendiomail.com, where <org> is your workspace's own label.
- Which free domain is which: name@<org>.sendiomail.com is your workspace's free mailbox, made here when you give no domain (GET /agent-domain returns it as `free_mailbox_domain`). name@org.sendioinbox.com is the no-signup agent mailbox (/docs/agent-mailbox), made with no account and sealed to its key; claimed into a workspace it keeps its sendioinbox.com address and counts as one of the workspace's free mailboxes.
- Inbox and pod keys may call this too.

### Retrieve the sending environment

`GET /sending-environment` (https://developer.send.io/docs/api#get-sending-environment)

Says whether this environment delivers only to test addresses, and which one to send tests to.

- `simulator_only` is true on development environments, where the email provider only delivers to test addresses. `test_recipient` is then `delivered@send.io`, a test address send.io simulates; it is null otherwise.
- Production always answers false.

### List AgentID apps

`GET /agentid/apps` (https://developer.send.io/docs/api#list-agentid-apps)

Lists the team's registered AgentID apps, newest first.

### Create an AgentID app

`POST /agentid/apps` (https://developer.send.io/docs/api#create-agentid-app)

Registers an app that can sign agents in. The client secret is returned once.

Body:

- `name` (string, required): 1 to 100 characters.
- `redirect_uris` (string[], required): 1 to 10 URLs. https only (http allowed for localhost), no fragment.
- `share_owner` (boolean): true lets the app ask for the human owner's details. Default false.

Example request body:

```json
{
  "name": "Acme Portal",
  "redirect_uris": [
    "https://portal.acme.com/callback"
  ]
}
```

### Delete an AgentID app

`DELETE /agentid/apps/{id}` (https://developer.send.io/docs/api#delete-agentid-app)

Deletes an AgentID app. Its client ID and secret stop working.

Path parameters:

- `id` (string, required): The app's client_id.

## API logs

Every request your team makes to the send.io API: method, path, status, key, IP and client, newest first. Kept for 30 days.

### List API logs

`GET /logs` (https://developer.send.io/docs/api#list-logs)

Lists the team's API requests, newest first. Filters combine, and paging works within them. A parameter not listed here is refused with 422 `invalid_parameter`.

Query parameters:

- `limit` (number): Number of items to return, 1 to 100. Defaults to 20.
- `after` (string): Return items after this id (the next page). Cannot be used with `before`.
- `before` (string): Return items before this id (the previous page). Cannot be used with `after`.
- `method` (string): Only this HTTP method, for example `POST`.
- `status` (string): Only this status code (`422`) or class (`2xx`, `4xx`, `5xx`).
- `path` (string): Only paths starting with this, for example `/emails` (at most 200 characters).
- `api_key_id` (string): Only requests made with this API key.
- `created_after` (string): Only requests at or after this time: an RFC 3339 timestamp, a date or Unix seconds.
- `created_before` (string): Only requests before this time: an RFC 3339 timestamp, a date or Unix seconds.
- `search` (string): Matches the path, method or status code (at most 100 characters).

Response fields:

- `api_key_id` (string | null): The API key that made the request.
- `api_key_name` (string | null): That key's name, or null when the key was deleted.
- `ip` (string | null): The address the request came from.

### Retrieve API log

`GET /logs/{log_id}` (https://developer.send.io/docs/api#retrieve-log)

Gets one API request by id, with what was sent and answered.

Path parameters:

- `log_id` (string, required): The log id.

- `request_body` and `response_body` hold the JSON as sent and answered, with passwords, tokens, secrets and keys replaced by `[hidden]` and attachment content left out.
- A body is not stored, and holds a short sentence saying why, when it is larger than 16 KB, is not JSON, or is a sent email's content (see the email in Email logs). The answer to a successful GET is not stored: call the endpoint again. A GET has no request body, so `request_body` is null.
- Calls with a revoked, suspended or expired key are listed with status 401 (at most one a minute per key), and calls with a working key to a path that does not exist with status 404. Calls with no key or a key that never existed belong to no workspace and are not listed. Reading the logs (GET /logs) is not itself logged.

## Assets

Images you host on send.io for use in templates and emails.

### Get brand

`GET /brand` (https://developer.send.io/docs/api#get-brand)

The team's brand: its name, logo and colours, as the template editor uses them.

Response fields:

- `name` (string | null): The brand name, or null when not set.
- `logo_url` (string | null): A public URL of the logo (PNG), or null when there is none.
- `logo_width` (number | null): The logo's width in pixels. Left out before a brand is saved.
- `logo_height` (number | null): The logo's height in pixels. Left out before a brand is saved.
- `palette` (object): Named colours, such as `primary`. `{}` when none are set.
- `updated_at` (string | null): When the brand last changed, or null when it was never saved.

- send.io extension.

### Upload an image

`POST /assets` (https://developer.send.io/docs/api#create-asset)

Uploads an image and returns a permanent public URL to use in your emails.

Body:

- `image` (string, required): The image as base64. PNG, JPEG or GIF, under 2 MB, at most 4000 x 4000 pixels.
- `content_type` (string): Optional. The type is read from the image itself.

Example request body:

```json
{
  "image": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
  "content_type": "image/png"
}
```

- The URL is public and cached forever; it never changes.
- A team can store up to 2,000 images.

## MCP

A Model Context Protocol server, so AI assistants and agents can use send.io as tools with your API key.

### Call the MCP server

`POST /mcp` (https://developer.send.io/docs/api#mcp-request)

JSON-RPC 2.0 over HTTP. Supports initialize, ping, tools/list and tools/call. Each tool call runs the matching API endpoint with your key.

Body:

- `jsonrpc` (string, required): Always "2.0".
- `id` (string | number): Request ID. A message without an id is a notification and gets an empty 202.
- `method` (string, required): initialize, ping, tools/list or tools/call.
- `params` (object): For tools/call: {name, arguments}. Path IDs (id, thread, draft, run) go in arguments.

Example request body:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "send-email",
    "arguments": {
      "from": "Acme <hello@acme.com>",
      "to": [
        "jane@example.com"
      ],
      "subject": "Hello from MCP",
      "text": "It works."
    }
  }
}
```

- Authenticate with `Authorization: Bearer mx_...`, the same as the REST API. Browser requests from other origins are refused.
- Tools: send-email, send-batch-emails; list/get for emails, domains, api-keys, webhooks, suppressions, templates and logs; create, verify and remove for domains, API keys, webhooks, suppressions and templates; cancel-email and update-email; transactional emails (create, list, get, update, remove, send-test, stats); agent inboxes (create, list, get, delete, threads, messages, send, reply, forward, update-thread, drafts); automations (create, list, get, update, duplicate, stop, remove, runs); events (send-event, create, list, get, update, remove).
- The tool result is the endpoint's JSON response as text. `isError` is true when the endpoint returned 400 or above.
- Protocol versions 2025-06-18, 2025-11-25 and 2026-07-28: the server answers with the version the client asks for when it is one of these, otherwise with the newest. Request bodies are limited to 1 MB.

## Billing

One prepaid credit balance pays for every service. Sending an email costs credits per recipient (1 by default); other services are listed with their price and say when they are not charged yet. A subaccount draws on its parent's balance. When the balance runs out, sends answer 402 `insufficient_credits`. See [Credits and pricing](https://developer.send.io/docs/credits).

### Retrieve the balance

`GET /billing/balance` (https://developer.send.io/docs/api#get-credit-balance)

The credit balance your team can spend, with lifetime totals. For a subaccount it is the parent's balance, with `shared_with_parent` set.

Response fields:

- `first_purchase_at` (string | null): When credits were first bought, or null before the first purchase.
- `unpaid_daily_limit` (number | null): Emails per day you can send until your first purchase, broadcasts included; null once you have bought credits or are on a paid plan. It applies again when a paid plan ends and the workspace is back on the Free plan.
- `last_topup_at` (string | null): When the last credits were added, or null when none.
- `daily_limit` (object | null): The daily sending limit that applies now: `reason` (`unpaid` before the first purchase or back on the Free plan, `ramp` for new paid accounts), `limit`, `used` and `remaining` today, `resets_at` (00:00 UTC), and for `ramp` `ramp_days` and `lifts_at`. null when no such limit applies.
- `daily_limit.reason` (string): `unpaid` or `ramp`.
- `daily_limit.limit` (integer): Recipients per day.
- `daily_limit.used` (integer): Recipients counted today (UTC).
- `daily_limit.remaining` (integer): `limit` minus `used`, never below 0.
- `daily_limit.resets_at` (string): The next 00:00 UTC.
- `daily_limit.ramp_days` (integer | null): How many days the paid ramp lasts; null for `unpaid`.
- `daily_limit.lifts_at` (string | null): When the paid ramp ends; null for `unpaid`.
- `low_balance_credits` (number | null): Under this balance you get the `credits.low` webhook and email; null when no threshold is set.
- `last_topup` (number): The most recent credits added (a purchase, a grant or a monthly allowance), `0` when none.
- `last_topup_millicredits` (integer): `last_topup` in thousandths of a credit.
- `spend_14d` (number): Credits used in the last 14 days, subaccounts included.
- `spend_14d_millicredits` (integer): `spend_14d` in thousandths of a credit.
- `checkout_available` (boolean): Whether credits can be bought online right now (Billing in the dashboard). When false, contact support@send.io.

- `low_balance_credits`: under this balance you get the `credits.low` webhook and email (once, until you top up).
- `unpaid_daily_limit`: recipients per day you can send to until your first purchase (each To, Cc and Bcc address counts as one); `null` once you have bought credits or are on a paid plan. When a paid plan ends and the workspace is back on the Free plan without bought credits, the limit applies again. It is a daily cap, separate from `balance`: it gives no credits.
- `daily_limit`: the daily cap in force, `null` when there is none. `reason` `unpaid`: the unpaid daily limit above, until the first purchase and again on the Free plan after a paid plan has ended. `reason` `ramp`: new paid accounts can send to up to 5,000 recipients a day for the first 7 days after the first purchase (by default); `lifts_at` says when it ends for you. `limit`, `used` and `remaining` count recipients (each To, Cc and Bcc address), and a scheduled email counts on the day it was created. Over the limit, sends answer 429 `daily_quota_exceeded` until 00:00 UTC (05:30 IST).
- `last_topup`: the most recent credits added (a purchase, a grant or a monthly allowance), `0` when none; with `balance` it shows how much of that top-up is left.
- `spend_14d`: credits used in the last 14 days (the whole account, subaccounts included); divide by 14 for the average daily spend.
- `balance`, `purchased`, `granted` and `used` are credits with up to 3 decimals; the `_millicredits` fields are the same amounts as integers.

### Retrieve pricing

`GET /billing/pricing` (https://developer.send.io/docs/api#get-pricing)

What each service costs in credits, the monthly plans, and the credit packs and custom amount when they are on sale. Public: no API key needed.

- No API key needed on the API host.
- `metered: false` means the service is listed but not charged yet.
- `next_change` announces a scheduled price: the new `credits_per_unit` and when it takes effect. Usage is charged at the price in force when the email was created.
- `monthly.catalog.plans`: the monthly plans. A plan's `credits` are added every billing cycle for `price_cents` a month. A plan with `active: false` is not on sale, and `contact_sales: true` means the price is agreed with sales. Read plans and prices from here: they change with each published `monthly.revision`. The catalog also carries its policy and service rates.
- `monthly.checkout_enabled`: whether plans can be bought online right now.
- `packs` and `custom_amount` are one-time credit purchases, offered only when send.io has them on sale. Otherwise `packs` is empty and `custom_amount.enabled` is `false`, and the other `custom_amount` fields do not apply. When they are on sale, one purchase is one pack, or one custom amount from `custom_amount.min_credits` to `custom_amount.max_credits`.
- `custom_amount.pricing` is `pack_ladder` or `flat`. On the pack ladder a custom amount costs the per-credit rate of the largest pack at or below it (below the smallest pack, that pack's rate), rounded up to the cent, and never more than any larger pack. With `flat` it costs `credits × price_cents_per_1000 / 1000` cents, rounded up to the cent. `GET /billing/pricing/custom` gives the exact price.
- `unpaid_daily_limit`: until your first credit purchase you can send to this many recipients a day (each To, Cc and Bcc address counts as one). Broadcasts count toward this limit, a scheduled email counts on the day it was created, and the count resets at 00:00 UTC. `null`: no such limit.
- `paid_ramp`: after the first purchase, new paid accounts can send to up to `daily_limit` recipients a day for the first `days` days, then there is no daily limit. `null`: no such limit.
- `checkout_available`: whether credits can be bought online right now. It is `false` when online payment is not set up or send.io has checkout switched off; a pack or custom amount purchase is refused then. When it is `false`, contact support@send.io to raise your limit.
- `tax_added_at_checkout`: when `true`, prices are before tax and Stripe adds tax at checkout where it applies. Every purchase gets an invoice.

### Price a custom amount

`GET /billing/pricing/custom` (https://developer.send.io/docs/api#get-custom-price)

The exact price of buying a custom number of credits: the amount the checkout charges, before tax.

Query parameters:

- `credits` (integer, required): How many credits, a whole number within `custom_amount.min_credits` and `max_credits` of [Retrieve pricing](https://developer.send.io/docs/api#get-pricing).

Response fields:

- `object` (string): Always `custom_price`.
- `credits` (integer): The amount you asked about.
- `price_cents` (integer): The price in cents, before tax.
- `currency` (string): The price's currency (`usd`).
- `based_on_pack_id` (string | null): The pack whose per-credit rate priced it on the pack ladder, or null with flat pricing.

- Priced as `custom_amount.pricing` says ([Retrieve pricing](https://developer.send.io/docs/api#get-pricing)): on the pack ladder, the per-credit rate of the largest pack at or below the amount, rounded up to the cent and never more than any larger pack; with `flat`, `price_cents_per_1000` per 1,000 credits, rounded up to the cent.
- Needs an API key, unlike Retrieve pricing.
- Answers 422 `validation_error` when `credits` is missing or not a whole number, is outside the custom amount range, or custom amounts are turned off.

### List transactions

`GET /billing/transactions` (https://developer.send.io/docs/api#list-credit-transactions)

Every change to the balance, newest first: purchases, grants, usage, refunds and corrections.

Query parameters:

- `limit` (number): How many to return, 1 to 100. Default 20.
- `after` (string): The `id` of the last item of the previous page (the next, older page). Use it while `has_more` is true. Cannot be combined with `before`.
- `before` (string): The `id` of the first item of the page you have (the previous, newer page). Cannot be combined with `after`.
- `kind` (string): Only this kind: `subscription` (a monthly allowance: the Free plan's, given at sign-up and at each renewal, or a paid plan's), `purchase`, `grant`, `adjustment`, `usage`, `refund`, `migration`, `reversal`, `expiry`, or `welcome` (the first free credits of an account made before December 2026, when the Free allowance replaced them).

Response fields:

- `data[].object` (string): Always `credit_transaction`.
- `data[].id` (string): The transaction id; use it as the `after` or `before` cursor.
- `data[].kind` (string): `subscription` (a monthly allowance: the Free plan's, given at sign-up and at each renewal, or a paid plan's), `purchase`, `grant`, `adjustment`, `usage`, `refund`, `migration`, `reversal`, `expiry`, or `welcome` (the first free credits of an account made before December 2026, when the Free allowance replaced them).
- `data[].amount` (number): Credits added (positive) or taken (negative), up to 3 decimals.
- `data[].balance_after` (number): The balance right after this transaction.
- `data[].service` (string | null): The service a usage row is for (`email.sent`), or null for other kinds.
- `data[].quantity` (integer | null): Units used, or null for other kinds.
- `data[].unit_credits` (number | null): Credits per unit, or null for other kinds.
- `data[].source_team_id` (string | null): The team or subaccount whose usage it was, or null.
- `data[].actor_type` (string): Who made the change: `system` (usage, the Free plan's allowance, expiry), `stripe` (purchases), `admin` (send.io support: grants, refunds, corrections) or `customer`.
- `data[].reason` (string): Why a grant, refund or correction was made; an empty string when none.
- `data[].reference` (string): What it belongs to, such as a purchase, a support ticket or the UTC day (`YYYY-MM-DD`) of a daily charge (agent inboxes); an empty string when none.
- `data[].created_at` (string): When it was recorded.

- `amount` is signed: negative for usage and other debits. `source_team_id` is the team or subaccount whose usage it was.

### Retrieve usage

`GET /billing/usage` (https://developer.send.io/docs/api#get-credit-usage)

Credits used per day and service, with totals for the period.

Query parameters:

- `days` (number): How many days back, up to 365. Default 30.

- Days are UTC. Days without usage are left out.

### Retrieve account usage and limits

`GET /usage` (https://developer.send.io/docs/api#get-account-usage)

What the account has used against its limits: emails sent today and this billing period, contacts, segments, broadcasts, domains, automation runs and the API rate limit. The SDKs' `usage.get()` calls it.

Response fields:

- `emails.daily.limit` (number | null): Emails per day, or null when there is no daily limit.
- `emails.daily.resets_at` (string): The next 00:00 UTC.
- `emails.monthly.limit` (number): Emails per billing period.
- `emails.monthly.resets_at` (string): The end of the billing period.
- `contacts.limit` (number | null): Always null: contacts have no limit.
- `segments.limit` (number | null): Always null: segments have no limit.
- `broadcasts.limit` (number | null): Always null: broadcasts have no limit.
- `domains.limit` (number | null): The plan's domain limit.
- `automation_runs.limit` (number | null): Always null: automation runs have no limit.
- `ai_credits.limit` (number | null): Always null.
- `ai_credits.next_increase_at` (string | null): Always null.

- `emails.*.used` and `sent` count emails sent; `received` counts inbound email, which does not count against the limit. The daily window is the UTC day.
- A parent account's numbers include its subaccounts', as its limits do. A subaccount with its own limits sees its own numbers and limits.
- `ai_credits` is always 0 with no limit: no send.io service spends AI credits. It is kept so SDK models read the same shape.
- `rate_limit.limit` is the requests per second allowed for your team.
- For credits used per day and service, see [Retrieve usage](#get-credit-usage) (`GET /billing/usage`).

### List purchases

`GET /billing/purchases` (https://developer.send.io/docs/api#list-credit-purchases)

Credit purchases with their payment status, Stripe invoice and receipt, newest first.

Query parameters:

- `limit` (number): How many to return, 1 to 100. Default 20.
- `after` (string): The `id` of the last item of the previous page (the next, older page). Use it while `has_more` is true. Cannot be combined with `before`.
- `before` (string): The `id` of the first item of the page you have (the previous, newer page). Cannot be combined with `after`.

Response fields:

- `data[].pack_id` (string | null): The credit pack bought, or null for any other purchase. Packs are offered only when send.io has them on sale.
- `data[].refunded_cents` (integer): How much of the payment has been refunded, in cents. `0` when none.
- `data[].receipt_url` (string | null): The Stripe receipt, or null until the payment succeeds.
- `data[].total_cents` (integer | null): What was paid, tax included and discounts taken off; null until Stripe reports the payment.
- `data[].tax_cents` (integer | null): Tax on the purchase; null until Stripe reports the payment.
- `data[].discount_cents` (integer | null): Discount from a promotion code; null until Stripe reports the payment.
- `data[].invoice_url` (string | null): The Stripe invoice page, or null until it is paid.
- `data[].invoice_pdf_url` (string | null): The Stripe invoice PDF, or null until it is paid.
- `data[].paid_at` (string | null): When the payment succeeded, or null.

- `status`: `pending`, `paid`, `failed`, `canceled`, `refunded` or `partially_refunded`. Credits are bought in the dashboard (Settings, Billing).
- `amount_cents` is the price of the credits, before tax and discounts. `total_cents` is what was paid, with `tax_cents` added and `discount_cents` taken off. They are `null` until Stripe reports the payment. A promotion code never reduces the credits you get.
- `invoice_url` and `invoice_pdf_url`: the Stripe invoice of the purchase, once it is paid.

## Sending reputation

Your team's hard bounce and complaint rates against the limits of its volume tier, over the last 24 hours and 7 days (the worse decides). At 80% of a limit the team is in `warning`; at the limit it is `suspended` and sends answer 403 `sending_suspended` until our team reviews it. See [Sending reputation](https://developer.send.io/docs/sending-reputation).

### Retrieve sending reputation

`GET /reputation` (https://developer.send.io/docs/api#get-reputation)

The team's reputation state, since when, its volume tier, the worst rate against its limit, both windows, and today's bulk (broadcast and automation) cap.

Response fields:

- `since` (string | null): When the team entered this state, or null before the first evaluation.
- `suspended_by_parent` (boolean): The parent account is suspended, so this subaccount reads `suspended` too.
- `subaccount_suspended` (boolean): This subaccount itself is suspended (by send.io or its parent): its sends answer 403 `subaccount_suspended`. Always false for a main account.
- `evaluated_at` (string | null): When the rates were last computed, or null before the first evaluation.
- `tier` (string | null): The volume tier, or null before the first evaluation.
- `accepted_30d` (number | null): Emails accepted in the last 30 days, or null before the first evaluation.
- `limits` (object | null): The tier's limits, or null before the first evaluation.
- `worst` (object | null): The measure closest to its limit, or null before the first evaluation.
- `windows` (object): Keys `24h` and `7d`, each present once that window has been evaluated. `{}` before the first evaluation.
- `windows.24h` (object): The last 24 hours. Left out before the first evaluation.
- `windows.24h.worst` (object | null): The window's measure closest to its limit, or null.
- `windows.7d` (object): The last 7 days. Left out before the first evaluation.
- `windows.7d.worst` (object | null): The window's measure closest to its limit, or null.

- `state`: `healthy`, `warning` or `suspended`. A subaccount whose parent is suspended reads `suspended` with `suspended_by_parent: true`.
- `worst`: the measure closest to its limit. `judged: "rates"` compares `value` with `limit` (fractions: 0.05 is 5%); `judged: "counts"` (small senders, or few events) compares `count` with `count_limit`.
- `since`, `evaluated_at`, `tier`, `accepted_30d`, `limits` and `worst` are `null`, and `windows` is `{}`, until the team is first evaluated.
- `subaccount_suspended`: this subaccount itself is suspended, by send.io or by its parent account. Its sends answer 403 `subaccount_suspended`.
- `bulk`: today's (UTC) cap on broadcast and automation recipients; recipients over it are sent the next day.

## Inboxes (AgentMail-compatible, /v0)

The AgentMail-compatible API, under `/v0`: the same paths, request bodies and responses as AgentMail, so an agent built with an AgentMail SDK moves to send.io by changing the base URL and the API key. In these paths `inbox_id` is the inbox's email address. It works on the same inboxes as the Platform endpoints under `/inboxes`, `/inbox` and `/pods`, which use send.io's own shapes. Both are current. Use the Platform endpoints in new code, and `/v0` when your agent already uses an AgentMail SDK.

An inbox is an email address your agent sends and receives from. The inbox address is its `inbox_id` in every path.

### List inboxes

`GET /v0/inboxes` (https://developer.send.io/docs/api#am-list-inboxes)

Lists the inboxes in your organization, newest first.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.

- `next_page_token` is only present when there is another page.
- A key scoped to one inbox or pod only sees the inboxes it can reach.

### Search inboxes

`GET /v0/inboxes/search` (https://developer.send.io/docs/api#am-search-inboxes)

Lists inboxes whose address, display name or client ID contains the search text.

Query parameters:

- `q` (string): Text to look for (case-insensitive). `query` is accepted as an alias.
- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.

- send.io extension.

### Create inbox

`POST /v0/inboxes` (https://developer.send.io/docs/api#am-create-inbox)

Creates an inbox. Leave out `username` for a random address. Leave out `domain` for a free mailbox on your workspace's sendiomail.com address.

Body:

- `username` (string): On a free mailbox (the default, no `domain` given): a-z, 0-9, dot and dash, 2 to 32 characters, not starting or ending with a dot or dash. On your own domain or the shared agent domain: a-z, 0-9, dot, dash, underscore and plus, 1 to 64 characters. Random when left out.
- `domain` (string): Leave it out for a free mailbox at name@<org>.sendiomail.com (the label is your workspace's own; free mailboxes have no IMAP or SMTP login). Or give a domain verified for sending on your team, the shared agent domain (agents.send.io), or a company subdomain of it (acme.agents.send.io). GET https://api.send.io/agent-domain (the send.io API, not under /v0) names both domains.
- `display_name` (string): The sender name shown on mail from this inbox.
- `client_id` (string): Your own ID for the inbox. If an inbox with this client ID exists, it is returned instead of a new one.
- `pod_id` (string): Put the inbox in this pod.
- `metadata` (object): Any JSON object to keep with the inbox.

Example request body:

```json
{
  "username": "support",
  "domain": "acme.com",
  "display_name": "Acme Support",
  "client_id": "support-inbox-1"
}
```

- Which free domain is which: name@<org>.sendiomail.com is your workspace's free mailbox, made here when you give no domain (GET https://api.send.io/agent-domain returns it as `free_mailbox_domain`). name@org.sendioinbox.com is the no-signup agent mailbox (/docs/agent-mailbox), made with no account and sealed to its key; claimed into a workspace it keeps its sendioinbox.com address and counts as one of the workspace's free mailboxes.
- send.io extension: `credentials` (an IMAP/SMTP login; the password is an API key scoped to this inbox, shown only once) is returned for an inbox on your own domain or the shared agent domain. A free mailbox has no IMAP or SMTP login: it has no `credentials` and its `imap_smtp` is `unavailable`. Use the API, MCP or the Unibox with it.
- On the shared agent domain, reserved usernames (abuse, postmaster, support, admin, noreply and similar) are refused. A free mailbox's org label and a company subdomain belong to your workspace alone, so there only mail-system names (abuse, postmaster, hostmaster, webmaster, mailer-daemon, root) are refused.
- Returns 409 when the address is taken, and 403 when the domain is not verified for your team.
- With a scoped key, only a pod-scoped key can create inboxes (always in its own pod).

### Get inbox

`GET /v0/inboxes/{inbox_id}` (https://developer.send.io/docs/api#am-get-inbox)

Gets one inbox.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

### Update inbox

`PATCH /v0/inboxes/{inbox_id}` (https://developer.send.io/docs/api#am-update-inbox)

Changes an inbox's display name, metadata or message retention.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Body:

- `display_name` (string): New sender name. Up to 100 characters, no quotes, angle brackets or line breaks.
- `metadata` (object): Keys to merge into the inbox's metadata.
- `message_ttl_hours` (number | null): Delete messages after this many hours (1 to 8760). Send 0 or null to keep them forever.

Example request body:

```json
{
  "display_name": "Acme Help Desk",
  "metadata": {
    "tier": "priority"
  }
}
```

- `metadata` is merged with what is stored, not replaced.
- send.io extension: `message_ttl_hours`.

### Delete inbox

`DELETE /v0/inboxes/{inbox_id}` (https://developer.send.io/docs/api#am-delete-inbox)

Deletes an inbox. The address stops receiving mail and pending drafts are discarded. Existing threads stay readable.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `keep_mailbox` (boolean): send.io extension: keep the address as a plain mailbox (IMAP/SMTP still work). Not allowed for addresses on the shared agent domain.

### Approve sign-in

`POST /v0/inboxes/{inbox_id}/authorize` (https://developer.send.io/docs/api#am-authorize-sign-in)

Approves a "Sign in with AgentID" request for this inbox, so the agent can log in to a third-party app with its email address.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Body:

- `auth_token` (string, required): The sign-in token the app gave the agent.
- `accept_disclosure` (boolean): Must be true when the app asks for the owner's name or email.

Example request body:

```json
{
  "auth_token": "atk_4f9b2c7e1d8a6b3c5e0f"
}
```

- Part of AgentID (sign in with an agent identity).
- Returns 404 when the sign-in does not exist, expired or was already approved. Any key that can reach the inbox may approve; no permission is needed.

### Get an ID-JAG

`POST /v0/inboxes/{inbox_id}/id-jag` (https://developer.send.io/docs/api#am-id-jag)

Mints a 5 minute identity assertion (ID-JAG) for another auth.md service, so this agent can register there without a sign-up form. The service must trust send.io's issuer.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Body:

- `audience` (string, required): The service's issuer, from its /.well-known/oauth-authorization-server. send.io reads that document and refuses services without auth.md registration.
- `client_id` (string): Your client id at the service, when you have one. Default: the agent's opaque id.

Example request body:

```json
{
  "audience": "https://auth.example.com"
}
```

- send.io extension (AgentID as an auth.md agent provider). Send assertion to identity_endpoint as type identity_assertion.
- Claims: sub is the agent, email and email_verified are its verified human, auth_time is when the human last signed in to send.io or verified the agent. Signed RS256 with the AgentID keys (/v0/jwks.json).
- 403 when the agent has no verified human. 422 when the audience has no auth.md discovery. 60 per hour per inbox. Any key that can reach the inbox may call it.

### End ID-JAG delegations

`DELETE /v0/inboxes/{inbox_id}/id-jag` (https://developer.send.io/docs/api#am-id-jag-revoke)

Tells every service this agent registered at with an ID-JAG that the delegation ended (a Security Event Token to each service's events endpoint), and forgets them. Deleting the inbox does the same.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

- services counts the services the agent had assertions for; notified counts those that accepted the event.

## Messages (AgentMail-compatible, /v0)

Messages sent and received by an inbox. Send a new message, reply, forward, label and read attachments.

### List messages

`GET /v0/inboxes/{inbox_id}/messages` (https://developer.send.io/docs/api#am-list-messages)

Lists the inbox's sent and received messages, newest first. Bodies are left out; get one message for them.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.
- `labels` (string[]): Only items that have all of these labels. Send a JSON array (labels=["unread"]), a comma list, or repeat the parameter.
- `before` (string): Only items before this RFC 3339 time.
- `after` (string): Only items after this RFC 3339 time.
- `ascending` (boolean): Oldest first when true. Default is newest first.
- `include_spam` (boolean): Include spam. Hidden by default unless you ask for the spam label.
- `include_trash` (boolean): Include trash. Hidden by default unless you ask for the trash label.
- `from` (string): send.io extension: only messages whose sender contains this text.
- `to` (string): send.io extension: only messages whose To or CC contains this text.
- `subject` (string): send.io extension: only messages whose subject contains this text.

- System labels (`received`, `sent`, `unread`, `spam`, `trash`, `delivered`, `bounced`, `complained`, `failed`, `opened`) are worked out from the message state. Custom labels are stored as given.
- Covers the newest 2,000 messages of the inbox.
- `bcc` is always an empty list in listed messages.

### Search messages

`GET /v0/inboxes/{inbox_id}/messages/search` (https://developer.send.io/docs/api#am-search-messages)

Same as List messages, but only messages whose subject, preview, sender, recipients or extracted text contain the search text.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `q` (string): Text to look for (case-insensitive). `query` is accepted as an alias.
- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.
- `labels` (string[]): Only items that have all of these labels. Send a JSON array (labels=["unread"]), a comma list, or repeat the parameter.
- `before` (string): Only items before this RFC 3339 time.
- `after` (string): Only items after this RFC 3339 time.
- `ascending` (boolean): Oldest first when true. Default is newest first.
- `include_spam` (boolean): Include spam. Hidden by default unless you ask for the spam label.
- `include_trash` (boolean): Include trash. Hidden by default unless you ask for the trash label.

- send.io extension: a simple case-insensitive text match.

### Send message

`POST /v0/inboxes/{inbox_id}/messages/send` (https://developer.send.io/docs/api#am-send-message)

Sends a new message from the inbox. It starts a new thread.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Body:

- `to` (string | string[], required): Recipient addresses.
- `cc` (string | string[]): CC addresses.
- `bcc` (string | string[]): BCC addresses.
- `subject` (string, required): The subject line.
- `text` (string): Plain-text body.
- `html` (string): HTML body.
- `reply_to` (string | string[]): Reply-To addresses.
- `headers` (object): Extra email headers as name/value pairs.
- `labels` (string[]): Labels to put on the new thread (1 to 64 characters each, lowercased).
- `attachments` (object[]): Files to attach.
- `attachments[].filename` (string): The file name.
- `attachments[].content` (string): The file as base64. Use this or `url`.
- `attachments[].url` (string): A public URL send.io downloads the file from.
- `attachments[].content_type` (string): MIME type of the file.

Example request body:

```json
{
  "to": [
    "dana@northwind.io"
  ],
  "subject": "Your new invoice",
  "text": "Hi Dana, your corrected invoice is attached.",
  "labels": [
    "billing"
  ],
  "attachments": [
    {
      "filename": "invoice-4821.pdf",
      "content": "JVBERi0xLjQKJ..."
    }
  ]
}
```

- Send an `Idempotency-Key` header (1 to 256 characters) to make retries safe: the same key and body within 24 hours returns the first response.
- Returns 403 `message_rejected` when a recipient is blocked by the inbox's send list.

### Batch get messages

`POST /v0/inboxes/{inbox_id}/messages/batch-get` (https://developer.send.io/docs/api#am-batch-get-messages)

Gets up to 100 messages with their bodies in one call. IDs that are not found are skipped.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Body:

- `message_ids` (string[], required): Up to 100 message IDs.

Example request body:

```json
{
  "message_ids": [
    "8d2c4a91-3f7e-4b6d-a0c2-5e1f9b7d3a64",
    "2e9f7b3c-6a1d-4c58-b0e4-9d3f2a7c1b65"
  ]
}
```

- send.io extension.

### Batch update messages

`PATCH /v0/inboxes/{inbox_id}/messages/batch` (https://developer.send.io/docs/api#am-batch-update-messages)

Adds and removes labels on up to 100 messages at once.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Body:

- `message_ids` (string[], required): Up to 100 message IDs.
- `add_labels` (string[]): Labels to add.
- `remove_labels` (string[]): Labels to remove.

Example request body:

```json
{
  "message_ids": [
    "8d2c4a91-3f7e-4b6d-a0c2-5e1f9b7d3a64"
  ],
  "add_labels": [
    "read",
    "billing"
  ]
}
```

- send.io extension. Labels work the same as in Update message.

### Get message

`GET /v0/inboxes/{inbox_id}/messages/{message_id}` (https://developer.send.io/docs/api#am-get-message)

Gets one message with its text and HTML bodies.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `message_id` (string, required): The message ID.

- `extracted_text` and `extracted_html` (the new reply without the quoted history) are set on received messages only.
- `html` and `extracted_html` are the sender's HTML exactly as received, scripts and event attributes included. Treat them as untrusted: sanitize before you show them in a browser, or use `text`.
- `smtp_id`, `in_reply_to` and `references` are Message-IDs in header form, with angle brackets (<id@host>), so you can compare them as they are.

### Update message

`PATCH /v0/inboxes/{inbox_id}/messages/{message_id}` (https://developer.send.io/docs/api#am-update-message)

Adds and removes labels on a message.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `message_id` (string, required): The message ID.

Body:

- `add_labels` (string[]): Labels to add.
- `remove_labels` (string[]): Labels to remove.

Example request body:

```json
{
  "add_labels": [
    "read",
    "billing"
  ],
  "remove_labels": [
    "needs-reply"
  ]
}
```

- Adding `read` (or removing `unread`) marks the message read; adding `unread` marks it unread. Adding `trash` moves it to trash; removing `trash` restores it.
- Other system labels (`received`, `sent`, `spam`, delivery states) cannot be set and are ignored.
- The response is only the message ID and its new labels, not the full message.

### Delete message

`DELETE /v0/inboxes/{inbox_id}/messages/{message_id}` (https://developer.send.io/docs/api#am-delete-message)

Moves the message to trash. Deleting a message that is already in trash removes it for good.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `message_id` (string, required): The message ID.

- A deleted sent message is only removed from the inbox; the send record stays in your email logs and still counts in the inbox's metrics.

### Get raw message

`GET /v0/inboxes/{inbox_id}/messages/{message_id}/raw` (https://developer.send.io/docs/api#am-get-raw-message)

Gets the original RFC 822 source of a received message.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `message_id` (string, required): The message ID.

- The source comes back inline as JSON (`raw`), not as a download link.
- Only received messages keep their raw source; sent messages return 404.

### Reply to message

`POST /v0/inboxes/{inbox_id}/messages/{message_id}/reply` (https://developer.send.io/docs/api#am-reply-to-message)

Sends a reply in the message's thread. It goes to the sender (or its Reply-To) with the right In-Reply-To and References headers.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `message_id` (string, required): The message ID.

Body:

- `text` (string): Plain-text body. `text` or `html` is required.
- `html` (string): HTML body.
- `to` (string | string[]): Override the recipients. Default is the original sender (or its Reply-To).
- `cc` (string | string[]): CC addresses.
- `bcc` (string | string[]): BCC addresses.
- `labels` (string[]): Labels to put on the sent reply.
- `attachments` (object[]): Files to attach, same shape as Send message.
- `reply_to` (string | string[]): Reply-To addresses.

Example request body:

```json
{
  "text": "Hi Dana, sorry about that. The corrected invoice is on its way.",
  "labels": [
    "billing"
  ]
}
```

- Send an `Idempotency-Key` header (1 to 256 characters) to make retries safe: the same key and body within 24 hours returns the first response.
- The reply answers the newest received message in the thread, and the subject is always "Re: " plus the thread subject.
- `attachments`, `reply_to`, `headers` and `tags` work as on Send message; the thread's In-Reply-To and References always win over your headers.
- Returns 403 `message_rejected` when the inbox's reply list blocks the sender.

### Reply all to message

`POST /v0/inboxes/{inbox_id}/messages/{message_id}/reply-all` (https://developer.send.io/docs/api#am-reply-all-message)

Like Reply to message, but also copies everyone else on the original To and CC lines (except this inbox).

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `message_id` (string, required): The message ID.

Body:

- `text` (string): Plain-text body. `text` or `html` is required.
- `html` (string): HTML body.
- `to` (string | string[]): Override the recipients. Default is the original sender (or its Reply-To).
- `cc` (string | string[]): CC addresses.
- `bcc` (string | string[]): BCC addresses.
- `labels` (string[]): Labels to put on the sent reply.
- `attachments` (object[]): Files to attach, same shape as Send message.
- `reply_to` (string | string[]): Reply-To addresses.

Example request body:

```json
{
  "text": "Thanks all, we have fixed the invoice."
}
```

- Send an `Idempotency-Key` header (1 to 256 characters) to make retries safe: the same key and body within 24 hours returns the first response.
- When you send `cc` yourself, it replaces the automatic CC list.

### Forward message

`POST /v0/inboxes/{inbox_id}/messages/{message_id}/forward` (https://developer.send.io/docs/api#am-forward-message)

Forwards the message to new recipients. The original is quoted below your text, and the subject gets a "Fwd: " prefix.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `message_id` (string, required): The message ID.

Body:

- `to` (string | string[], required): Recipient addresses.
- `cc` (string | string[]): CC addresses.
- `bcc` (string | string[]): BCC addresses.
- `subject` (string): Default is "Fwd: " plus the original subject.
- `text` (string): Your note above the forwarded message.
- `attachments` (object[]): Files to attach, same shape as Send message.
- `labels` (string[]): Labels for the new thread.

Example request body:

```json
{
  "to": [
    "billing@acme.com"
  ],
  "text": "Can you look at this one?"
}
```

- Send an `Idempotency-Key` header (1 to 256 characters) to make retries safe: the same key and body within 24 hours returns the first response.
- The forward is sent as plain text; any `html` is dropped. The original's attachments are not copied.
- The forward starts a new thread.

### Get attachment

`GET /v0/inboxes/{inbox_id}/messages/{message_id}/attachments/{attachment_id}` (https://developer.send.io/docs/api#am-get-message-attachment)

Gets an attachment's details and a signed download link that works for one hour.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `message_id` (string, required): The message ID.
- `attachment_id` (string, required): The attachment ID, from the message's `attachments[].attachment_id`.

- send.io extension: `text_url` (the attachment's extracted text) is present when text could be extracted.

## Threads (AgentMail-compatible, /v0)

A thread groups a message and its replies. Read threads per inbox, or across every inbox in the organization with /threads.

### List threads

`GET /v0/inboxes/{inbox_id}/threads` (https://developer.send.io/docs/api#am-list-inbox-threads)

Lists the inbox's threads, most recent activity first.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.
- `labels` (string[]): Only items that have all of these labels. Send a JSON array (labels=["unread"]), a comma list, or repeat the parameter.
- `before` (string): Only items before this RFC 3339 time.
- `after` (string): Only items after this RFC 3339 time.
- `ascending` (boolean): Oldest first when true. Default is newest first.
- `include_spam` (boolean): Include spam. Hidden by default unless you ask for the spam label.
- `include_trash` (boolean): Include trash. Hidden by default unless you ask for the trash label.

- Thread labels: `unread`, `spam` and `trash` are worked out from state; the rest are custom labels. Archived threads are not listed.

### Search threads

`GET /v0/inboxes/{inbox_id}/threads/search` (https://developer.send.io/docs/api#am-search-inbox-threads)

Lists the inbox's threads whose subject, preview, senders or recipients contain the search text.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `q` (string): Text to look for (case-insensitive). `query` is accepted as an alias.
- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.
- `labels` (string[]): Only items that have all of these labels. Send a JSON array (labels=["unread"]), a comma list, or repeat the parameter.
- `before` (string): Only items before this RFC 3339 time.
- `after` (string): Only items after this RFC 3339 time.
- `ascending` (boolean): Oldest first when true. Default is newest first.
- `include_spam` (boolean): Include spam. Hidden by default unless you ask for the spam label.
- `include_trash` (boolean): Include trash. Hidden by default unless you ask for the trash label.

- send.io extension.

### Get thread

`GET /v0/inboxes/{inbox_id}/threads/{thread_id}` (https://developer.send.io/docs/api#am-get-inbox-thread)

Gets a thread with all its messages, oldest first, including bodies.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `thread_id` (string, required): The thread ID.

Query parameters:

- `include_trash` (boolean): Include messages that are in trash.

### Update thread

`PATCH /v0/inboxes/{inbox_id}/threads/{thread_id}` (https://developer.send.io/docs/api#am-update-inbox-thread)

Adds and removes labels on a thread.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `thread_id` (string, required): The thread ID.

Body:

- `add_labels` (string[]): Labels to add.
- `remove_labels` (string[]): Labels to remove.

Example request body:

```json
{
  "add_labels": [
    "read",
    "resolved"
  ],
  "remove_labels": [
    "needs-reply"
  ]
}
```

- Adding `read` (or removing `unread`) marks every message in the thread read. Adding `trash` moves the thread to trash; removing it restores it.
- `spam`, `received` and `sent` cannot be set and are ignored.

### Delete thread

`DELETE /v0/inboxes/{inbox_id}/threads/{thread_id}` (https://developer.send.io/docs/api#am-delete-inbox-thread)

Moves the thread to trash. Deleting a thread that is already in trash removes it and its messages for good.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `thread_id` (string, required): The thread ID.

### Get thread attachment

`GET /v0/inboxes/{inbox_id}/threads/{thread_id}/attachments/{attachment_id}` (https://developer.send.io/docs/api#am-get-inbox-thread-attachment)

Gets an attachment from any message in the thread, with a signed download link that works for one hour.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `thread_id` (string, required): The thread ID.
- `attachment_id` (string, required): The attachment ID, from the message's `attachments[].attachment_id`.

### List threads (organization)

`GET /v0/threads` (https://developer.send.io/docs/api#am-list-threads)

Lists threads across every inbox in the organization, most recent activity first.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.
- `labels` (string[]): Only items that have all of these labels. Send a JSON array (labels=["unread"]), a comma list, or repeat the parameter.
- `before` (string): Only items before this RFC 3339 time.
- `after` (string): Only items after this RFC 3339 time.
- `ascending` (boolean): Oldest first when true. Default is newest first.
- `include_spam` (boolean): Include spam. Hidden by default unless you ask for the spam label.
- `include_trash` (boolean): Include trash. Hidden by default unless you ask for the trash label.

- A scoped key only sees threads in its inbox or pod.

### Search threads (organization)

`GET /v0/threads/search` (https://developer.send.io/docs/api#am-search-threads)

Searches threads across every inbox by subject, preview, senders and recipients.

Query parameters:

- `q` (string): Text to look for (case-insensitive). `query` is accepted as an alias.
- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.
- `labels` (string[]): Only items that have all of these labels. Send a JSON array (labels=["unread"]), a comma list, or repeat the parameter.
- `before` (string): Only items before this RFC 3339 time.
- `after` (string): Only items after this RFC 3339 time.
- `ascending` (boolean): Oldest first when true. Default is newest first.
- `include_spam` (boolean): Include spam. Hidden by default unless you ask for the spam label.
- `include_trash` (boolean): Include trash. Hidden by default unless you ask for the trash label.

- send.io extension.

### Get thread (organization)

`GET /v0/threads/{thread_id}` (https://developer.send.io/docs/api#am-get-thread)

Gets a thread by ID without knowing its inbox, with all its messages.

Path parameters:

- `thread_id` (string, required): The thread ID.

Query parameters:

- `include_trash` (boolean): Include messages that are in trash.

### Update thread (organization)

`PATCH /v0/threads/{thread_id}` (https://developer.send.io/docs/api#am-update-thread)

Adds and removes labels on a thread by ID. Works like the inbox route.

Path parameters:

- `thread_id` (string, required): The thread ID.

Body:

- `add_labels` (string[]): Labels to add.
- `remove_labels` (string[]): Labels to remove.

Example request body:

```json
{
  "add_labels": [
    "resolved"
  ]
}
```

### Delete thread (organization)

`DELETE /v0/threads/{thread_id}` (https://developer.send.io/docs/api#am-delete-thread)

Moves the thread to trash, or removes it for good when it is already in trash.

Path parameters:

- `thread_id` (string, required): The thread ID.

### Get thread attachment (organization)

`GET /v0/threads/{thread_id}/attachments/{attachment_id}` (https://developer.send.io/docs/api#am-get-thread-attachment)

Gets an attachment from a thread by ID, with a signed download link that works for one hour.

Path parameters:

- `thread_id` (string, required): The thread ID.
- `attachment_id` (string, required): The attachment ID, from the message's `attachments[].attachment_id`.

## Drafts (AgentMail-compatible, /v0)

Drafts let an agent write a message that a human reviews before it goes out, or that sends itself at `send_at`.

### List drafts

`GET /v0/inboxes/{inbox_id}/drafts` (https://developer.send.io/docs/api#am-list-inbox-drafts)

Lists the inbox's unsent drafts (pending, sending or failed), newest first.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.
- `labels` (string[]): Only items that have all of these labels. Send a JSON array (labels=["unread"]), a comma list, or repeat the parameter.

Response fields:

- `drafts[].send_status` (string | null): `scheduled`: pending, with a `send_at` time. `sending`: a scheduled send is going out. `failed`: a scheduled send failed; change the draft or send it again. `null`: pending with no `send_at`, and also once the draft was sent (Get draft still returns a sent draft, the lists do not). A deleted draft is never returned: 404.

- Sent and discarded drafts are not listed.

### Create draft

`POST /v0/inboxes/{inbox_id}/drafts` (https://developer.send.io/docs/api#am-create-draft)

Creates a draft. Set `in_reply_to` to draft a reply in that message's thread, or `forward_of` to draft a forward.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Body:

- `to` (string | string[]): Recipients. Required unless `in_reply_to` is set; a reply draft is saved with the address it will go to (the message's Reply-To, else its sender).
- `cc` (string | string[]): CC addresses.
- `bcc` (string | string[]): BCC addresses.
- `reply_to` (string | string[]): Reply-To addresses.
- `subject` (string): Subject. For a reply, default is "Re: " plus the thread subject; for a forward, "Fwd: " plus the message's subject.
- `text` (string): Plain-text body. `text` or `html` is required (except for a forward).
- `html` (string): HTML body.
- `labels` (string[]): Labels on the draft.
- `attachments` (object[]): Files to attach, same shape as Send message.
- `in_reply_to` (string): A message ID in this inbox. The draft becomes a reply in its thread.
- `forward_of` (string): A message ID in this inbox to forward.
- `send_at` (string): RFC 3339 time to send the draft automatically. Must not be in the past. Leave out to wait for a send call.
- `client_id` (string): Your own ID. If a draft with this client ID exists in the inbox, it is returned instead.

Response fields:

- `send_status` (string | null): `scheduled`: pending, with a `send_at` time. `sending`: a scheduled send is going out. `failed`: a scheduled send failed; change the draft or send it again. `null`: pending with no `send_at`, and also once the draft was sent (Get draft still returns a sent draft, the lists do not). A deleted draft is never returned: 404.

Example request body:

```json
{
  "in_reply_to": "8d2c4a91-3f7e-4b6d-a0c2-5e1f9b7d3a64",
  "text": "Hi Dana, sorry about that. I've corrected the invoice to 10 seats and attached the new copy.",
  "labels": [
    "needs-review"
  ]
}
```

- `send_status` on every draft route. `scheduled`: pending, with a `send_at` time. `sending`: a scheduled send is going out. `failed`: a scheduled send failed; change the draft or send it again. `null`: pending with no `send_at`, and also once the draft was sent (Get draft still returns a sent draft, the lists do not). A deleted draft is never returned: 404.
- Recipients are checked when the draft is saved, as on send: an address that is not valid answers 422, and so does emptying `to` on a draft that is not a reply.

### Get draft

`GET /v0/inboxes/{inbox_id}/drafts/{draft_id}` (https://developer.send.io/docs/api#am-get-inbox-draft)

Gets one draft.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `draft_id` (string, required): The draft ID.

Response fields:

- `send_status` (string | null): `scheduled`: pending, with a `send_at` time. `sending`: a scheduled send is going out. `failed`: a scheduled send failed; change the draft or send it again. `null`: pending with no `send_at`, and also once the draft was sent (Get draft still returns a sent draft, the lists do not). A deleted draft is never returned: 404.

- A sent draft is still returned, with `send_status` null. A deleted draft answers 404.

### Update draft

`PATCH /v0/inboxes/{inbox_id}/drafts/{draft_id}` (https://developer.send.io/docs/api#am-update-draft)

Changes a pending draft. Only the fields you send are changed.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `draft_id` (string, required): The draft ID.

Body:

- `to` (string | string[]): Recipients.
- `cc` (string | string[]): CC addresses.
- `bcc` (string | string[]): BCC addresses.
- `reply_to` (string | string[]): Reply-To addresses.
- `subject` (string): Subject.
- `text` (string): Plain-text body.
- `html` (string): HTML body.
- `labels` (string[]): Replaces the draft's labels.
- `attachments` (object[]): Replaces the draft's attachments.
- `send_at` (string | null): RFC 3339 send time, or null to unschedule.

Response fields:

- `send_status` (string | null): `scheduled`: pending, with a `send_at` time. `sending`: a scheduled send is going out. `failed`: a scheduled send failed; change the draft or send it again. `null`: pending with no `send_at`, and also once the draft was sent (Get draft still returns a sent draft, the lists do not). A deleted draft is never returned: 404.

Example request body:

```json
{
  "text": "Hi Dana, the corrected invoice (10 seats) is attached. Sorry for the trouble!",
  "send_at": "2026-12-05T09:00:00Z"
}
```

- Only a pending or failed draft can be changed. Any other answers 409 `validation_error` with "Only a pending or failed draft can be changed."

### Delete draft

`DELETE /v0/inboxes/{inbox_id}/drafts/{draft_id}` (https://developer.send.io/docs/api#am-delete-draft)

Discards a pending draft so it is never sent.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `draft_id` (string, required): The draft ID.

- Only a pending or failed draft can be discarded. Any other answers 409 `validation_error` with "Only a pending or failed draft can be discarded."

### Send draft

`POST /v0/inboxes/{inbox_id}/drafts/{draft_id}/send` (https://developer.send.io/docs/api#am-send-draft)

Sends a pending draft now. Use this when a human approves the agent's draft.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `draft_id` (string, required): The draft ID.

- Send an `Idempotency-Key` header (1 to 256 characters) to make retries safe: the same key and body within 24 hours returns the first response.
- Only a pending or failed draft can be sent. A draft that was already sent, is being sent or was discarded answers 409 `validation_error` with "Only a pending or failed draft can be sent." No request body is needed.

### List drafts (organization)

`GET /v0/drafts` (https://developer.send.io/docs/api#am-list-drafts)

Lists unsent drafts across every inbox in the organization, newest first.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.
- `labels` (string[]): Only items that have all of these labels. Send a JSON array (labels=["unread"]), a comma list, or repeat the parameter.

Response fields:

- `drafts[].send_status` (string | null): `scheduled`: pending, with a `send_at` time. `sending`: a scheduled send is going out. `failed`: a scheduled send failed; change the draft or send it again. `null`: pending with no `send_at`, and also once the draft was sent (Get draft still returns a sent draft, the lists do not). A deleted draft is never returned: 404.

- A scoped key only sees drafts in its inbox or pod.

### Get draft (organization)

`GET /v0/drafts/{draft_id}` (https://developer.send.io/docs/api#am-get-draft)

Gets a draft by ID without knowing its inbox.

Path parameters:

- `draft_id` (string, required): The draft ID.

Response fields:

- `send_status` (string | null): `scheduled`: pending, with a `send_at` time. `sending`: a scheduled send is going out. `failed`: a scheduled send failed; change the draft or send it again. `null`: pending with no `send_at`, and also once the draft was sent (Get draft still returns a sent draft, the lists do not). A deleted draft is never returned: 404.

- A sent draft is still returned, with `send_status` null. A deleted draft answers 404.

## Inbox lists (AgentMail-compatible, /v0)

Allow and block lists for one inbox. Each list has a direction (`send`, `receive` or `reply`) and a type (`allow` or `block`). Entries are email addresses or domains.

### List entries

`GET /v0/inboxes/{inbox_id}/lists/{direction}/{type}` (https://developer.send.io/docs/api#am-list-inbox-list-entries)

Lists the entries on one of the inbox's lists, sorted by entry.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `direction` (string, required): `send`, `receive` or `reply`.
- `type` (string, required): `allow` or `block`.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.

### Create entry

`POST /v0/inboxes/{inbox_id}/lists/{direction}/{type}` (https://developer.send.io/docs/api#am-create-inbox-list-entry)

Adds an email address or domain to the list. Adding an existing entry updates its reason.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `direction` (string, required): `send`, `receive` or `reply`.
- `type` (string, required): `allow` or `block`.

Body:

- `entry` (string, required): An email address or a domain. Stored lowercased.
- `reason` (string): Why it is on the list.

Example request body:

```json
{
  "entry": "northwind.io",
  "reason": "Key customer"
}
```

- `entry_type` is `email` when the entry has an @, otherwise `domain`.

### Get entry

`GET /v0/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}` (https://developer.send.io/docs/api#am-get-inbox-list-entry)

Gets one entry from the list.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `direction` (string, required): `send`, `receive` or `reply`.
- `type` (string, required): `allow` or `block`.
- `entry` (string, required): The email address or domain.

### Delete entry

`DELETE /v0/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}` (https://developer.send.io/docs/api#am-delete-inbox-list-entry)

Removes an entry from the list.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `direction` (string, required): `send`, `receive` or `reply`.
- `type` (string, required): `allow` or `block`.
- `entry` (string, required): The email address or domain.

## Inbox webhooks (AgentMail-compatible, /v0)

Webhooks limited to one inbox. send.io posts events such as `message.received` to your URL.

### List webhooks

`GET /v0/inboxes/{inbox_id}/webhooks` (https://developer.send.io/docs/api#am-list-inbox-webhooks)

Lists the webhooks that cover this inbox, newest first.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.

### Create webhook

`POST /v0/inboxes/{inbox_id}/webhooks` (https://developer.send.io/docs/api#am-create-inbox-webhook)

Creates a webhook for this inbox. The response includes the signing `secret`. This API shows it only here; lost it? Rotate it with Rotate webhook secret.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Body:

- `url` (string, required): The HTTPS URL to post events to.
- `event_types` (string[]): Events to send: `message.received`, `message.received.spam`, `message.sent`, `message.delivered`, `message.bounced`, `message.complained`, `message.rejected`, `message.opened`. Default `["message.received"]`. Any other type answers 422: an inbox webhook only receives this inbox's message events (`domain.verified` needs a team webhook).
- `inbox_ids` (string[]): More inboxes (addresses or IDs) the webhook covers.
- `pod_ids` (string[]): Pods the webhook covers.
- `client_id` (string): Your own ID. If a webhook with this client ID exists, it is returned instead.

Example request body:

```json
{
  "url": "https://hooks.acme.com/agent",
  "event_types": [
    "message.received",
    "message.bounced"
  ]
}
```

- Inbox webhooks are team webhooks limited to inboxes or pods, so the team API manages the same webhook by the same ID: GET /webhooks/{id} (an admin's dashboard session or a full-access key) also returns its `signing_secret`, with `endpoint`, `events` and `status` for `url`, `event_types` and `enabled`.

### Get webhook

`GET /v0/inboxes/{inbox_id}/webhooks/{webhook_id}` (https://developer.send.io/docs/api#am-get-inbox-webhook)

Gets one webhook that covers this inbox.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `webhook_id` (string, required): The webhook ID.

### Update webhook

`PATCH /v0/inboxes/{inbox_id}/webhooks/{webhook_id}` (https://developer.send.io/docs/api#am-update-inbox-webhook)

Changes a webhook's URL, events, on/off state or the inboxes and pods it covers.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `webhook_id` (string, required): The webhook ID.

Body:

- `url` (string): New URL.
- `event_types` (string[]): Replaces the event list.
- `enabled` (boolean): Turn the webhook on or off.
- `add_inbox_ids` (string[]): Inboxes to add.
- `remove_inbox_ids` (string[]): Inboxes to remove.
- `add_pod_ids` (string[]): Pods to add.
- `remove_pod_ids` (string[]): Pods to remove.

Example request body:

```json
{
  "enabled": false
}
```

### Delete webhook

`DELETE /v0/inboxes/{inbox_id}/webhooks/{webhook_id}` (https://developer.send.io/docs/api#am-delete-inbox-webhook)

Deletes the webhook. No more events are sent to it.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `webhook_id` (string, required): The webhook ID.

### Rotate webhook secret

`POST /v0/inboxes/{inbox_id}/webhooks/{webhook_id}/rotate-secret` (https://developer.send.io/docs/api#am-rotate-inbox-webhook-secret)

Gives the webhook a new signing secret, returned once in `secret`. The previous secret keeps signing for 24 hours, so you can switch your receiver over.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `webhook_id` (string, required): The webhook ID.

- send.io extension. Also at POST /webhooks/{webhook_id}/rotate-secret and POST /pods/{pod_id}/webhooks/{webhook_id}/rotate-secret.
- A second rotation within 24 hours replaces only the current secret; the older secret keeps its original 24 hours. A key with a permission list needs `webhook_update`.

### Get webhook headers

`GET /v0/inboxes/{inbox_id}/webhooks/{webhook_id}/headers` (https://developer.send.io/docs/api#am-get-inbox-webhook-headers)

Gets the custom headers send.io adds to every request to this webhook.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `webhook_id` (string, required): The webhook ID.

- send.io extension.

### Update webhook headers

`PATCH /v0/inboxes/{inbox_id}/webhooks/{webhook_id}/headers` (https://developer.send.io/docs/api#am-update-inbox-webhook-headers)

Sets or removes custom headers. A header with a null value is removed.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `webhook_id` (string, required): The webhook ID.

Body:

- `headers` (object, required): Header names and values. null removes a header.

Example request body:

```json
{
  "headers": {
    "X-Acme-Token": "t0k3n-4821",
    "X-Old-Header": null
  }
}
```

- send.io extension.
- `svix-*`, `Content-Type`, `Content-Length`, `Host` and `User-Agent` cannot be set.

## Inbox API keys (AgentMail-compatible, /v0)

API keys limited to one inbox. Give an agent a key that can only reach its own inbox, optionally with a permission list.

### List API keys

`GET /v0/inboxes/{inbox_id}/api-keys` (https://developer.send.io/docs/api#am-list-inbox-api-keys)

Lists the active API keys scoped to this inbox, newest first.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.

### Create API key

`POST /v0/inboxes/{inbox_id}/api-keys` (https://developer.send.io/docs/api#am-create-inbox-api-key)

Creates a key that only works for this inbox. The full key is in `api_key` and is shown only once.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Body:

- `name` (string): A name for the key, up to 50 characters. Default "agent key".
- `permissions` (object): Permission names set to true, for example `{"message_read": true, "message_reply": true}`. Leave out for every permission on the inbox.

Example request body:

```json
{
  "name": "support agent",
  "permissions": {
    "message_read": true,
    "message_reply": true,
    "draft_create": true
  }
}
```

- Permissions: `inbox_*`, `message_read`, `message_send`, `message_reply`, `message_update`, `message_delete`, `draft_*` (including `draft_send`), `webhook_*`, `list_entry_*`, `metrics_read`, `api_key_*`, `label_spam_read`, `label_trash_read` and more.
- Needs an admin key. A restricted key can only create keys with permissions it holds itself.

### Update API key

`PATCH /v0/inboxes/{inbox_id}/api-keys/{key_id}` (https://developer.send.io/docs/api#am-update-inbox-api-key)

Renames a key or changes its permissions.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `key_id` (string, required): The API key ID (`api_key_id`).

Body:

- `name` (string): New name.
- `permissions` (object | null): Replaces the permission list. null removes the list (every permission on the inbox).

Example request body:

```json
{
  "permissions": {
    "message_read": true,
    "draft_create": true
  }
}
```

- send.io extension.

### Delete API key

`DELETE /v0/inboxes/{inbox_id}/api-keys/{key_id}` (https://developer.send.io/docs/api#am-delete-inbox-api-key)

Revokes the key. Requests with it fail from now on.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.
- `key_id` (string, required): The API key ID (`api_key_id`).

- A key cannot delete itself.

## Inbox metrics (AgentMail-compatible, /v0)

Sending and receiving numbers for one inbox. The window is the last 30 days unless you set `start` and `end`.

### List events

`GET /v0/inboxes/{inbox_id}/metrics/events` (https://developer.send.io/docs/api#am-inbox-metrics-events)

Lists message events for the inbox (received, sent, delivered, bounced, complained, opened, rejected), newest first.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `start` (string): RFC 3339 start time. Default 30 days ago. `start_timestamp` and `after` also work.
- `end` (string): RFC 3339 end time. Default now. `end_timestamp` and `before` also work.
- `event_types` (string[]): Only these event types, for example `message.bounced`.
- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.

- Covers the newest 1,000 events in the window.

### List events (alias)

`GET /v0/inboxes/{inbox_id}/events` (https://developer.send.io/docs/api#am-inbox-events)

Same as List events under /metrics/events.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `start` (string): RFC 3339 start time. Default 30 days ago.
- `end` (string): RFC 3339 end time. Default now.
- `event_types` (string[]): Only these event types.
- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The `next_page_token` from the previous page.

### Get usage

`GET /v0/inboxes/{inbox_id}/metrics/usage` (https://developer.send.io/docs/api#am-inbox-metrics-usage)

Counts of messages received, sent and by delivery outcome in the window.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `start` (string): RFC 3339 start time. Default 30 days ago.
- `end` (string): RFC 3339 end time. Default now.

- send.io extension. Outcomes count each sent message by its latest state.
- Deleting mail does not change past numbers: a deleted sent message still counts for the inbox it was sent from. `received` counts received messages still in the inbox; a permanently deleted or expired message is no longer counted.

### Get rates

`GET /v0/inboxes/{inbox_id}/metrics/rates` (https://developer.send.io/docs/api#am-inbox-metrics-rates)

Delivery, bounce, complaint, rejection and open rates for sent messages in the window, from 0 to 1.

Path parameters:

- `inbox_id` (string, required): The inbox's email address (for example support@acme.com). The inbox's send.io UUID also works.

Query parameters:

- `start` (string): RFC 3339 start time. Default 30 days ago.
- `end` (string): RFC 3339 end time. Default now.

- send.io extension. Rates are 0 when nothing was sent.

## Pods (AgentMail-compatible, /v0)

A pod groups inboxes, so one customer or one project has its own inboxes, lists, webhooks and API keys. Inboxes made outside a pod belong to the default pod.

### List Pods

`GET /v0/pods` (https://developer.send.io/docs/api#am-list-pods)

Lists your pods, newest first. A pod-scoped API key sees only its own pod.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

### Create Pod

`POST /v0/pods` (https://developer.send.io/docs/api#am-create-pod)

Creates a pod. Send a client_id to make the call safe to retry.

Body:

- `name` (string): A name for the pod, at most 100 characters.
- `client_id` (string): Your own ID for idempotency. If a pod with this client_id exists, it is returned instead of a new one.

Example request body:

```json
{
  "name": "Support agents",
  "client_id": "support-pod"
}
```

- Inbox-scoped API keys cannot create pods.
- An agent that signed up by itself must be verified by its human first (see Agent sign-up).

### Get Pod

`GET /v0/pods/{pod_id}` (https://developer.send.io/docs/api#am-get-pod)

Gets one pod.

Path parameters:

- `pod_id` (string, required): The pod's ID.

### Delete Pod

`DELETE /v0/pods/{pod_id}` (https://developer.send.io/docs/api#am-delete-pod)

Deletes a pod. The pod must be empty: delete its inboxes first.

Path parameters:

- `pod_id` (string, required): The pod's ID.

- Returns 409 if the pod still has inboxes.

## Pod Inboxes (AgentMail-compatible, /v0)

Inboxes inside one pod. Each inbox is an email address your agent can send from and receive at.

### List Inboxes

`GET /v0/pods/{pod_id}/inboxes` (https://developer.send.io/docs/api#am-pod-list-inboxes)

Lists the pod's inboxes, newest first.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

### Search Inboxes

`GET /v0/pods/{pod_id}/inboxes/search` (https://developer.send.io/docs/api#am-pod-search-inboxes)

Finds the pod's inboxes whose address, display name or client_id contains the search text.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `q` (string): Text to search for (not case sensitive). query is accepted as an alias.
- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

- send.io extension.

### Create Inbox

`POST /v0/pods/{pod_id}/inboxes` (https://developer.send.io/docs/api#am-pod-create-inbox)

Creates an inbox in the pod. Leave out username for a random name, and domain for a free mailbox on your workspace's sendiomail.com address.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Body:

- `username` (string): On a free mailbox (the default, no `domain` given): a-z, 0-9, dot and dash, 2 to 32 characters, not starting or ending with a dot or dash. On your own domain or the shared agent domain: a-z, 0-9, dot, dash, underscore and plus, 1 to 64 characters. Random when left out.
- `domain` (string): Leave it out for a free mailbox at name@<org>.sendiomail.com (no IMAP or SMTP login). Or give agents.send.io, a company subdomain (acme.agents.send.io), or your own domain once it is verified for sending.
- `display_name` (string): The sender name shown to recipients.
- `client_id` (string): Your own ID for idempotency. If an inbox with this client_id exists, it is returned instead of a new one.

Example request body:

```json
{
  "username": "research-bot",
  "display_name": "Research Bot",
  "client_id": "research-bot-1"
}
```

- Returns 409 if the address is taken, and 403 if your own domain is not verified.
- metadata is not set by this route; set it afterwards with Update Inbox.
- An inbox on your own domain or agents.send.io comes with `credentials`, an IMAP/SMTP login shown only once. A free mailbox has no IMAP or SMTP login.
- Which free domain is which: name@<org>.sendiomail.com is your workspace's free mailbox, made here when you give no domain (GET https://api.send.io/agent-domain returns it as `free_mailbox_domain`). name@org.sendioinbox.com is the no-signup agent mailbox (/docs/agent-mailbox), made with no account and sealed to its key; claimed into a workspace it keeps its sendioinbox.com address and counts as one of the workspace's free mailboxes.

### Get Inbox

`GET /v0/pods/{pod_id}/inboxes/{inbox_id}` (https://developer.send.io/docs/api#am-pod-get-inbox)

Gets one inbox in the pod.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `inbox_id` (string, required): The inbox's email address (the inbox's UUID also works). The inbox must belong to the pod.

### Update Inbox

`PATCH /v0/pods/{pod_id}/inboxes/{inbox_id}` (https://developer.send.io/docs/api#am-pod-update-inbox)

Changes an inbox's display name, metadata or message retention.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `inbox_id` (string, required): The inbox's email address (the inbox's UUID also works). The inbox must belong to the pod.

Body:

- `display_name` (string): A new sender name, at most 100 characters, without quotes, angle brackets or line breaks.
- `metadata` (object): Keys to merge into the inbox's metadata.
- `message_ttl_hours` (number | null): Delete messages after this many hours (1 to 8760). null or 0 keeps them.

Example request body:

```json
{
  "display_name": "Research Assistant",
  "metadata": {
    "tier": "pro"
  }
}
```

- message_ttl_hours is a send.io addition.

### Delete Inbox

`DELETE /v0/pods/{pod_id}/inboxes/{inbox_id}` (https://developer.send.io/docs/api#am-pod-delete-inbox)

Deletes an inbox. The address stops receiving and pending drafts are discarded.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `inbox_id` (string, required): The inbox's email address (the inbox's UUID also works). The inbox must belong to the pod.

Query parameters:

- `keep_mailbox` (boolean): true keeps the address as a plain mailbox on your own domain. Not allowed on the shared agents domain.

- keep_mailbox is a send.io addition.

## Pod Threads (AgentMail-compatible, /v0)

Threads across all inboxes in one pod. Spam and trash are hidden unless you ask for them.

### List Threads

`GET /v0/pods/{pod_id}/threads` (https://developer.send.io/docs/api#am-pod-list-threads)

Lists threads in the pod's inboxes, newest first.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.
- `labels` (string[]): Only threads that have all these labels. Send repeated, comma-separated or as a JSON array (labels=["unread"]).
- `before` (string): Only threads whose last message is before this time (RFC 3339).
- `after` (string): Only threads whose last message is after this time (RFC 3339).
- `ascending` (boolean): Oldest first when true. Default false (newest first).
- `include_spam` (boolean): Include spam threads. Default false.
- `include_trash` (boolean): Include threads in the trash. Default false.

### Search Threads

`GET /v0/pods/{pod_id}/threads/search` (https://developer.send.io/docs/api#am-pod-search-threads)

Finds threads whose subject, preview, senders or recipients contain the search text.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `q` (string): Text to search for (not case sensitive). query is accepted as an alias.
- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.
- `labels` (string[]): Only threads that have all these labels. Send repeated, comma-separated or as a JSON array (labels=["unread"]).
- `before` (string): Only threads whose last message is before this time (RFC 3339).
- `after` (string): Only threads whose last message is after this time (RFC 3339).
- `ascending` (boolean): Oldest first when true. Default false (newest first).
- `include_spam` (boolean): Include spam threads. Default false.
- `include_trash` (boolean): Include threads in the trash. Default false.

### Get Thread

`GET /v0/pods/{pod_id}/threads/{thread_id}` (https://developer.send.io/docs/api#am-pod-get-thread)

Gets a thread with all its messages, oldest first.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `thread_id` (string, required): The thread's ID.

Query parameters:

- `include_trash` (boolean): Include messages in the trash. Default false.

### Update Thread

`PATCH /v0/pods/{pod_id}/threads/{thread_id}` (https://developer.send.io/docs/api#am-pod-update-thread)

Adds or removes labels on a thread. The labels read, unread and trash change the thread's state; other labels are your own.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `thread_id` (string, required): The thread's ID.

Body:

- `add_labels` (string[]): Labels to add. read marks it read, trash moves it to the trash.
- `remove_labels` (string[]): Labels to remove. unread marks it read, trash restores it.

Example request body:

```json
{
  "add_labels": [
    "read",
    "follow-up"
  ]
}
```

- The system labels spam, received and sent cannot be changed and are ignored.

### Delete Thread

`DELETE /v0/pods/{pod_id}/threads/{thread_id}` (https://developer.send.io/docs/api#am-pod-delete-thread)

Moves a thread to the trash. Deleting a thread that is already in the trash removes it for good.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `thread_id` (string, required): The thread's ID.

### Get Attachment

`GET /v0/pods/{pod_id}/threads/{thread_id}/attachments/{attachment_id}` (https://developer.send.io/docs/api#am-pod-get-thread-attachment)

Gets an attachment's details and a signed download link that works for one hour.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `thread_id` (string, required): The thread's ID.
- `attachment_id` (string, required): The attachment's ID.

- text_url (the attachment's extracted text) is a send.io addition, present when text could be extracted.

## Pod Drafts (AgentMail-compatible, /v0)

Unsent drafts across all inboxes in one pod. Create, edit and send drafts through the inbox routes.

### List Drafts

`GET /v0/pods/{pod_id}/drafts` (https://developer.send.io/docs/api#am-pod-list-drafts)

Lists the pod's pending, sending and failed drafts, newest first.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.
- `labels` (string[]): Only drafts that have all these labels.

Response fields:

- `drafts[].send_status` (string | null): `scheduled`: pending, with a `send_at` time. `sending`: a scheduled send is going out. `failed`: a scheduled send failed; change the draft or send it again. `null`: pending with no `send_at`, and also once the draft was sent (Get draft still returns a sent draft, the lists do not). A deleted draft is never returned: 404.

### Get Draft

`GET /v0/pods/{pod_id}/drafts/{draft_id}` (https://developer.send.io/docs/api#am-pod-get-draft)

Gets one draft in the pod.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `draft_id` (string, required): The draft's ID.

Response fields:

- `send_status` (string | null): `scheduled`: pending, with a `send_at` time. `sending`: a scheduled send is going out. `failed`: a scheduled send failed; change the draft or send it again. `null`: pending with no `send_at`, and also once the draft was sent (Get draft still returns a sent draft, the lists do not). A deleted draft is never returned: 404.

- A sent draft is still returned, with `send_status` null. A deleted draft answers 404.

## Pod Lists (AgentMail-compatible, /v0)

Allow and block lists that apply to every inbox in the pod. A list is chosen by direction (send, receive, reply) and type (allow, block).

### List Entries

`GET /v0/pods/{pod_id}/lists/{direction}/{type}` (https://developer.send.io/docs/api#am-pod-list-entries)

Lists the entries on one of the pod's lists, sorted by entry.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `direction` (string, required): Which mail the list applies to: send, receive or reply.
- `type` (string, required): The list type: allow or block.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

### Create List Entry

`POST /v0/pods/{pod_id}/lists/{direction}/{type}` (https://developer.send.io/docs/api#am-pod-create-list-entry)

Adds an email address or domain to one of the pod's lists.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `direction` (string, required): Which mail the list applies to: send, receive or reply.
- `type` (string, required): The list type: allow or block.

Body:

- `entry` (string, required): An email address (dana@acme.com) or a domain (acme.com).
- `reason` (string): Why the entry was added. Adding an existing entry updates its reason.

Example request body:

```json
{
  "entry": "spammy.example",
  "reason": "Unwanted cold outreach"
}
```

### Get List Entry

`GET /v0/pods/{pod_id}/lists/{direction}/{type}/{entry}` (https://developer.send.io/docs/api#am-pod-get-list-entry)

Gets one entry on one of the pod's lists.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `direction` (string, required): Which mail the list applies to: send, receive or reply.
- `type` (string, required): The list type: allow or block.
- `entry` (string, required): The email address or domain on the list (case does not matter).

### Delete List Entry

`DELETE /v0/pods/{pod_id}/lists/{direction}/{type}/{entry}` (https://developer.send.io/docs/api#am-pod-delete-list-entry)

Removes an entry from one of the pod's lists.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `direction` (string, required): Which mail the list applies to: send, receive or reply.
- `type` (string, required): The list type: allow or block.
- `entry` (string, required): The email address or domain on the list (case does not matter).

## Pod Webhooks (AgentMail-compatible, /v0)

Webhooks limited to one pod: they get events only for that pod's inboxes.

### List Webhooks

`GET /v0/pods/{pod_id}/webhooks` (https://developer.send.io/docs/api#am-pod-list-webhooks)

Lists the webhooks scoped to this pod, newest first.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

### Create Webhook

`POST /v0/pods/{pod_id}/webhooks` (https://developer.send.io/docs/api#am-pod-create-webhook)

Creates a webhook scoped to this pod. The signing secret is returned only once.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Body:

- `url` (string, required): The HTTPS URL that receives the events. endpoint is accepted as an alias.
- `event_types` (string[]): Events to send: message.received, message.received.spam, message.sent, message.delivered, message.bounced, message.complained, message.rejected, message.opened, domain.verified. Default ["message.received"]. A webhook limited to inboxes or pods only receives the message events: any other type answers 422.
- `inbox_ids` (string[]): Limit the webhook to these inboxes (addresses or IDs).
- `pod_ids` (string[]): Limit the webhook to these pods.
- `client_id` (string): Your own ID for idempotency. If a webhook with this client_id exists with the same settings, it is returned instead of a new one; different settings answer 409.

Example request body:

```json
{
  "url": "https://example.com/hooks/sendio",
  "event_types": [
    "message.received",
    "message.bounced"
  ],
  "client_id": "main-hook"
}
```

- The number of webhooks depends on your plan.

### Get Webhook

`GET /v0/pods/{pod_id}/webhooks/{webhook_id}` (https://developer.send.io/docs/api#am-pod-get-webhook)

Gets one webhook scoped to this pod.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `webhook_id` (string, required): The webhook's ID.

### Update Webhook

`PATCH /v0/pods/{pod_id}/webhooks/{webhook_id}` (https://developer.send.io/docs/api#am-pod-update-webhook)

Changes a webhook's URL, events, scope or whether it is enabled.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `webhook_id` (string, required): The webhook's ID.

Body:

- `url` (string): A new HTTPS URL.
- `event_types` (string[]): Replaces the list of events.
- `enabled` (boolean): false pauses delivery; true resumes it.
- `add_inbox_ids` (string[]): Inboxes to add to the webhook's scope.
- `remove_inbox_ids` (string[]): Inboxes to remove from the webhook's scope.
- `add_pod_ids` (string[]): Pods to add to the webhook's scope.
- `remove_pod_ids` (string[]): Pods to remove from the webhook's scope.

Example request body:

```json
{
  "enabled": false
}
```

### Delete Webhook

`DELETE /v0/pods/{pod_id}/webhooks/{webhook_id}` (https://developer.send.io/docs/api#am-pod-delete-webhook)

Deletes a webhook scoped to this pod.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `webhook_id` (string, required): The webhook's ID.

### Get Webhook Headers

`GET /v0/pods/{pod_id}/webhooks/{webhook_id}/headers` (https://developer.send.io/docs/api#am-pod-get-webhook-headers)

Gets the custom headers sent with every delivery of this webhook.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `webhook_id` (string, required): The webhook's ID.

- send.io addition.

### Update Webhook Headers

`PATCH /v0/pods/{pod_id}/webhooks/{webhook_id}/headers` (https://developer.send.io/docs/api#am-pod-update-webhook-headers)

Sets or removes custom headers on this webhook's deliveries.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `webhook_id` (string, required): The webhook's ID.

Body:

- `headers` (object, required): Header names mapped to values. A null value removes that header. Content-Type, Content-Length, Host, User-Agent and svix-* headers cannot be set.

Example request body:

```json
{
  "headers": {
    "X-Auth-Token": "s3cr3t",
    "X-Old": null
  }
}
```

- send.io addition.

## Pod Domains (AgentMail-compatible, /v0)

The domain routes under a pod. They work the same as the top-level Domains routes.

### List Domains

`GET /v0/pods/{pod_id}/domains` (https://developer.send.io/docs/api#am-pod-list-domains)

Lists your domains, newest first.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

- Domains belong to your organization, not to a pod, so this lists all of them.

### Create Domain

`POST /v0/pods/{pod_id}/domains` (https://developer.send.io/docs/api#am-pod-create-domain)

Adds a domain and returns the DNS records to set up.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Body:

- `domain` (string, required): The domain name, for example acme.com. name is accepted as an alias.
- `feedback_enabled` (boolean): Accepted for compatibility. Bounce and complaint feedback is always on.

Example request body:

```json
{
  "domain": "acme.com"
}
```

- The domain is added to your organization, not only to this pod.

### Get Domain

`GET /v0/pods/{pod_id}/domains/{domain_id}` (https://developer.send.io/docs/api#am-pod-get-domain)

Gets a domain with its DNS records and their status.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

### Update Domain

`PATCH /v0/pods/{pod_id}/domains/{domain_id}` (https://developer.send.io/docs/api#am-pod-update-domain)

Accepted for compatibility. Returns the domain unchanged.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

Body:

- `feedback_enabled` (boolean): Ignored: feedback is always on.

Example request body:

```json
{
  "feedback_enabled": true
}
```

### Delete Domain

`DELETE /v0/pods/{pod_id}/domains/{domain_id}` (https://developer.send.io/docs/api#am-pod-delete-domain)

Deletes a domain.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

### Verify Domain

`POST /v0/pods/{pod_id}/domains/{domain_id}/verify` (https://developer.send.io/docs/api#am-pod-verify-domain)

Checks the domain's DNS records now and returns the updated status.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

### Get Zone File

`GET /v0/pods/{pod_id}/domains/{domain_id}/zone-file` (https://developer.send.io/docs/api#am-pod-get-zone-file)

Gets the domain's DNS records as a BIND zone file you can import at your DNS provider.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

- Returned as JSON with a zone_file string.

## Pod Metrics (AgentMail-compatible, /v0)

Events and counts for the inboxes in one pod.

### List Events

`GET /v0/pods/{pod_id}/metrics/events` (https://developer.send.io/docs/api#am-pod-metrics-events)

Lists message events (received, sent, delivered, bounced and more) for the pod's inboxes, newest first.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.
- `start` (string): Start of the window (RFC 3339). Also accepted as start_timestamp or after. Default 30 days ago.
- `end` (string): End of the window (RFC 3339). Also accepted as end_timestamp or before. Default now.
- `event_types` (string[]): Only these events: message.received, message.sent, message.delivered, message.bounced, message.complained, message.opened, message.rejected.

- Metrics are split into /metrics/events, /metrics/usage and /metrics/rates.
- At most the 1,000 most recent events in the window are returned.

### Get Usage

`GET /v0/pods/{pod_id}/metrics/usage` (https://developer.send.io/docs/api#am-pod-metrics-usage)

Counts messages by outcome for the pod's inboxes in a time window.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `start` (string): Start of the window (RFC 3339). Also accepted as start_timestamp or after. Default 30 days ago.
- `end` (string): End of the window (RFC 3339). Also accepted as end_timestamp or before. Default now.

- send.io addition.
- Deleting mail does not change past numbers: a deleted sent message still counts for the inbox it was sent from. `received` counts received messages still in the inbox; a permanently deleted or expired message is no longer counted.

### Get Rates

`GET /v0/pods/{pod_id}/metrics/rates` (https://developer.send.io/docs/api#am-pod-metrics-rates)

Delivery, bounce, complaint, rejection and open rates for the pod's inboxes, as fractions of sent messages.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `start` (string): Start of the window (RFC 3339). Also accepted as start_timestamp or after. Default 30 days ago.
- `end` (string): End of the window (RFC 3339). Also accepted as end_timestamp or before. Default now.

- send.io addition.

## Pod API Keys (AgentMail-compatible, /v0)

API keys limited to one pod. A pod key can only reach that pod's inboxes and resources.

### List API Keys

`GET /v0/pods/{pod_id}/api-keys` (https://developer.send.io/docs/api#am-pod-list-api-keys)

Lists the pod's active keys, newest first. The full key is never shown again.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

### Create API Key

`POST /v0/pods/{pod_id}/api-keys` (https://developer.send.io/docs/api#am-pod-create-api-key)

Creates a key scoped to the pod. The full key is in api_key and is shown only once.

Path parameters:

- `pod_id` (string, required): The pod's ID.

Body:

- `name` (string): A label for the key, at most 50 characters. Default "agent key".
- `permissions` (object): Permission names mapped to true, for example {"message_read": true}. Leave it out for all permissions in the key's scope. Names: inbox_*, message_*, label_*_read, draft_*, webhook_*, domain_*, list_entry_*, metrics_read, api_key_*, pod_*.

Example request body:

```json
{
  "name": "support pod key",
  "permissions": {
    "message_read": true,
    "message_send": true,
    "message_reply": true
  }
}
```

- Only admins can create, change or delete keys. A restricted key can only manage keys inside its own scope and cannot grant permissions it does not hold.
- A key cannot delete itself.

### Update API Key

`PATCH /v0/pods/{pod_id}/api-keys/{key_id}` (https://developer.send.io/docs/api#am-pod-update-api-key)

Renames a key or changes its permissions.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `key_id` (string, required): The API key's ID (api_key_id).

Body:

- `name` (string): A new label.
- `permissions` (object | null): Replaces the permission list. null removes the list (only for inbox or pod keys).

Example request body:

```json
{
  "name": "support pod key (read only)",
  "permissions": {
    "message_read": true
  }
}
```

- send.io extension.

### Delete API Key

`DELETE /v0/pods/{pod_id}/api-keys/{key_id}` (https://developer.send.io/docs/api#am-pod-delete-api-key)

Revokes a key. Requests with it fail right away.

Path parameters:

- `pod_id` (string, required): The pod's ID.
- `key_id` (string, required): The API key's ID (api_key_id).

- Only admins can create, change or delete keys. A restricted key can only manage keys inside its own scope and cannot grant permissions it does not hold.
- A key cannot delete itself.

## Domains (AgentMail-compatible, /v0)

Send and receive from your own domain. Add it, set the DNS records it returns, then verify. Inboxes on the shared agents.send.io domain need no setup.

### List Domains

`GET /v0/domains` (https://developer.send.io/docs/api#am-list-domains)

Lists your domains, newest first.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

- Inbox-scoped API keys cannot use the domain routes.

### Create Domain

`POST /v0/domains` (https://developer.send.io/docs/api#am-create-domain)

Adds a domain and returns the DNS records to set up, such as DKIM, the return path and DMARC. Copy them from the response: they depend on the domain's setup.

Body:

- `domain` (string, required): The domain name, for example acme.com. name is accepted as an alias.
- `feedback_enabled` (boolean): Accepted for compatibility. Bounce and complaint feedback is always on.

Example request body:

```json
{
  "domain": "acme.com"
}
```

- The number of domains depends on your plan.
- Status values: NOT_STARTED, PENDING, VERIFYING, VERIFIED, INVALID, FAILED. Record status: PENDING, VERIFIED, FAILED or MISSING.
- Record names are relative to the domain: `send` means `send.acme.com`. For a subdomain inside a parent zone, the main API's `GET /domains/{domain_id}` also gives each record's `host` relative to the zone.

### Get Domain

`GET /v0/domains/{domain_id}` (https://developer.send.io/docs/api#am-get-domain)

Gets a domain with its DNS records and their status.

Path parameters:

- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

### Update Domain

`PATCH /v0/domains/{domain_id}` (https://developer.send.io/docs/api#am-update-domain)

Accepted for compatibility. Bounce and complaint feedback is always on, so this returns the domain unchanged.

Path parameters:

- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

Body:

- `feedback_enabled` (boolean): Ignored: feedback is always on.

Example request body:

```json
{
  "feedback_enabled": true
}
```

### Delete Domain

`DELETE /v0/domains/{domain_id}` (https://developer.send.io/docs/api#am-delete-domain)

Deletes a domain. Mail from it stops.

Path parameters:

- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

### Verify Domain

`POST /v0/domains/{domain_id}/verify` (https://developer.send.io/docs/api#am-verify-domain)

Checks the domain's DNS records now and returns the updated status. A domain.verified event is sent when it becomes verified.

Path parameters:

- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

### Get Zone File

`GET /v0/domains/{domain_id}/zone-file` (https://developer.send.io/docs/api#am-get-zone-file)

Gets the domain's DNS records as a BIND zone file you can import at your DNS provider.

Path parameters:

- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

- Returned as JSON with a zone_file string.

### Get Setup Link

`GET /v0/domains/{domain_id}/setup-link` (https://developer.send.io/docs/api#am-get-domain-setup-link)

Gets a one-click DNS setup link (Domain Connect) when the domain's DNS provider supports it. Open the url to add all records at once.

Path parameters:

- `domain_id` (string, required): The domain's ID, or the domain name itself (for example acme.com).

- send.io addition. When the provider is not supported, supported is false and url is null.

## Webhooks (AgentMail-compatible, /v0)

Get events like message.received pushed to your URL. A webhook is team-wide unless you limit it to inboxes or pods. Payloads look like {type: "event", event_type, event_id, ...}.

### List Webhooks

`GET /v0/webhooks` (https://developer.send.io/docs/api#am-list-webhooks)

Lists your webhooks, newest first. A scoped API key sees only webhooks for its inbox or pod.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

### Create Webhook

`POST /v0/webhooks` (https://developer.send.io/docs/api#am-create-webhook)

Creates a webhook. The signing secret is returned only once: use it to check each delivery's signature.

Body:

- `url` (string, required): The HTTPS URL that receives the events. endpoint is accepted as an alias.
- `event_types` (string[]): Events to send: message.received, message.received.spam, message.sent, message.delivered, message.bounced, message.complained, message.rejected, message.opened, domain.verified. Default ["message.received"]. A webhook limited to inboxes or pods only receives the message events: any other type answers 422.
- `inbox_ids` (string[]): Limit the webhook to these inboxes (addresses or IDs).
- `pod_ids` (string[]): Limit the webhook to these pods.
- `client_id` (string): Your own ID for idempotency. If a webhook with this client_id exists with the same settings, it is returned instead of a new one; different settings answer 409.

Example request body:

```json
{
  "url": "https://example.com/hooks/sendio",
  "event_types": [
    "message.received",
    "message.bounced"
  ],
  "client_id": "main-hook"
}
```

- The number of webhooks depends on your plan.
- A scoped API key that names no inboxes or pods gets a webhook limited to its own inbox or pod.

### Get Webhook

`GET /v0/webhooks/{webhook_id}` (https://developer.send.io/docs/api#am-get-webhook)

Gets one webhook.

Path parameters:

- `webhook_id` (string, required): The webhook's ID.

### Update Webhook

`PATCH /v0/webhooks/{webhook_id}` (https://developer.send.io/docs/api#am-update-webhook)

Changes a webhook's URL, events, scope or whether it is enabled. Only the fields you send change.

Path parameters:

- `webhook_id` (string, required): The webhook's ID.

Body:

- `url` (string): A new HTTPS URL.
- `event_types` (string[]): Replaces the list of events.
- `enabled` (boolean): false pauses delivery; true resumes it.
- `add_inbox_ids` (string[]): Inboxes to add to the webhook's scope.
- `remove_inbox_ids` (string[]): Inboxes to remove from the webhook's scope.
- `add_pod_ids` (string[]): Pods to add to the webhook's scope.
- `remove_pod_ids` (string[]): Pods to remove from the webhook's scope.

Example request body:

```json
{
  "event_types": [
    "message.received"
  ],
  "add_pod_ids": [
    "3f6c1e0a-8b2d-4c55-9a1e-6d7f2b9c0e41"
  ]
}
```

### Delete Webhook

`DELETE /v0/webhooks/{webhook_id}` (https://developer.send.io/docs/api#am-delete-webhook)

Deletes a webhook. No more events are sent to it.

Path parameters:

- `webhook_id` (string, required): The webhook's ID.

### Get Webhook Headers

`GET /v0/webhooks/{webhook_id}/headers` (https://developer.send.io/docs/api#am-get-webhook-headers)

Gets the custom headers sent with every delivery of this webhook.

Path parameters:

- `webhook_id` (string, required): The webhook's ID.

- send.io addition.

### Update Webhook Headers

`PATCH /v0/webhooks/{webhook_id}/headers` (https://developer.send.io/docs/api#am-update-webhook-headers)

Sets or removes custom headers on this webhook's deliveries, for example a token your endpoint checks.

Path parameters:

- `webhook_id` (string, required): The webhook's ID.

Body:

- `headers` (object, required): Header names mapped to values. A null value removes that header. Content-Type, Content-Length, Host, User-Agent and svix-* headers cannot be set.

Example request body:

```json
{
  "headers": {
    "X-Auth-Token": "s3cr3t",
    "X-Old": null
  }
}
```

- send.io addition.

## Lists (AgentMail-compatible, /v0)

Team-wide allow and block lists that apply to every inbox. Pick a list by direction (send, receive or reply) and type (allow or block). Entries are email addresses or whole domains.

### List Entries

`GET /v0/lists/{direction}/{type}` (https://developer.send.io/docs/api#am-list-entries)

Lists the entries on one team-wide list, sorted by entry.

Path parameters:

- `direction` (string, required): Which mail the list applies to: send, receive or reply.
- `type` (string, required): The list type: allow or block.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

- Inbox- and pod-scoped API keys cannot use the team-wide lists; use the inbox or pod lists instead.

### Create List Entry

`POST /v0/lists/{direction}/{type}` (https://developer.send.io/docs/api#am-create-list-entry)

Adds an email address or domain to a team-wide list. For example, block a domain on the receive list.

Path parameters:

- `direction` (string, required): Which mail the list applies to: send, receive or reply.
- `type` (string, required): The list type: allow or block.

Body:

- `entry` (string, required): An email address (dana@acme.com) or a domain (acme.com).
- `reason` (string): Why the entry was added. Adding an existing entry updates its reason.

Example request body:

```json
{
  "entry": "spammy.example",
  "reason": "Unwanted cold outreach"
}
```

- An agent that signed up by itself must be verified by its human first.

### Get List Entry

`GET /v0/lists/{direction}/{type}/{entry}` (https://developer.send.io/docs/api#am-get-list-entry)

Gets one entry on a team-wide list.

Path parameters:

- `direction` (string, required): Which mail the list applies to: send, receive or reply.
- `type` (string, required): The list type: allow or block.
- `entry` (string, required): The email address or domain on the list (case does not matter).

### Delete List Entry

`DELETE /v0/lists/{direction}/{type}/{entry}` (https://developer.send.io/docs/api#am-delete-list-entry)

Removes an entry from a team-wide list.

Path parameters:

- `direction` (string, required): Which mail the list applies to: send, receive or reply.
- `type` (string, required): The list type: allow or block.
- `entry` (string, required): The email address or domain on the list (case does not matter).

## Metrics (AgentMail-compatible, /v0)

Events and counts for all your agent inboxes. A scoped API key sees only its own inbox or pod. The default window is the last 30 days.

### List Events

`GET /v0/metrics/events` (https://developer.send.io/docs/api#am-metrics-events)

Lists message events (received, sent, delivered, bounced, complained, opened, rejected), newest first.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.
- `start` (string): Start of the window (RFC 3339). Also accepted as start_timestamp or after. Default 30 days ago.
- `end` (string): End of the window (RFC 3339). Also accepted as end_timestamp or before. Default now.
- `event_types` (string[]): Only these events: message.received, message.sent, message.delivered, message.bounced, message.complained, message.opened, message.rejected.

- Metrics are split into /metrics/events, /metrics/usage and /metrics/rates.
- At most the 1,000 most recent events in the window are returned.

### Get Usage

`GET /v0/metrics/usage` (https://developer.send.io/docs/api#am-metrics-usage)

Counts messages by outcome in a time window, plus the number of active inboxes.

Query parameters:

- `start` (string): Start of the window (RFC 3339). Also accepted as start_timestamp or after. Default 30 days ago.
- `end` (string): End of the window (RFC 3339). Also accepted as end_timestamp or before. Default now.

- send.io addition.
- Deleting mail does not change past numbers: a deleted sent message still counts for the inbox it was sent from. `received` counts received messages still in the inbox; a permanently deleted or expired message is no longer counted.

### Get Rates

`GET /v0/metrics/rates` (https://developer.send.io/docs/api#am-metrics-rates)

Delivery, bounce, complaint, rejection and open rates in a time window, as fractions of sent messages (0 to 1).

Query parameters:

- `start` (string): Start of the window (RFC 3339). Also accepted as start_timestamp or after. Default 30 days ago.
- `end` (string): End of the window (RFC 3339). Also accepted as end_timestamp or before. Default now.

- send.io addition.

## API Keys (AgentMail-compatible, /v0)

Create keys for your agents. A key can be full access, limited to an inbox or pod, or limited to a list of permissions.

### List API Keys

`GET /v0/api-keys` (https://developer.send.io/docs/api#am-list-api-keys)

Lists your active keys, newest first. A scoped key sees only keys in its own scope.

Query parameters:

- `limit` (number): Items per page, 1 to 100. Default 50. Other values answer 422.
- `page_token` (string): The next_page_token from the previous page.

### Create API Key

`POST /v0/api-keys` (https://developer.send.io/docs/api#am-create-api-key)

Creates a team-wide key. Without permissions it has full access; with permissions it can do only those things. The full key is in api_key and is shown only once.

Body:

- `name` (string): A label for the key, at most 50 characters. Default "agent key".
- `permissions` (object): Permission names mapped to true, for example {"message_read": true}. Leave it out for all permissions in the key's scope. Names: inbox_*, message_*, label_*_read, draft_*, webhook_*, domain_*, list_entry_*, metrics_read, api_key_*, pod_*.

Example request body:

```json
{
  "name": "reporting",
  "permissions": {
    "metrics_read": true,
    "message_read": true
  }
}
```

- Only admins can create, change or delete keys. A restricted key can only manage keys inside its own scope and cannot grant permissions it does not hold.
- A key cannot delete itself.
- A scoped key that calls this route creates a key in its own inbox or pod.
- An agent that signed up by itself must be verified by its human first.

### Get API Key

`GET /v0/api-keys/{key_id}` (https://developer.send.io/docs/api#am-get-api-key)

Gets one key. The full key is never shown again.

Path parameters:

- `key_id` (string, required): The API key's ID (api_key_id).

### Update API Key

`PATCH /v0/api-keys/{key_id}` (https://developer.send.io/docs/api#am-update-api-key)

Renames a key or changes its permissions.

Path parameters:

- `key_id` (string, required): The API key's ID (api_key_id).

Body:

- `name` (string): A new label.
- `permissions` (object | null): Replaces the permission list. null removes the list (only for inbox or pod keys).

Example request body:

```json
{
  "permissions": {
    "message_read": true
  }
}
```

- send.io extension.
- A team-wide restricted key always needs a permission list; it is never turned into a full-access key.

### Delete API Key

`DELETE /v0/api-keys/{key_id}` (https://developer.send.io/docs/api#am-delete-api-key)

Revokes a key. Requests with it fail right away.

Path parameters:

- `key_id` (string, required): The API key's ID (api_key_id).

- Only admins can create, change or delete keys. A restricted key can only manage keys inside its own scope and cannot grant permissions it does not hold.
- A key cannot delete itself.

## Organization (AgentMail-compatible, /v0)

Your organization (team) and the key you are calling with.

### Get Organization

`GET /v0/organizations/{org_id}` (https://developer.send.io/docs/api#am-get-organization)

Gets your organization. Use the organization_id from Get Current Key.

Path parameters:

- `org_id` (string, required): Your organization's ID.

- Any other organization's ID returns 404.

### Get Current Key

`GET /v0/auth/me` (https://developer.send.io/docs/api#am-auth-me)

Tells you who you are: your organization, the key in use, its scope and permissions, and for a self-signed-up agent whether it is verified.

- send.io addition.
- permission is full_access or inbox_access (a scoped or restricted key). inbox_id or pod_id appear for scoped keys; agent appears only for agent sign-ups. permissions is null when there is no permission list.

## Agent Sign-up (AgentMail-compatible, /v0)

An agent can create its own send.io account, inbox and API key with one call, no human sign-up needed. A 6-digit code emailed to the agent's human unlocks it. This is a send.io addition.

### Sign Up an Agent

`POST /v0/agents/sign-up` (https://developer.send.io/docs/api#am-agent-signup)

Creates an account, an inbox on agents.send.io and an API key. If you give human_email, a verification code is emailed to that person.

Body:

- `username` (string): The inbox's name before @agents.send.io. a-z, 0-9, dot, dash, underscore and plus, 1 to 64 characters. Leave it out for a random agent-xxxxxxxxxx; an empty string or a value that is not a string is refused with 422.
- `human_email` (string): The email address of the human responsible for this agent. They get the verification code.

Example request body:

```json
{
  "username": "research-bot",
  "human_email": "praveen@acme.com"
}
```

- No API key needed. Limited to 20 sign-ups per hour per network.
- Until verified, the agent can only email its human and cannot create pods, API keys or list entries.
- Signing up again with an existing username and the same human_email returns a new key that only works for verify, plus a message field, and emails the human a recovery code. The old key keeps working unless that recovery code is entered.
- While the agent's recovery is locked (too many wrong recovery codes), signing up again returns 429 with Retry-After.
- Returns 409 if the address is taken by someone else.

### Verify an Agent

`POST /v0/agents/{agent_id}/verify` (https://developer.send.io/docs/api#am-agent-verify)

Unlocks the agent with the 6-digit code its human received. Call it with the API key from sign-up.

Path parameters:

- `agent_id` (string, required): The agent_id from sign-up.

Body:

- `otp_code` (string, required): The 6-digit code from the email. code is accepted as an alias.

Example request body:

```json
{
  "otp_code": "482913"
}
```

- Auth: Authorization: Bearer <api_key from sign-up>.
- There are two codes: the verification code for the key from the first sign-up, and a recovery code for the key from a repeat sign-up. Each has its own limits, so wrong recovery codes never affect the agent's own code or key.
- Codes expire after 15 minutes. A wrong or expired code returns 400 invalid_otp. A code allows 5 checks; the 5th wrong one ends it (for a recovery code, the repeat sign-up's key is revoked too, so later calls with it get 401).
- Each kind of code allows 10 checks in total, across new codes, until one is right. The 10th wrong check locks it for 24 hours: verify returns 429 with Retry-After, and no new code of that kind is sent. Asking for a new code does not reset the 10.
- When called with the new key from a repeat sign-up and the recovery code, that key becomes the account's key, the old one is revoked, and the human is emailed that the key was replaced.
- When a verified agent calls verify with its own key, any pending recovery is cancelled.

### Attach a Human

`POST /v0/agents/{agent_id}/attach-human` (https://developer.send.io/docs/api#am-agent-attach-human)

Sets the agent's human, if sign-up had none, or re-sends the verification code to the same human. Only for agents that are not verified yet. The human cannot be changed afterwards (409): sign up a new agent instead.

Path parameters:

- `agent_id` (string, required): The agent_id from sign-up.

Body:

- `human_email` (string, required): The human's email address.

Example request body:

```json
{
  "human_email": "praveen@acme.com"
}
```

- Auth: Authorization: Bearer <api_key from the first sign-up>. A key from a repeat sign-up cannot call it (403).
- At most 3 codes an hour and 5 a day; beyond that, or while verification is locked, it returns 429 with Retry-After and sends nothing.

## Agent Registration (auth.md) (AgentMail-compatible, /v0)

The auth.md protocol: an agent opens a send.io account for its human without the sign-up form, and the human approves it with a code, or a trusted agent provider vouches for the human. Discovery is at /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server on the API host; the full recipe agents read is https://app.send.io/auth.md. Trusted providers push revocations (RFC 8935 Security Event Tokens) to /v0/agents/identity/events. This is a send.io addition. No API key is needed for these calls.

### Register an Agent

`POST /v0/agents/identity` (https://developer.send.io/docs/api#am-authmd-identity)

Creates the account and inbox. anonymous returns an identity assertion (exchange it for a restricted key) and a claim token for later; service_auth names the human up front and starts the approval at once; identity_assertion presents an ID-JAG from a trusted agent provider and returns a full-access assertion in one step.

Body:

- `type` (string, required): anonymous, service_auth or identity_assertion.
- `assertion` (string): The ID-JAG from your agent provider, with audience https://api.send.io. Required for identity_assertion.
- `assertion_type` (string): urn:ietf:params:oauth:token-type:id-jag (optional).
- `login_hint` (string): The human's email address. Required for service_auth.
- `username` (string): The inbox's name before @agents.send.io. a-z, 0-9, dot, dash, underscore and plus. Default: a random agent-xxxxxxxxxx.

Example request body:

```json
{
  "type": "anonymous",
  "username": "research-bot"
}
```

- Limited to 5 registrations per hour per network. A User-Agent header is required. Registering a username again (even your own, with the same human) returns 409 address_taken and never replaces a pending approval.
- service_auth answers without identity_assertion and with a claim object instead (user_code, verification_uri, expires_in, interval): the approval has already started and the human has been emailed.
- Scopes: agent_unverified means the inbox works but outgoing email reaches only the human, and the agent cannot create keys, lists or pods. full_access is a normal key, granted after the approval.
- identity_assertion: send.io checks the provider is trusted, the signature, audience, expiry, a one-time jti, the allowed client_id, a verified email and a sign-in within the last hour; the human gets an account and becomes admin, and the same human and username sign back in. 60 per hour per network.
- Errors are OAuth style, {error, error_description}: address_taken (409), rate_limit_exceeded (429), and for identity_assertion invalid_issuer, invalid_signature, invalid_audience, invalid_client_id, expired, replay_detected, missing_verified_email, login_required (401 with max_age) and interaction_required (401: the email already has an account never linked to this provider; the answer carries claim_token and a claim block, and once the human approves, later assertions go straight through).

### Start the Approval

`POST /v0/agents/identity/claim` (https://developer.send.io/docs/api#am-authmd-claim)

Names the human for an anonymous registration and starts the approval: a 6-digit code the agent shows, and a link. send.io emails the human the same link.

Body:

- `claim_token` (string, required): The claim_token from the registration.
- `email` (string, required): The human's email address.

Example request body:

```json
{
  "claim_token": "3mK9tW4cY6hJ1dF5gS2Q7kR2pLz_x8VbN3mK9tW4cY6",
  "email": "praveen@acme.com"
}
```

- The human opens the link from the email (or signs in with that address), sees the agent's inbox address and types the code. Five wrong codes end the attempt; the code and link expire after 10 minutes.
- One attempt at a time per registration (409 claimed_or_in_flight). Limited to 10 per hour per network. claim_expired once the claim token is older than 7 days.

### Get the API Key

`POST /v0/token` (https://developer.send.io/docs/api#am-authmd-token)

The OAuth token endpoint (form-encoded or JSON). The jwt-bearer grant turns an identity assertion into an API key with the registration's current scope. The claim grant polls for the human's approval and then returns the full-access key plus a fresh assertion, once.

Body:

- `grant_type` (string, required): urn:ietf:params:oauth:grant-type:jwt-bearer or urn:workos:agent-auth:grant-type:claim.
- `assertion` (string): The identity_assertion (jwt-bearer grant).
- `claim_token` (string): The claim token (claim grant).

Example request body:

```json
{
  "grant_type": "urn:workos:agent-auth:grant-type:claim",
  "claim_token": "3mK9tW4cY6hJ1dF5gS2Q7kR2pLz_x8VbN3mK9tW4cY6"
}
```

- The access_token is a send.io API key: it does not expire and works for every API, the MCP server and IMAP/SMTP. Each exchange issues a new key and retires the registration's previous one.
- Assertions are single use: the jwt-bearer grant consumes the assertion and its answer carries the next identity_assertion. Limited to 30 exchanges per hour per registration and 120 per hour per network.
- Claim grant errors: authorization_pending (poll again after interval seconds), slow_down (polled within 5 seconds), expired_token (the attempt or the claim token expired, or the key was already handed over). invalid_grant for an unknown claim token or a bad assertion.
- POST /revoke with token=<api key or identity_assertion> revokes it (RFC 7009) and always answers 200.

## AgentID (OpenID Connect) (AgentMail-compatible, /v0)

Let agents sign in to your app with their send.io inbox, like "Sign in with Google" for agents. send.io is a standard OpenID Connect provider (authorization code flow, RS256 tokens). This is a send.io addition.

### Get OpenID Configuration

`GET /.well-known/openid-configuration` (https://developer.send.io/docs/api#am-oidc-discovery)

The OpenID Connect discovery document. Point your OIDC library at the issuer https://api.send.io and it finds everything else.

- Served at the site root (https://api.send.io/.well-known/openid-configuration), not under /v0. No auth.

### Get Signing Keys

`GET /v0/jwks.json` (https://developer.send.io/docs/api#am-oidc-jwks)

The public keys (JWKS) that sign ID tokens and access tokens. Keys rotate every 30 days.

- No auth. Cached for 5 minutes.

### Register a Client

`POST /v0/register` (https://developer.send.io/docs/api#am-oidc-register)

Registers your app as an OpenID Connect client (dynamic client registration, RFC 7591). Returns the client_id and, unless you choose none, a client_secret.

Body:

- `redirect_uris` (string[], required): 1 to 10 callback URLs. Each must be https (http only for localhost or 127.0.0.1), with no #fragment.
- `client_name` (string): Your app's name, shown on the sign-in page. At most 100 characters.
- `token_endpoint_auth_method` (string): client_secret_basic (default), client_secret_post, or none for public clients without a secret.

Example request body:

```json
{
  "redirect_uris": [
    "https://app.example.com/auth/callback"
  ],
  "client_name": "Example App"
}
```

- No auth. Limited to 30 registrations per hour per network.
- Clients made here are open clients: they must use PKCE (S256) and cannot ask for owner_email. Apps that need the owner's details are registered by a team in the send.io dashboard.
- Errors use OAuth's shape: {error, error_description}.

### Start a Sign-in

`GET /v0/authorize` (https://developer.send.io/docs/api#am-oidc-authorize)

Send the user's browser here to start a sign-in. It shows a page with an auth_token; the agent approves with POST /inboxes/{inbox_id}/authorize, and the page then returns to your redirect_uri with a code.

Query parameters:

- `client_id` (string, required): Your client_id.
- `redirect_uri` (string, required): One of your registered redirect URIs, exactly.
- `response_type` (string, required): Must be code.
- `scope` (string, required): Space-separated. openid is required; add email, profile, and for dashboard-registered apps owner_profile or owner_email.
- `state` (string): Returned unchanged with the code. Use it against CSRF.
- `nonce` (string): Copied into the ID token.
- `code_challenge` (string): PKCE challenge: base64url(SHA-256(code_verifier)). Required for open clients.
- `code_challenge_method` (string): Must be S256 when code_challenge is set.
- `login_hint` (string): The agent's inbox address, if you know it. Only that inbox can approve.

- No auth: this is a browser redirect. Normally it returns an HTML waiting page. The JSON above is returned when the request sends Accept: application/json (headless sign-in).
- A sign-in expires after 5 minutes. Errors after the client and redirect_uri are checked go back to redirect_uri as error and error_description.
- The agent approves with POST /inboxes/{inbox_id}/authorize {"auth_token": "...", "accept_disclosure": true}, using its send.io API key (see Inboxes). accept_disclosure is required when owner scopes are asked for.

### Get Sign-in Status

`GET /v0/authorize/status` (https://developer.send.io/docs/api#am-oidc-authorize-status)

Polls a sign-in. Once the agent approves, the first poll returns redirect_to: your redirect_uri with a one-time code, state and iss.

Query parameters:

- `txn` (string, required): The transaction_id from Start a Sign-in.

- No API key: do not send your send.io key. The sign-in is proved by the browser's cookie set by /authorize, or an X-Browser-Secret header with the browser_secret for headless callers.
- A missing or malformed txn is a 422. An unknown txn, or a wrong or missing browser secret, is a 404 (the sign-in is never confirmed to anyone without its secret).
- status is pending, approved, expired or completed (the code was already handed out). The code is valid for 60 seconds.

### Exchange Code for Tokens

`POST /v0/token` (https://developer.send.io/docs/api#am-oidc-token)

Trades the code for an ID token and an access token. Both are RS256 JWTs valid for 10 minutes.

Body:

- `grant_type` (string, required): Must be authorization_code.
- `code` (string, required): The code from the redirect. Single use.
- `redirect_uri` (string, required): The same redirect_uri used in /authorize.
- `code_verifier` (string): The PKCE verifier. Required if a code_challenge was sent.
- `client_id` (string): For client_secret_post or public clients. Otherwise use HTTP Basic auth.
- `client_secret` (string): For client_secret_post.

Example request body:

```json
{
  "grant_type": "authorization_code",
  "code": "aic_P3xK8mQ2Lz7Vt4Wn9Bc",
  "redirect_uri": "https://app.example.com/auth/callback",
  "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
}
```

- Auth: client_id and client_secret by HTTP Basic (client_secret_basic) or in the body (client_secret_post); public clients send only client_id.
- The body may be form-encoded (standard) or JSON.
- ID token claims: sub (a stable opaque ID for the inbox), email, email_verified, name, preferred_username, owner_sub, actor_type "agent", plus owner_name / owner_email when granted.

### Get User Info

`GET /v0/userinfo` (https://developer.send.io/docs/api#am-oidc-userinfo)

Returns the signed-in agent's claims for an access token.

- Auth: Authorization: Bearer <access_token from /token> (not a send.io API key).
- POST works too.
