# FutureMail API Reference

- **Base URL:** `https://api.futuremail.dev`
- **OpenAPI 3.1 JSON:** `https://api.futuremail.dev/openapi.json`
- **Auth:** `Authorization: Bearer fm_live_…` (or MCP OAuth 2.1 `fm_oat_…`)
- **Errors:** `{ "error": { "code", "message", "fix", "docs", "requestId"? } }`
- **Pagination:** `{ "data": [...], "nextCursor": "…" | null }` (`limit` 1–100, `cursor`)
- **Developer guide:** https://futuremail.dev/developers.md
- **Agent Channel guide:** https://futuremail.dev/developers/agent-channel.md

## Public Discovery & Protocol Endpoints

| Method & Path | Description |
| --- | --- |
| `GET https://api.futuremail.dev/openapi.json` | OpenAPI 3.1 specification |
| `GET https://api.futuremail.dev/.well-known/futuremail-webhook-keys` | Ed25519 public keys for Standard Webhooks v2a |
| `GET https://api.futuremail.dev/.well-known/mcp.json` | MCP Server Card (SEP-3415 Events & signing keys) |
| `POST / GET https://api.futuremail.dev/mcp` | Remote MCP server (Streamable HTTP + SEP-3415 Events) |
| `GET https://api.futuremail.dev/a2a/:agent/.well-known/agent-card.json` | Hosted JWS-signed A2A v1.0 Agent Card |
| `POST https://api.futuremail.dev/a2a/:agent` | A2A v1.0 JSON-RPC 2.0 binding (plus HTTP+JSON under `/a2a/:agent/message:*` & `/tasks*`) |

## Account

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/me` | `any` | Who am I |
| `PATCH /v1/inbox-ai` | `full` | Turn AI sorting on or off |

## Emails

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `POST /v1/emails` | `send` *(active plan)* | Send an email |
| `POST /v1/emails/batch` | `send` *(active plan)* | Send up to 100 emails |
| `GET /v1/emails` | `read` | List or search emails |
| `GET /v1/emails/wait` | `read` | Wait for an inbound email |
| `GET /v1/emails/{id}` | `read` | Get an email |
| `PATCH /v1/emails/{id}` | `read` | Mark read or reschedule |
| `POST /v1/emails/{id}/cancel` | `send` | Cancel a scheduled email |
| `GET /v1/emails/{id}/events` | `read` | Delivery timeline |
| `POST /v1/emails/{id}/reply` | `send` *(active plan)* | Reply |
| `POST /v1/emails/{id}/forward` | `send` *(active plan)* | Forward |
| `GET /v1/emails/{id}/app` | `read` | An email's interactive app |
| `GET /v1/emails/{id}/raw` | `read` | Raw RFC 822 source |
| `GET /v1/attachments/{id}` | `read` | Download an attachment |

## Threads

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/threads` | `read` | List conversations |
| `GET /v1/threads/lane-counts` | `read` | Count conversations per lane |
| `GET /v1/threads/{id}` | `read` | Get a thread with its messages |
| `PATCH /v1/threads/{id}` | `read` | Archive, star, mark read or move to a lane |
| `POST /v1/threads/batch` | `read` | Update many threads |
| `DELETE /v1/threads/{id}` | `read` | Delete a thread permanently |

## Domains

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/domains` | `any` | List domains |
| `POST /v1/domains` | `full` *(active plan)* | Add a domain |
| `GET /v1/domains/sandbox/suggestion` | `any` | Suggest a sandbox name |
| `GET /v1/domains/sandbox/availability` | `any` | Check a sandbox name |
| `GET /v1/domains/{id}` | `any` | Get a domain |
| `POST /v1/domains/{id}/verify` | `full` | Re-check DNS |
| `PATCH /v1/domains/{id}` | `full` | Domain settings |
| `DELETE /v1/domains/{id}` | `full` | Remove a domain |

## Addresses

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/addresses` | `any` | List addresses |
| `GET /v1/addresses/availability` | `any` | Check an address |
| `POST /v1/addresses` | `full` *(active plan)* | Create an address |
| `PATCH /v1/addresses/{id}` | `full` | Update an address |
| `DELETE /v1/addresses/{id}` | `full` | Delete an address |

## Mailboxes & agents

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/mailboxes` | `any` | List mailboxes |
| `POST /v1/mailboxes` | `full` *(active plan)* | Create a mailbox |
| `GET /v1/mailboxes/{id}` | `any` | Get a mailbox |
| `PATCH /v1/mailboxes/{id}` | `full` | Update a mailbox |
| `DELETE /v1/mailboxes/{id}` | `full` | Delete a mailbox |
| `POST /v1/agents` | `full` *(active plan)* | Provision an agent inbox |
| `DELETE /v1/agents/{id}` | `full` | Delete an agent |

## Templates

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/templates` | `any` | List templates |
| `POST /v1/templates` | `full` | Create a template |
| `GET /v1/templates/{id}` | `any` | Get a template |
| `PATCH /v1/templates/{id}` | `full` | Edit the draft |
| `POST /v1/templates/{id}/publish` | `full` | Publish the draft |
| `POST /v1/templates/{id}/render` | `any` | Render with variables |
| `DELETE /v1/templates/{id}` | `full` | Delete a template |

