Skip to the documentation
Knowledge base

Command line

Your mailbox and every API operation, from a terminal or a script.

Details

  • The nextmail command, installed from npm as @nextmail/cli. It is one file with no dependencies and needs Node.js 20.12 or later. npm i -g @nextmail/cli installs it, and npx @nextmail/cli <command> runs it without an install.
  • There are two ways to sign in. nextmail login opens your browser, where you pick the workspace, the permissions and how long the access lasts, and each browser sign-in is listed under Account → Command line, where you can change its access or sign it out. An API key, saved with nextmail login --with-token or set as NEXTMAIL_API_KEY, never opens a browser and never asks for a code, which suits scripts and CI.
  • A browser sign-in acts as you, so a sensitive change, such as adding a webhook or removing a domain, asks for the same verification code the web app asks for. One code covers that sign-in for 60 minutes, and nextmail verify asks for it before a script runs.
  • inbox, search, read, reply and send work the mailbox the way the app does, with the same search syntax, attachments, scheduled sends, undo and translation. archive, star, snooze and the other thread actions take several thread ids at once.
  • Every method of the SDK is a command, nextmail <resource> <verb>, so anything the REST API can do, the command line can do. nextmail api calls any path directly, with the same sign-in.
  • ai translate, ai compose and ai summarize bring the AI features to the terminal. nextmail mcp config prints the setup for Claude Code, Claude Desktop, Cursor, VS Code, Windsurf and Codex, and nextmail mcp serve lets such a client reuse the sign-in of the command line.
  • It is made for scripts: data goes to stdout and everything else to stderr, --json prints only JSON, --all walks every page of a list, each kind of failure has its own exit code, and nothing prompts in CI or without a terminal. nextmail temp makes a disposable inbox with no account and no key, and temp watch --first waits for its first message.
  • Billing, creating and switching workspaces, account security, data export, writing calendar events, forwarding and linking a DNS provider happen in the web app, and nextmail open opens the right page of it.