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 helpRequires 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,deletemessages-send,send-batch,reply,forward,list,get,search,raw,updatethreads-list,get,search,updatedrafts-create,list,get,update,delete,send(use--send-atto schedule)lists- allow/block lists; pass-as the inbox argument for org-level entrieswebhooks,domains,api-keys- full CRUDevents tail- stream live events as NDJSONwait-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-namebecomesdisplay_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:
0success,1API error,2timeout,64usage 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.