# Nightmail API

Send, receive and reply to email on your own domains. 202 means queued, not delivered.

- [Interactive documentation](/docs)
- [OpenAPI 3.1 JSON](/openapi.json)
- [Agent index](/llms.txt)
- TypeScript package: `@nightmail/sdk`

[API index](/docs.md) · [Inbound addresses reference](/docs/tags/inbound-addresses.md)

## Get inbound overview

`GET /v1/inbound/overview`

Every route mail can take, with its rules and endpoints, in one read. One page of routes (addresses, agent inboxes, address patterns, explicit routes and catch-alls) merged and ordered by host, kind and address, each resolved to the rules that run on it and where its mail goes. Also returns counts per kind, the rules, up to 100 endpoints and 100 inbound webhooks, and the domains. Members and scoped keys see only their addresses. With an MCP sign-in (approval), it requires an owner or admin, like the other receiving reads.

Operation ID: `getInboundOverview`

Permission: Needs Inboxes: read for the address or inbox.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `kind` | query | string | no | Comma-separated kinds to list: address (a receiving address, including temporary ones), inbox (an agent inbox), route (an explicit route for an address that has no inbox of its own), pattern (an address wildcard rule or a pattern route), catch_all (a *@host route, or the domain default for unknown recipients). Default: every kind. |
| `origin` | query | string | no | Filters address rows only: api (created on purpose) or auto (created by a catch-all). Other kinds are unaffected. |
| `domain` | query | string | no | Receiving host, e.g. reply.acme.com. |
| `q` | query | string | no | Matches the address, an alias or the display name. |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |


### TypeScript SDK

