CLI
The official command-line interface for the Cakemail API. Built on the TypeScript SDK with 100% API coverage (232 operations) across 30 command groups.
Installation
# npm (global)
npm install -g @cakemail-org/cakemail-cli
# Or run without installing
npx @cakemail-org/cakemail-cli campaigns list
Authentication
# Access token (recommended for scripting)
export CAKEMAIL_ACCESS_TOKEN=your-access-token
# Or email/password
export CAKEMAIL_EMAIL=you@example.com
export CAKEMAIL_PASSWORD=your-password
# Or pass directly
cakemail campaigns list --access-token your-token
Quick start
# List your campaigns
cakemail campaigns list
# Create a contact
cakemail contacts create --email subscriber@example.com --list-id 123
# Send a transactional email
cakemail email-apis submit --email user@example.com --subject "Welcome" --html "<h1>Hello</h1>"
# Check campaign performance
cakemail reports get 456
Key features
Campaign management
Full lifecycle control — create, configure, test, schedule, and track delivery:
# List delivered campaigns
cakemail campaigns list --status delivered
# Schedule a campaign
cakemail campaigns schedule 123 --scheduled-for "2026-04-15T10:00:00Z"
# Send a test email before launching
cakemail campaigns send-test 123 --email you@example.com
Contact and list management
Manage contacts, lists, segments, and custom attributes:
# List active contacts
cakemail contacts list --list-id 123
# Import contacts in bulk
cakemail contacts import --list-id 123 --data-file contacts.csv
# Tag contacts for segmentation
cakemail tags list --with-count
Reports and analytics
Track campaign performance, link clicks, and email delivery:
# Campaign delivery report
cakemail reports get 456
# Email API activity logs
cakemail email-apis logs --per-page 25
Multi-account support
Seamlessly operate across parent and sub-accounts for multi-tenant workflows:
# List sub-accounts
cakemail sub-accounts list
# Run a command against a specific account
cakemail campaigns list --account-id 789
Output formats
Three formats controlled by --format or your active profile:
# JSON — raw data, ideal for scripting and piping
cakemail campaigns list --format json
# Table — formatted columns with status badges and dates
cakemail campaigns list --format table
# Compact — one-liner per item, ideal for quick scanning
cakemail campaigns list --format compact
Profiles
Profiles control the entire CLI experience — output format, colors, interactivity, date formatting, and error verbosity:
# Switch your active profile
cakemail config profile developer
# Override for a single command
cakemail campaigns list --profile marketer
| Profile | Best for | Output | Colors | Prompts | Dates |
|---|---|---|---|---|---|
| developer | CI/CD, scripting | JSON | None | Disabled | ISO 8601 |
| balanced | Day-to-day use | Table | Moderate | Auto (TTY) | Friendly |
| marketer | Exploration, manual work | Compact | Rich | Always | Relative |
Configuration
Settings persist to ~/.cakemail/config.json:
# Show current config
cakemail config show
# Set active profile
cakemail config set profile developer
# Set default list (auto-used when --list-id is omitted)
cakemail config set default.list_id 123
# Set default sender
cakemail config set default.sender_id 456
Smart auto-detection
The CLI reduces typing by auto-detecting resources:
- Single list? Used automatically — no
--list-idneeded - Single confirmed sender? Selected automatically
- Session cache — last-used resources cached for 5 minutes
# If you have only one list, this just works:
cakemail contacts list
# → Using list: My Newsletter (123)
Scripting and automation
Use --batch or the developer profile to disable all interactive features:
# Pipe contact emails to another tool
cakemail contacts list --batch --format json | jq '.data[].email'
# Use in shell scripts
CAMPAIGN_ID=$(cakemail campaigns create --name "April" --format json | jq -r '.data.id')
cakemail campaigns schedule $CAMPAIGN_ID --scheduled-for "2026-04-15T10:00:00Z"
All command groups
| Command | Description |
|---|---|
campaigns | Create, schedule, send, and manage campaigns |
contacts | Add, update, import, tag, and manage contacts |
lists | Create and manage contact lists |
templates | Email template management |
senders | Sender management and verification |
webhooks | Webhook creation and management |
tags | Contact tag management |
segments | List segmentation |
reports | Campaign and email analytics |
email-apis | Transactional email (v2) |
accounts | Account management |
sub-accounts | Multi-tenant account management |
users | User/team management |
domains | Domain configuration |
dkims | DKIM authentication setup |
config | CLI configuration |
Plus 14 more command groups covering forms, workflows, logos, links, and more.