---
title: "The Nextmail REST API"
description: "Every operation is a REST call made with a key. The whole contract is one OpenAPI document, readable without a key."
url: "https://nextmail.sh/developers/api"
---

# Every click in the app is a request you can make.

The window below shows one session as HTTP. Open the mailbox tab, read a thread, star it or search, and each click comes back as a request.

[Open console](https://nextmail.sh/console) [Get Started](https://nextmail.sh/signup.md?next=%2Fconsole)[Read the API reference](https://nextmail.sh/docs/api/reference.md)

Park Studio Pro

Inbox

Everything addressed to you, minus spam.

Homepage copy, final round

9:41

Sarah Chen

Invoice 2214 for August

9:12

Northwind Cloud

Can we move Thursday?

8:55

Omar Haddad

Signed contract attached

8:30

Mia Chen

Your code is 481 207

8:02

Lumen

Photos from Saturday

Yesterday

Leo Martin

Your flight to Lisbon is confirmed

Yesterday

Skyline Travel

Quarterly numbers are in

Wed

Ken Ito

Coffee next week?

Tue

Priya Raman

Your session, as HTTP requests

```
curl "https://api.nextmail.sh/threads?folder=inbox" \  -H "Authorization: Bearer $NEXTMAIL_API_KEY"
```

Last response

GET /threads?folder=inbox

```
{  "items": [    {      "object": "thread",      "id": "t1"    },    {      "object": "thread",      "id": "t2"    },    {      "object": "thread",      "id": "t3"    },    {      "object": "thread",      "id": "t4"    },    {      "object": "thread",      "id": "t5"    },    {      "object": "thread",      "id": "t6"    },    {      "object": "thread",      "id": "t7"    },    {      "object": "thread",      "id": "t8"    },    {      "object": "thread",      "id": "t9"    }  ],  "hasMore": false,  "nextCursor": null}
```

What your clicks call

Open a thread, star it, search or reply.

## The API, a building block for email.

Every operation is a REST call made with a key. The whole contract is one OpenAPI document, readable without a key.

```
curl -X POST https://api.nextmail.sh/emails \  -H "Authorization: Bearer $NEXTMAIL_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "from": "Acme Billing <billing@acme.com>",    "to": ["ada@example.de"],    "subject": "Your September invoice",    "html": "<p>The invoice is attached.</p>"  }'
```

### Write one call.

Anything that speaks HTTP can send. TypeScript, Python, Ruby, PHP, Go, Java and C# get typed clients, and every message reports back as it is queued, sent and delivered.

[Read the docs : Write one call.](https://nextmail.sh/docs/api/reference.md)

POST /emails 202

queued sending sent delivered

Response

`{ "object": "email", "id": "msg_4b7e05d3", "status": "sent"}`

email.delivered ada@northwind.dev

### Sending

Send now or later. A retry never sends twice.

[Read the docs : Sending](https://nextmail.sh/docs/sdk/reference/emails.md)

### API keys

Scoped keys with a sending address, an expiry and a log of every request.

[Read the docs : API keys](https://nextmail.sh/docs/api/keys.md)

GET /threads/wait 200

Raw message

From: Nina Park <nina@northwind.dev> To: support@acme.com Subject: Can we move Thursday? DKIM-Signature: v=1; a=rsa-sha256; d=northwind.dev Content-Type: multipart/alternative

What your code gets

`{``"object": "message_arrival",``"threadId": "thr_8f2c1a",``"address": "support@acme.com",``"from": { "email": "nina@northwind.dev", "name": "Nina Park" },``"subject": "Can we move Thursday?",``"receivedAt": "2026-11-03T09:41:00Z"``}`

### Receiving

Mail lands in threads, parsed and checked.

[Read the docs : Receiving](https://nextmail.sh/docs/sdk/reference/threads.md)

### OpenAPI 3.1

The whole contract is one public document, readable without a key.

[Read the docs : OpenAPI 3.1](https://nextmail.sh/docs/api/reference/openapi.md)

The building blocks

## What are the building blocks?

Domains, inboxes, sending, receiving and more. Use one on its own or put them together. Every block works the same over REST, the SDKs, the CLI and MCP.

## 639 operations. Every one in the reference.

Grouped by resource, from sending one email to verifying a domain. Each one is documented with what it takes and what it returns.

- [Domains](https://nextmail.sh/docs/api/reference/domains.md) 58
- [Calendar](https://nextmail.sh/docs/api/reference/calendar.md) 42
- [Your account](https://nextmail.sh/docs/api/reference/your-account.md) 33
- [Contacts](https://nextmail.sh/docs/api/reference/contacts.md) 30
- [Templates](https://nextmail.sh/docs/api/reference/templates.md) 24
- [Threads](https://nextmail.sh/docs/api/reference/threads.md) 24
- [Knowledge](https://nextmail.sh/docs/api/reference/knowledge.md) 24
- [Automations](https://nextmail.sh/docs/api/reference/automations.md) 22
- [Forms](https://nextmail.sh/docs/api/reference/forms.md) 21
- [and 43 more resources](https://nextmail.sh/docs/api/reference.md)

## Every delivery signed. Every retry, the same id.

56 events, signed with HMAC, retried up to eight times over about 27 hours, and replayable.

Deliveries

Every POST to acme.com, newest first.

https://acme.com/webhooks

| When | Event | Status | Try | Took |
| --- | --- | --- | --- | --- |
|  |  |  |  |  |
|  |  |  |  |  |
|  |  |  |  |  |
|  |  |  |  |  |

## Numbers you can check from a terminal.

The OpenAPI 3.1 document is public and needs no key, and the SDK has to match it before a release.

- **documented operations**
  639
  GET /openapi.json
- **paths on one host**
  471
  jq '.paths | length'
- **SDK methods**
  793
  Matched to the spec before every release
- **MCP tools**
  606
  nextmail mcp tools
- **webhook events**
  56
  Matched to the spec before every release

## Four doors. One mailbox behind them.

REST, the SDK, the command line and MCP reach the same operations, with the same scopes and the same limits.

- [REST POST /emails](https://nextmail.sh/developers/api.md)
- [SDKs nextmail.emails.send()](https://nextmail.sh/developers/sdk.md)
- [CLI nextmail send](https://nextmail.sh/developers/cli.md)
- [MCP sendEmail](https://nextmail.sh/developers/mcp.md)

Nextmail

- [Domains](https://nextmail.sh/docs/sdk/reference/domains.md)
- [Inboxes](https://nextmail.sh/docs/sdk/reference/domains.md)
- [Sending](https://nextmail.sh/docs/sdk/reference/emails.md)
- [Receiving](https://nextmail.sh/docs/sdk/reference/threads.md)
- [Webhooks](https://nextmail.sh/docs/sdk/reference/webhooks.md)
- [Live events](https://nextmail.sh/docs/sdk/reference/live-events.md)
- [Calendar](https://nextmail.sh/docs/sdk/reference/calendar.md)
- [Contacts](https://nextmail.sh/docs/sdk/reference/contacts.md)
- [Attachments](https://nextmail.sh/docs/sdk/reference/files.md)
