Featured

Meet the Elastic Email CLI

by Anna | Sep 8, 2026

In the current era, when people are increasingly relying on AI and optimizing workflows, it’s crucial not only to build agentic-ready solutions but also to make sure that your users can work with the product in their natural environment, whether that’s a favorite LLM chat or a good old terminal.

This is why we build the official Elastic Email CLI (command-line interface) to help developers use our API without leaving the terminal. From now on, you can send transactional emails and entire marketing campaigns, create and manage templates, work with contacts, lists, and segments, verify addresses, and track delivery - all from one tool.

You can run elastic-email on its own, and it opens an interactive TUI where you browse the account with arrow keys and send through a guided wizard, or you can call the same command from a script or a CI job, and it turns into a plain, quiet program with --json output and stable exit codes. It’s MIT-licensed and runs on Node.js 20 or newer.

One line to your first email

Three commands take you from an empty terminal to a delivered message: install the package, store your API key, send. Get the key from the Elastic Email dashboard under Settings > API, and auth set-key asks for it in a masked prompt.

npm install -g elastic-email-cli
elastic-email auth set-key
elastic-email emails send --to you@example.com --subject "Hello" --text "It works!" --from me@yourdomain.com

npx elastic-email-cli also works for anyone who prefers to try a tool before installing it globally.

Interactive while you explore

Interactive mode is a keyboard-driven view of the whole account. Arrow keys move you through templates, lists, and the contacts inside them, segments, delivery events, verification results, sender domains, statistics, and account info. The send wizard covers the steps that usually deserve a second look: the sender, with hints pulled from your verified domains; recipients as plain addresses or as multi-selected lists and segments; content as text, HTML, or a saved template; and a review screen before anything leaves the account.

Quiet while script drives

Every command accepts --json, and piped or non-TTY output drops the banner and the decorations. Exit codes are stable and specific, so a CI job can distinguish a missing API key from a malformed address and respond differently to each. Sends also take a --dry-run flag that validates the input and prints the exact request that would go over the wire, making the first run of a new deploy script safe.

About our API key

The key resolves in a fixed order: the --api-key flag, then the ELASTIC_EMAIL_API_KEY environment variable, then a local config file. Storing it locally writes it in plaintext to ~/.elastic-email-cli/config.json with 0600 permissions. That is a fair trade for your own laptop, and a poor one for shared machines and CI runners, where the environment variable is the better choice. In logs and error output, the key appears only in masked form.

Open source and open to change

The full command reference, the architecture notes, and the development setup live in our GitHub repository, so the fastest way to see what the CLI covers is to read it there. Clone it, run it from source, and open an issue if you hit a rough edge or find a missing command.

If you like this article, share it with friends:

FacebookXLinkedIn
Anna

Anna

A marketing minded individual with a heart for a deeper story. Spent more than a decade in marketing, most of it SaaS, and now leads the team behind Elastic Email. Off the clock, watches old movies, makes great food and keeps a finger on the pulse for lifestyle and marketing trends.

Eager to put this knowledge to some use?

Try one of our products!