AgenticEmail

CLI

Drive AgenticEmail from the command line - JSON in, JSON out, built for AI agents and shell scripts.

The AgenticEmail CLI exposes the full API as shell commands. Every command prints JSON, authenticates from an environment variable, and uses predictable exit codes, so agents can send, receive, and wait for email without writing any integration code.

Install

npm install -g agenticemail-cli
# or run without installing:
bunx agenticemail-cli help

Requires Node 22+ or Bun. Source: AgenticEmail/agenticemail-cli.

Authenticate

Create an API key in the dashboard, then:

export AGENTICEMAIL_API_KEY=am_...

An agent's email loop

# create an inbox
INBOX=$(agenticemail inboxes create --username assistant | jq -r .id)

# send an email
agenticemail messages send "$INBOX" \
  --to customer@example.com \
  --subject "Your order shipped" \
  --text "Reply here with any questions."

# block until the human replies (exit code 2 on timeout)
REPLY=$(agenticemail wait-for-message "$INBOX" --timeout 600)
MSG_ID=$(echo "$REPLY" | jq -r .data.message.id)

# answer it
agenticemail messages reply "$INBOX" "$MSG_ID" --text "Happy to help!"

Commands

Commands mirror the API one-to-one: agenticemail <group> <command> [args] [--flags].

  • inboxes - create, list, get, update, delete
  • messages - send, send-batch, reply, forward, list, get, search, raw, update
  • threads - list, get, search, update
  • drafts - create, list, get, update, delete, send (use --send-at to schedule)
  • lists - allow/block lists; pass - as the inbox argument for org-level entries
  • webhooks, domains, api-keys - full CRUD
  • events tail - stream live events as NDJSON
  • wait-for-message <inbox> - block until an event arrives, print it, exit

Run agenticemail help for the complete, always-current list.

Conventions

  • Flags are kebab-case and map to API fields: --display-name becomes display_name.
  • List-valued flags take commas or repeats: --to a@x.com,b@y.com.
  • --attach ./file.pdf (repeatable) uploads attachments.
  • --json '{"any":"fields"}' merges raw fields into the request body.
  • Exit codes: 0 success, 1 API error, 2 timeout, 64 usage error.
  • Errors are one-line JSON on stderr, results are JSON on stdout - safe to pipe into jq.

Prefer a native tool interface? The same operations are available on the MCP server.

On this page

Talk to a real person