---
title: "The Nextmail command line"
description: "Every SDK method is a command. Add --json to read the result and --dry-run to see the request before anything is sent."
url: "https://nextmail.sh/developers/cli"
---

# Every click in the app is a command you can run.

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

[Open console](https://nextmail.sh/console) [Get Started](https://nextmail.sh/signup.md?next=%2Fconsole)[Read the CLI docs](https://nextmail.sh/docs/cli.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, in a terminal

```
$ nextmail inbox●  9:41   Sarah Chen      Homepage copy, final round …  t1●  9:12   Northwind Clo…  Invoice 2214 for August (1)   t2   8:55   Omar Haddad     Can we move Thursday? (1)     t3   8:30   Mia Chen        Signed contract attached (1)  t4   8:02   Lumen           Your code is 481 207 (1)      t5   Yest…  Leo Martin      Photos from Saturday (1)      t6
```

What your clicks call

Open a thread, star it, search or reply.

## The command line, a building block for email.

Every SDK method is a command. Add --json to read the result and --dry-run to see the request before anything is sent.

### Command line

Every SDK method is a command, with --json, --dry-run and exit codes.

[Read the docs : Command line](https://nextmail.sh/docs/cli.md)

- 0 ok
- 3 auth
- 4 permission
- 7 validation
- 8 rate\_limited
- 9 network

### Exit codes

Each command ends with a code, so a script can tell an auth problem from a network one.

[Read the docs : Exit codes](https://nextmail.sh/docs/cli.md)

```
{  "id": "msg_4b7e05d3862c1f0a44b19e2c",  "status": "sent"}
```

### Machine-readable output

Add --json to read the result in any script.

[Read the docs : Machine-readable output](https://nextmail.sh/docs/cli.md)

```
nextmail
├─ emails
├─ threads
├─ labels
├─ drafts
├─ contacts
├─ templates
├─ webhooks
├─ domains
├─ files
└─ keys
```

### Commands by namespace

The same groups as the SDK, such as emails, threads and domains.

[Read the docs : Commands by namespace](https://nextmail.sh/docs/cli.md)

$ nextmail send --to ada@example.de --json | jq .id "msg\_4b7e05d3862c1f0a44b19e2c" $ echo $? 0

### Scripts and CI

Pipe --json into another tool, or fail a build on the exit code.

[Read the docs : Scripts and CI](https://nextmail.sh/docs/cli.md)

Install

## Install it once. Or run it with npx.

`npm install -g @nextmail/clinpm install -g @nextmail/cli`

One command for each of the 793 SDK methods

## One call makes an inbox. The next one reads it.

A disposable inbox made for this visit. Mail sent to it shows up here as it arrives.

Preparing your address

A real inbox, made for you just now. Send it an email and watch it land here.

1. POST /temp-mail/inboxes
2. GET /temp-mail/inboxes/{id}/messages

Agents make their own with `nextmail temp new`.[Open the full inbox](https://nextmail.sh/tools/temp-mail.md)

## 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)
