# API reference

> Every endpoint Zurchin answers, with the access it needs and the page that documents it. The API is at `https://zurchin.com`, takes and answers JSON (OAuth endpoints take forms), and authenticates `/v1` with `Authorization: Bearer pgn_…`.

Source: https://zurchin.com/docs/api

## /v1

The `/v1` operations, 79 of them, by product. The same list is [an OpenAPI document](https://zurchin.com/docs/api.md#openapi). An account key is a key of the whole account: a key of one pod gets `403`.

### Email

| Method and path | Access | Does |
| --- | --- | --- |
| `GET /v1/domains` | `read` | Your domains, waiting and proved; a key of one pod, its pod’s. [Domains from the API](https://zurchin.com/docs/email.md#domains-api) |
| `POST /v1/domains` | `admin` | Add a domain; answers the TXT record that proves it. [Domains from the API](https://zurchin.com/docs/email.md#domains-api) |
| `GET /v1/domains/{id}` | `read` | One domain: whether it is proved, its mail, and every DNS record to publish. [Domains from the API](https://zurchin.com/docs/email.md#domains-api) |
| `POST /v1/domains/{id}/verify` | `read` | Look for the domain’s `_pidgeon` TXT record now. [Domains from the API](https://zurchin.com/docs/email.md#domains-api) |
| `DELETE /v1/domains/{id}` | `admin` | Remove a domain; a proved one’s mail is turned off first. [Domains from the API](https://zurchin.com/docs/email.md#domains-api) |
| `GET /v1/email/inboxes` | `read` | List inboxes. [Inboxes](https://zurchin.com/docs/email.md#list) |
| `POST /v1/email/inboxes` | `admin` | Create an inbox. [Create an inbox](https://zurchin.com/docs/email.md#create) |
| `GET /v1/email/inboxes/{id}` | `read` | One inbox. [Inboxes](https://zurchin.com/docs/email.md#list) |
| `PATCH /v1/email/inboxes/{id}` | `read` | Turn on holding suspicious mail for a person (a key never turns it off), or set the signature (`admin`). [Held for a person](https://zurchin.com/docs/email.md#held) |
| `DELETE /v1/email/inboxes/{id}` | `admin` | Remove an inbox; its address is retired for good. [Inboxes](https://zurchin.com/docs/email.md#list) |
| `GET /v1/email/inboxes/{id}/messages` | `read` | The inbox’s mail, sent and received, newest first. [Reading mail](https://zurchin.com/docs/email.md#reading) |
| `GET /v1/email/inboxes/{id}/messages/await` | `read` | Wait for mail: answers when some arrives, or after `timeout`. [Reading mail](https://zurchin.com/docs/email.md#reading) |
| `GET /v1/email/messages/{id}` | `read` | One message, with the Firewall’s verdict. [Reading mail](https://zurchin.com/docs/email.md#reading) |
| `PATCH /v1/email/messages/{id}` | `draft` | Mark a received message read or unread. [Reading mail](https://zurchin.com/docs/email.md#reading) |
| `POST /v1/email/inboxes/{id}/messages` | `send` | Send mail. [Send mail](https://zurchin.com/docs/sending.md#request) |
| `POST /v1/email/inboxes/{id}/drafts` | `draft` | Write a draft. [Drafts](https://zurchin.com/docs/sending.md#drafts) |
| `GET /v1/email/drafts/{id}` | `read` | A draft, held or scheduled message. [Drafts](https://zurchin.com/docs/sending.md#drafts) |
| `PATCH /v1/email/drafts/{id}` | `draft` | Replace a draft’s addresses and body; its thread stays. [Drafts](https://zurchin.com/docs/sending.md#drafts) |
| `DELETE /v1/email/drafts/{id}` | `draft` | Throw away a draft, or a held or scheduled message. [Drafts](https://zurchin.com/docs/sending.md#drafts) |
| `POST /v1/email/drafts/{id}/approval` | `draft` | Hold a draft for a person to approve. [Drafts](https://zurchin.com/docs/sending.md#drafts) |
| `POST /v1/email/drafts/{id}/send` | `send` | Send a draft now, or at `send_at`. [Drafts](https://zurchin.com/docs/sending.md#drafts) |
| `POST /v1/email/inboxes/{id}/attachments` | `draft` | Upload a file to send, up to 4 MB. [Attachments](https://zurchin.com/docs/email.md#attachments) |
| `POST /v1/email/inboxes/{id}/attachments/uploads` | `draft` | Start uploading a file up to 25 MB; put its bytes at the link. [Attachments](https://zurchin.com/docs/email.md#attachments) |
| `POST /v1/email/attachments/{id}/complete` | `draft` | Finish an upload: the file becomes sendable. [Attachments](https://zurchin.com/docs/email.md#attachments) |
| `GET /v1/email/attachments/{id}` | `read` | A file, with a link to its bytes for five minutes. [Attachments](https://zurchin.com/docs/email.md#attachments) |
| `GET /v1/email/storage` | `read` | How much of the account’s 10 GB its mail and files use. [Storage](https://zurchin.com/docs/email.md#storage) |
| `GET /v1/email/threads` | `read` | Conversations across your inboxes, newest first. [Conversations](https://zurchin.com/docs/email.md#conversations) |
| `GET /v1/email/threads/{id}` | `read` | One conversation and its messages, oldest first. [Conversations](https://zurchin.com/docs/email.md#conversations) |
| `PATCH /v1/email/threads/{id}` | `draft` | File, star, or hand a conversation to a person. [Conversations](https://zurchin.com/docs/email.md#conversations) |
| `DELETE /v1/email/threads/{id}` | `admin` | Delete a conversation, its messages and files, for good. [Conversations](https://zurchin.com/docs/email.md#conversations) |
| `GET /v1/email/inboxes/{id}/labels` | `read` | An inbox’s labels, by name. [Labels](https://zurchin.com/docs/email.md#labels) |
| `POST /v1/email/inboxes/{id}/labels` | `draft` | Make a label. [Labels](https://zurchin.com/docs/email.md#labels) |
| `PATCH /v1/email/labels/{id}` | `draft` | Rename or recolour a label. [Labels](https://zurchin.com/docs/email.md#labels) |
| `DELETE /v1/email/labels/{id}` | `draft` | Delete a label; its conversations stay. [Labels](https://zurchin.com/docs/email.md#labels) |
| `POST /v1/email/threads/{id}/labels` | `draft` | Put a label on a conversation. [Labels](https://zurchin.com/docs/email.md#labels) |
| `DELETE /v1/email/threads/{id}/labels/{labelId}` | `draft` | Take a label off a conversation. [Labels](https://zurchin.com/docs/email.md#labels) |
| `GET /v1/email/search` | `read` | Find messages by words in their subject, sender or text. [Search](https://zurchin.com/docs/email.md#search) |
| `GET /v1/email/contacts` | `read` | Who your inboxes correspond with, most recently seen first. [Contacts](https://zurchin.com/docs/email.md#contacts) |
| `GET /v1/email/contacts/{id}` | `read` | One contact. [Contacts](https://zurchin.com/docs/email.md#contacts) |
| `PATCH /v1/email/contacts/{id}` | `draft` | Name a contact or note something; mail no longer renames it. [Contacts](https://zurchin.com/docs/email.md#contacts) |
| `DELETE /v1/email/contacts/{id}` | `draft` | Forget a contact; new mail adds it again. [Contacts](https://zurchin.com/docs/email.md#contacts) |
| `POST /v1/email/test/inbound` | `send`, test key | Deliver test mail to one of your inboxes, as if from outside. [Test keys](https://zurchin.com/docs/email.md#test-mode) |
| `GET /v1/email/domains` | `read` | Your proved domains, and whether mail is on; a key of one pod, its pod’s. [Your own domain](https://zurchin.com/docs/email.md#domains) |
| `GET /v1/email/domains/{id}` | `read` | One domain, its mail status and the records to set. [Your own domain](https://zurchin.com/docs/email.md#domains) |
| `POST /v1/email/domains/{id}/mail` | `admin` | Turn mail on for a proved domain. [Your own domain](https://zurchin.com/docs/email.md#domains) |
| `DELETE /v1/email/domains/{id}/mail` | `admin` | Turn mail off for a domain. [Your own domain](https://zurchin.com/docs/email.md#domains) |
| `POST /v1/email/domains/{id}/check` | `read` | Check a domain’s records now. [Your own domain](https://zurchin.com/docs/email.md#domains) |
| `GET /v1/email/inboxes/{id}/members` | `read` | Who reads an inbox: its access, and its people and keys. [Who reads an inbox](https://zurchin.com/docs/email.md#access) |
| `POST /v1/email/inboxes/{id}/members` | `admin` | Add a key, a connected app or a person to an inbox. [Who reads an inbox](https://zurchin.com/docs/email.md#access) |
| `PATCH /v1/email/inboxes/{id}/members/{memberId}` | `admin` | Change the level a key was added at. [Who reads an inbox](https://zurchin.com/docs/email.md#access) |
| `DELETE /v1/email/inboxes/{id}/members/{memberId}` | `admin` | Take a key or a person off an inbox. [Who reads an inbox](https://zurchin.com/docs/email.md#access) |
| `PUT /v1/email/inboxes/{id}/access` | `admin` | Choose who reads an inbox: the team, some people, or an agent and its supervisors. [Who reads an inbox](https://zurchin.com/docs/email.md#access) |
| `GET /v1/email/inboxes/{id}/app-passwords` | `admin` | An inbox’s app passwords, never the passwords themselves. [Mail apps](https://zurchin.com/docs/email.md#mail-apps) |
| `POST /v1/email/inboxes/{id}/app-passwords` | `admin` | Make an app password for IMAP, SMTP and CalDAV; shown once. [Mail apps](https://zurchin.com/docs/email.md#mail-apps) |
| `DELETE /v1/email/app-passwords/{id}` | `admin` | Revoke an app password. [Mail apps](https://zurchin.com/docs/email.md#mail-apps) |
| `GET /v1/email/inboxes/{id}/events` | `read` | An inbox’s calendar events, in start order. [Calendar](https://zurchin.com/docs/email.md#calendar) |
| `POST /v1/email/inboxes/{id}/events` | `draft` | Put an event on an inbox’s calendar. [Calendar](https://zurchin.com/docs/email.md#calendar) |
| `GET /v1/email/events/{id}` | `read` | One calendar event. [Calendar](https://zurchin.com/docs/email.md#calendar) |
| `PATCH /v1/email/events/{id}` | `draft` | Change an event; what you leave out stays. [Calendar](https://zurchin.com/docs/email.md#calendar) |
| `DELETE /v1/email/events/{id}` | `draft` | Delete an event; calendar apps drop it at their next sync. [Calendar](https://zurchin.com/docs/email.md#calendar) |
| `GET /v1/email/rules` | `read`, account key | Send and receive rules. [Rules](https://zurchin.com/docs/sending.md#rules) |
| `POST /v1/email/rules` | `admin`, account key | Allow or block an address or a domain. [Rules](https://zurchin.com/docs/sending.md#rules) |
| `DELETE /v1/email/rules/{id}` | `admin`, account key | Remove a rule. [Rules](https://zurchin.com/docs/sending.md#rules) |
| `GET /v1/email/suppressions` | `read`, account key | The do-not-send list, newest first. [Rules](https://zurchin.com/docs/sending.md#rules) |
| `POST /v1/email/suppressions` | `admin`, account key | Put an address on the do-not-send list. [Rules](https://zurchin.com/docs/sending.md#rules) |
| `DELETE /v1/email/suppressions` | `admin`, account key | Take an address off the do-not-send list. [Rules](https://zurchin.com/docs/sending.md#rules) |

### Platform

| Method and path | Access | Does |
| --- | --- | --- |
| `GET /v1/pods` | `read` | List pods. [Pods](https://zurchin.com/docs/api-keys.md#pods) |
| `POST /v1/pods` | `admin`, account key | Make a pod. [Pods](https://zurchin.com/docs/api-keys.md#pods) |
| `PATCH /v1/pods/{id}` | `admin`, account key | Rename a pod. [Pods](https://zurchin.com/docs/api-keys.md#pods) |
| `POST /v1/pods/{id}/move` | `admin`, account key | Move an address, domain or webhook endpoint into a pod. [Pods](https://zurchin.com/docs/api-keys.md#pods) |
| `DELETE /v1/pods/{id}` | `admin`, account key | Remove an empty pod. [Pods](https://zurchin.com/docs/api-keys.md#pods) |
| `GET /v1/events` | `read` | The account’s event log, newest first. [Event log](https://zurchin.com/docs/webhooks.md#event-log) |
| `GET /v1/keys` | `read`, account key | Your API keys, never the keys themselves. [Keys from the API](https://zurchin.com/docs/api-keys.md#keys-api) |
| `POST /v1/keys` | `admin`, account key | Make an API key, never stronger than the one making it; the key is answered once. A test key makes only test keys. [Keys from the API](https://zurchin.com/docs/api-keys.md#keys-api) |
| `DELETE /v1/keys/{id}` | `admin`, account key | Revoke an API key; it stops working at once. [Keys from the API](https://zurchin.com/docs/api-keys.md#keys-api) |
| `GET /v1/webhooks` | `read` | Your webhook endpoints, never their secrets; a key of one pod, its pod’s. [Webhooks](https://zurchin.com/docs/webhooks.md#endpoints) |
| `POST /v1/webhooks` | `admin` | Add a webhook endpoint; its secret is answered once. [Webhooks](https://zurchin.com/docs/webhooks.md#endpoints) |
| `DELETE /v1/webhooks/{id}` | `admin` | Remove a webhook endpoint; a key of one pod, its pod’s only. [Webhooks](https://zurchin.com/docs/webhooks.md#endpoints) |
| `GET /v1/openapi.json` | None | This API as an OpenAPI 3.1 document. No key needed. [OpenAPI](https://zurchin.com/docs/api.md#openapi) |

## OpenAPI

`GET /v1/openapi.json` answers this API as an OpenAPI 3.1 document, with no key: every operation above with its parameters, request body and answers, an example of each, the rate-limit headers and `Idempotency-Key`, for a client generator or an agent’s tool list. It is made from the same list as this page, so the two never differ.

The webhooks Zurchin sends are an AsyncAPI 3.0 document at `/asyncapi.json`. `/.well-known/api-catalog` (RFC 9727) links both, the docs, the [changelog](https://zurchin.com/docs/changelog.md), the status page and the [MCP server](https://zurchin.com/docs/sdks.md#mcp).

```bash
curl https://zurchin.com/v1/openapi.json
curl https://zurchin.com/asyncapi.json
curl https://zurchin.com/.well-known/api-catalog
```

## OAuth

| Method and path | Does |
| --- | --- |
| `GET /.well-known/oauth-authorization-server` | OAuth metadata (RFC 8414), for apps. |
| `GET /.well-known/oauth-protected-resource` | Resource metadata (RFC 9728), named by every `401`. |
| `GET /oauth/authorize` | Where a person signs in and lets an app act for their account. [Apps that connect with OAuth](https://zurchin.com/docs/api-keys.md#oauth-apps) |
| `POST /oauth/token` | Codes and refresh tokens. |
| `POST /oauth/register` | Dynamic client registration (RFC 7591), for apps. |
| `POST /oauth/revoke` | Revoke an app’s token (RFC 7009). |

## Conventions

- Ids are UUIDs.
- Times are ISO 8601 in UTC.
- Lists answer `{data, has_more, next_cursor}`; pass `next_cursor` back as `cursor`.
- Errors answer `{"error": {"code", "message"}}`: [Errors](https://zurchin.com/docs/errors.md).
- 600 requests a minute per key; every answer carries `RateLimit` and `RateLimit-Policy`, and `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`. [Rate limit](https://zurchin.com/docs/api-keys.md#rate-limit)
- Sending and creating calls take `Idempotency-Key`, so a retry is never done twice. [Idempotency](https://zurchin.com/docs/api-keys.md#idempotency)
- What changed, newest first: [the changelog](https://zurchin.com/docs/changelog.md). Whether it is up: [status.pidgeon.ai](https://status.pidgeon.ai).
