> ## Documentation Index
> Fetch the complete documentation index at: https://ahasend.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> AhaSend stores all message data in the EU. See /facts.
> The API base URL is https://api.ahasend.com. Send the API key in the Authorization: Bearer header. See /api-reference/authentication.
> Use send.ahasend.com for SMTP. Ports 25, 587 and 2525 use STARTTLS. Port 465 is not supported. See /smtp.
> For send-only integrations, create an API Key v2 under Credentials → Add and scope it to messages:send:{your-domain}. See /send-api/credentials and /api-reference/scopes.

# AhaSend CLI: Send Email from Your Terminal

> The AhaSend CLI (ahasend) is an open-source tool for macOS, Linux and Windows to send email and manage domains, templates, campaigns, contacts and webhooks.

The AhaSend CLI lets you send email, manage domains, templates, campaigns, contacts and credentials, and test webhooks and routes from your terminal.

> [!NOTE]
>
> The AhaSend CLI is available on [GitHub](https://github.com/AhaSend/ahasend-cli) and supports Linux, macOS, and Windows.

## Key Features

> [card] Email Sending
>
> Send single or batch emails with substitutions, stored templates, attachments, and scheduling

> [card] Domain Management
>
> Add, check, and manage sending domains and their DNS records

> [card] Templates and Campaigns
>
> Store transactional templates, and draft, test, and send campaigns to contact lists

> [card] Contacts and Lists
>
> Manage contacts, import them in batches, and organize them in lists

> [card] Webhooks and Routes
>
> Configure event notifications and inbound routes, and test them locally

> [card] Analytics
>
> Deliverability, bounce, and delivery time statistics

## Why Use the CLI?

* **Scripting**: Exit codes tell the kind of failure, and `--output json` prints the API response unchanged
* **Batch Sending**: Concurrent sends with a progress bar, and a file of failed recipients to send again
* **Output Formats**: Plain text, table, JSON, and CSV
* **Profiles**: Switch between accounts, such as production and staging
* **Local Testing**: Webhook and route listeners that forward events to a server on your machine
* **Logging**: `--verbose` and `--debug` logs on stderr, with credentials redacted

## Quick Example

Log in, check a sending domain you [added and configured](https://ahasend.com/docs/cli/quickstart.md#step-2-add-a-sending-domain), and send a sandbox email. Replace `example.com` below with that domain:

```bash theme={null}
# Authenticate with your API key
ahasend auth login

# Check your domain's DNS records
ahasend domains check-dns example.com

# Send an email in sandbox mode
ahasend messages send --sandbox \
  --from noreply@example.com \
  --to user@example.com \
  --subject "Hello from AhaSend" \
  --text "Welcome to AhaSend!"
```

## Core Capabilities

### Email Operations

* Send to recipients given with `--to`, or to a JSON or CSV recipients file with per-recipient substitutions
* HTML, plain text, and AMP content, inline or from files
* Stored transactional templates with `--template-id`
* Attachments up to 10 MiB per file
* Scheduled delivery up to 7 days ahead
* Sandbox mode for testing without delivering email
* Message search, details, and cancellation of scheduled messages

### Domain Management

* Add sending domains and print the DNS records they need, also in BIND, Cloudflare, and Terraform formats
* Check DNS records and track verification status
* Set the sending type, DKIM, and custom subdomains

### Templates and Campaigns

* Store transactional templates, edit drafts, publish them, and restore earlier versions
* Draft, test, send, or schedule campaigns to contact lists
* Campaign statistics, recipients, and campaign templates

### Contacts and Lists

* Create, update, and delete contacts, or import them in batches
* Create contact lists, and add, set, or remove their members

### Webhook & Route Management

* Stream webhook and route events to your terminal, and forward them to a local server
* Trigger test webhook and route events
* Inbound email route configuration

### Analytics & Reporting

* Deliverability statistics
* Bounce statistics
* Delivery time metrics
* CSV output for spreadsheets

## Supported Platforms

The CLI is distributed as a single binary with no external dependencies:

* **macOS**: Intel and Apple Silicon
* **Linux**: x86\_64 and ARM64
* **Windows**: x64 and ARM64

Install it with Homebrew, Scoop, npm, an install script, a .deb or .rpm package, or a binary download. See [Installation](https://ahasend.com/docs/cli/installation.md).

## Integration with AhaSend Services

The CLI covers these AhaSend services:

* **API**: Commands call AhaSend API v2
* **SMTP**: Create SMTP credentials and send test messages over SMTP
* **Webhooks**: Configure webhooks and test event processing
* **Routes**: Configure inbound email handling
* **Suppressions**: List, add, check, and delete suppressed addresses
* **API Keys and Sub-accounts**: Manage API keys and their scopes, and sub-accounts with their own API keys

## Command Groups

* [Messages](https://ahasend.com/docs/cli/commands/messages.md): send, list, get, and cancel messages.
* [Domains](https://ahasend.com/docs/cli/commands/domains.md): create, check, verify, update, and delete sending domains.
* [Templates](https://ahasend.com/docs/cli/commands/templates.md): store transactional templates, with drafts and versions.
* [Campaigns](https://ahasend.com/docs/cli/commands/campaigns.md): draft, test, send, and report on campaigns, and manage campaign templates.
* [Contacts](https://ahasend.com/docs/cli/commands/contacts.md): create, update, list, get, delete, and batch-import account contacts.
* [Lists](https://ahasend.com/docs/cli/commands/lists.md): manage contact lists and their members.
* [Webhooks](https://ahasend.com/docs/cli/commands/webhooks.md): configure, listen to, and trigger webhooks.
* [Routes](https://ahasend.com/docs/cli/commands/routes.md): configure, listen to, and trigger inbound routes.
* [Suppressions](https://ahasend.com/docs/cli/commands/suppressions.md): list, create, check, delete, and wipe suppressions.
* [SMTP](https://ahasend.com/docs/cli/commands/smtp.md): manage SMTP credentials and send test messages.
* [API Keys](https://ahasend.com/docs/cli/commands/apikeys.md): manage API keys, their scopes, and IP allow lists.
* [Statistics](https://ahasend.com/docs/cli/commands/stats.md): deliverability, bounce, and delivery time statistics.
* [Sub-accounts](https://ahasend.com/docs/cli/commands/subaccounts.md): manage child accounts, usage, pauses, and their API keys.
* [Authentication](https://ahasend.com/docs/cli/commands/auth.md): log in, switch, check, and log out profiles.
* [Ping](https://ahasend.com/docs/cli/commands/ping.md): test the connection to the API.

## Next Steps

> [card] [Installation](https://ahasend.com/docs/cli/installation.md)
>
> Install the CLI on your system

> [card] [Quick Start](https://ahasend.com/docs/cli/quickstart.md)
>
> Send your first email in minutes

> [card] [Authentication](https://ahasend.com/docs/cli/authentication.md)
>
> Set up API credentials

> [card] [Command Reference](https://ahasend.com/docs/cli/commands/messages.md)
>
> Explore available commands

## Support

* **GitHub Issues**: [Report bugs or request features](https://github.com/AhaSend/ahasend-cli/issues)
* **Email Support**: [support@ahasend.com](mailto:support@ahasend.com)

## Related Guides

* [Install the CLI](https://ahasend.com/docs/cli/installation.md), [CLI authentication](https://ahasend.com/docs/cli/authentication.md), [REST sending guide](https://ahasend.com/docs/send-api/send-email.md).
* [SMTP settings](https://ahasend.com/docs/smtp.md), [Node.js SDK](https://ahasend.com/docs/guides/nodejs-sdk.md), [Go SDK](https://ahasend.com/docs/guides/go-sdk.md).
* [CLI configuration and output](https://ahasend.com/docs/cli/configuration.md), [API authentication](https://ahasend.com/docs/api-reference/authentication.md), [Permission scopes](https://ahasend.com/docs/api-reference/scopes.md).
* [Domain setup](https://ahasend.com/docs/domains.md), [Sandbox behavior](https://ahasend.com/docs/send-api/sandbox.md), [Tracking setup](https://ahasend.com/docs/tracking/open-tracking.md).
* [Suppression durations](https://ahasend.com/docs/bounces.md#suppression-duration).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.