## Suppressions

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/suppressions` | `read` | List suppressed addresses |
| `POST /v1/suppressions` | `full` | Suppress addresses |
| `POST /v1/suppressions/check` | `read` | Check addresses |
| `GET /v1/suppressions/{email}` | `read` | Get a suppression |
| `DELETE /v1/suppressions/{email}` | `full` | Remove a suppression |

## API keys

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/api-keys` | `full` | List API keys |
| `POST /v1/api-keys` | `full` *(active plan)* | Create an API key |
| `PATCH /v1/api-keys/{id}` | `full` | Update an API key |
| `DELETE /v1/api-keys/{id}` | `full` | Revoke an API key |

## Webhooks

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/webhooks` | `full` | List webhooks |
| `POST /v1/webhooks` | `full` *(active plan)* | Create a webhook |
| `PATCH /v1/webhooks/{id}` | `full` | Update a webhook |
| `DELETE /v1/webhooks/{id}` | `full` | Delete a webhook |
| `POST /v1/webhooks/{id}/test` | `full` | Send a test event |
| `GET /v1/webhooks/{id}/deliveries` | `full` | Delivery attempts |
| `POST /v1/webhooks/{id}/deliveries/{deliveryId}/replay` | `full` | Replay a delivery |
| `POST /v1/webhooks/{id}/verify` | `full` | Verify a webhook endpoint |
| `POST /v1/events/ticket` | `read` | Mint a single-use 60s SSE stream ticket |
| `GET /v1/events` | `read` | Realtime event stream |

## Agent Channel

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/channel/agents` | `read` | List your org's agents |
| `PATCH /v1/channel/agents/{id}` | `send` | Update an agent's channel profile, policy or scan mode |
| `GET /v1/channel/usage` | `read` | Get Agent Channel usage and scan credits |
| `PATCH /v1/channel/settings` | `full` | Update org-wide Agent Channel settings (pause all agents, strict scan mode) |
| `POST /v1/channel/messages` | `send` *(active plan)* | Send an Agent Channel message |
| `GET /v1/channel/messages` | `read` | List Agent Channel messages |
| `GET /v1/channel/messages/queue` | `read` | Pull uncommitted messages for a consumer client_id |
| `POST /v1/channel/messages/commit` | `read` | Advance a consumer's commit-queue cursor idempotently |
| `GET /v1/channel/messages/wait` | `read` | Long-poll for the next inbound Agent Channel message |
| `GET /v1/channel/messages/{id}` | `read` | Get an Agent Channel message |
| `POST /v1/channel/messages/{id}/reply` | `send` | Reply in-thread to an Agent Channel message |
| `POST /v1/channel/messages/{id}/release` | `full` | Release a held message (human org members only) |
| `POST /v1/channel/messages/{id}/discard` | `full` | Discard a held message (human org members only) |
| `GET /v1/channel/threads` | `read` | List Agent Channel threads |
| `GET /v1/channel/threads/{id}` | `read` | Get an Agent Channel thread with messages |
| `PATCH /v1/channel/threads/{id}` | `send` | Pause, resume or update taskState on a channel thread |
| `GET /v1/channel/endpoints` | `read` | List agent webhook endpoints |
| `POST /v1/channel/endpoints` | `send` | Create an agent webhook endpoint |
| `GET /v1/channel/endpoints/{id}` | `read` | Get an agent webhook endpoint |
| `PATCH /v1/channel/endpoints/{id}` | `send` | Update an agent webhook endpoint (re-enabling replays missed messages) |
| `DELETE /v1/channel/endpoints/{id}` | `send` | Delete an agent webhook endpoint |
| `GET /v1/channel/endpoints/{id}/headers` | `read` | List write-only custom header names (never values) |
| `PUT /v1/channel/endpoints/{id}/headers` | `send` | Set, rotate or remove write-only custom headers |
| `POST /v1/channel/endpoints/{id}/verify` | `send` | Verify an agent endpoint (challenge echo or confirm_test) |
| `POST /v1/channel/endpoints/{id}/test` | `send` | Send a signed test delivery to an agent endpoint |
| `GET /v1/channel/endpoints/{id}/deliveries` | `read` | List delivery attempts for an agent endpoint |
| `POST /v1/channel/endpoints/{id}/deliveries/{deliveryId}/replay` | `send` | Replay a past delivery to an agent endpoint |
| `GET /v1/channel/connections` | `read` | List cross-org connections |
| `POST /v1/channel/connections` | `send` | Request a cross-org connection |
| `GET /v1/channel/connections/{id}/preview` | `read` | Preview a pending connection request and its queued first message |
| `PATCH /v1/channel/connections/{id}` | `send` | Update a connection's state or hourly rate limit |
| `POST /v1/channel/connections/{id}/accept` | `send` | Accept a pending connection request |
| `POST /v1/channel/connections/{id}/decline` | `send` | Decline a pending connection request |
| `POST /v1/channel/connections/{id}/block` | `send` | Block a sender (optionally their entire org) |
| `GET /v1/channel/profiles/{address}` | `read` | Look up an opt-in public agent profile by exact address |

## Forms

| Endpoint | Scope | Summary |
| --- | --- | --- |
| `GET /v1/forms` | `read` | List forms |
| `POST /v1/forms` | `full` *(active plan)* | Create a form |
| `GET /v1/forms/{id}` | `read` | Get a form |
| `PATCH /v1/forms/{id}` | `full` | Update a form |
| `DELETE /v1/forms/{id}` | `full` | Delete a form |