```ts
import { createClient } from '@nightmail/sdk/client';
import { getInboundOverview } from '@nightmail/sdk';

const client = createClient({
  baseUrl: 'https://nightmail.dev',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.NIGHTMAIL_API_KEY
    : undefined,
});

const result = await getInboundOverview({
  client,
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request GET \
  --url 'https://nightmail.dev/v1/inbound/overview' \
  --header "Authorization: Bearer $NIGHTMAIL_API_KEY"
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Success | object |
| `400`, `401`, `403`, `404`, `409`, `413`, `422`, `429`, `500`, `503` | Request failed; use error.code and requestId to diagnose. | object |

#### 200: Success

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `counts` | object | yes | Routes per kind, after the domain and q filters and before kind and origin. |
| `counts.address` | integer | yes |  |
| `counts.auto` | integer | yes | Addresses a catch-all created (origin auto). |
| `counts.route` | integer | yes |  |
| `counts.pattern` | integer | yes |  |
| `counts.catch_all` | integer | yes |  |
| `counts.inbox` | integer | yes |  |
| `routes` | object | yes |  |
| `routes.data` | object[] | yes |  |
| `routes.nextCursor` | string or null | yes |  |
| `rules` | object[] | yes | Every rule in the config, in the order it was saved. |
| `rules[].key` | string | yes |  |
| `rules[].calls` | string[] | yes | Endpoint names it can call. |
| `rules[].delivers` | string[] | yes | Inbox keys it can deliver to. |
| `rules[].decisions` | string[] | yes | The names of the AI decisions it asks for. |
| `rules[].questions` | string[] | yes | The question each of those decisions asks the AI, in the same order: testRules takes scores keyed by these. |
| `rules[].attachedTo` | string[] | yes | Address IDs or addresses it runs on. |
| `rules[].addresses` | string[] | yes | attachedTo as addresses: an inbox ID reads as its primary address. |
| `rules[].recipe` | object | yes |  |
| `rules[].enabled` | boolean | yes | False when it is turned off: it keeps its addresses and doesn’t run. |
| `rules[].lastMatchedAt` | string or null | yes | When it last took an action on received mail, among the workspace’s last 1,000 received emails; null if it didn’t. |
| `rituals` | object[] | yes | Deprecated: rules, with omens for decisions. |
| `rituals[].key` | string | yes |  |
| `rituals[].calls` | string[] | yes | Endpoint names it can call. |
| `rituals[].delivers` | string[] | yes | Inbox keys it can deliver to. |
| `rituals[].omens` | string[] | yes | The names of the AI decisions it asks for. |
| `rituals[].questions` | string[] | yes | The question each of those decisions asks the AI, in the same order: testRules takes scores keyed by these. |
| `rituals[].attachedTo` | string[] | yes | Address IDs or addresses it runs on. |
| `rituals[].addresses` | string[] | yes | attachedTo as addresses: an inbox ID reads as its primary address. |
| `rituals[].recipe` | object | yes |  |
| `rituals[].enabled` | boolean | yes | False when it is turned off: it keeps its addresses and doesn’t run. |
| `rituals[].lastMatchedAt` | string or null | yes | When it last took an action on received mail, among the workspace’s last 1,000 received emails; null if it didn’t. |
| `endpoints` | object[] | yes | At most 100 endpoints (by name) and 100 inbound webhooks. |
| `endpoints[].id` | string | yes | Endpoint ID: mwh_… for a webhook, con_… for Slack, Discord or a forward. |
| `endpoints[].source` | string | yes | endpoint: a named endpoint, which rules call (listEndpoints). inbound_webhook: a webhook without a name (listInboundWebhooks lists every webhook, named or not). |
| `endpoints[].name` | string | yes |  |
| `endpoints[].type` | string | yes |  |
| `endpoints[].status` | string | yes |  |
| `endpoints[].target` | string | yes | Where it delivers; URLs are write-only (last four characters). |
| `endpoints[].call` | string or null | yes | How a rule calls an endpoint; null for an inbound webhook. |
| `endpoints[].eventTypes` | string[] | yes | Events a webhook subscribes to; empty for a route-only webhook and for Slack, Discord and forward endpoints. |
| `endpoints[].routes` | integer | yes | Routes that name it. |
| `endpoints[].rules` | string[] | yes | Rules that call it. |
| `endpoints[].rituals` | string[] | yes | Deprecated: rules. |
| `endpointsTruncated` | boolean | yes | True when the workspace has more endpoints or inbound webhooks than listed. Read them all with listEndpoints and listInboundWebhooks, following nextCursor until it is null. |
| `domains` | object[] | yes | Every domain with its receiving status, including domains that only send. |
| `domains[].id` | string | yes | Nightmail domain ID. |
| `domains[].name` | string | yes | Receiving host: the domain, or the subdomain it receives at. |
| `domains[].domain` | string | yes | The domain itself. Hosted, an address on it or any of its subdomains turns receiving on there (createInboundAddress). |
| `domains[].hosts` | string[] | yes | Every host the domain receives at, or is being set up to (name is its first); addresses can be created at each. |
| `domains[].status` | string | yes |  |
| `domains[].catchAll` | string | yes |  |
| `manage` | boolean | yes | False for members and scoped keys: they see their addresses, without routes, rules, endpoints or domains. |
| `version` | integer | yes | The routing and rules version this overview was read at: send it as If-Match to setInboundAddressFlow. |

#### 400, 401, 403, 404, 409, 413, 422, 429, 500, 503: Request failed; use error.code and requestId to diagnose.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | object | yes |  |
| `error.code` | string | yes |  |
| `error.message` | string | yes |  |
| `error.requestId` | string | yes |  |
| `error.field` | string | no |  |
| `error.retryable` | boolean | yes |  |
| `error.resetAt` | string | no | Next capacity change for a Hosted rolling send limit. |
| `error.details` | object[] | no | Every problem found, when there is more than one part, such as rule diagnostics with rule, line, column, message and hint, or a measurement, such as CONTENT_TOO_LARGE_TO_SCREEN with screenedBytes and limitBytes (and index in a batch). |
| `error.required` | object | no | On a 403 permission refusal: what the request needs that this credential lacks. The Nightmail-Required-Permission header says the same. |
