---
title: Command-line interface | SendHQ Docs
description: Install the SendHQ CLI to send and read email, verify domains, manage inboxes and templates, and run the MCP server from a terminal, a script, or CI.
canonical: https://sendhq.cc/docs/cli
last-updated: 2026-09-07
---
# Command-line interface

Install the SendHQ CLI to send and read email, verify domains, manage inboxes and templates, and run the MCP server from a terminal, a script, or CI.

## Install

One binary for Linux, macOS, and Windows on x86-64 and arm64. The installer verifies the release checksum, and no GitHub account is needed.

```shell
curl -fsSL https://downloads.sendhq.cc/install.sh | sh
```

```powershell
irm https://downloads.sendhq.cc/install.ps1 | iex
```

## Authenticate

`sendhq auth login` validates an API key and stores it in the operating system keyring when one is available. `sendhq doctor` then checks the credential and API connectivity.

```shell
sendhq auth login
sendhq doctor
```

For CI and short-lived agent processes, set the key in the environment instead. `SENDHQ_PROFILE` selects a stored profile and `SENDHQ_BASE_URL` targets another API base; the `--profile` and `--base-url` flags take precedence.

```shell
export SENDHQ_API_KEY=re_your_key_here
sendhq domain list
```

## Send and read email

```shell
sendhq email send \
  --from 'Acme <hello@example.com>' \
  --to person@example.net \
  --subject 'Welcome' \
  --text 'Your account is ready.' \
  --idempotency-key account-welcome-42

sendhq email list --direction in --unread --limit 25
sendhq email get em_123
sendhq thread get th_123
sendhq email reply em_123 --text 'Thanks, looking into it.'
sendhq email watch
```

Reuse the same `--idempotency-key` when you retry the same send, so a network retry never sends twice. `sendhq email watch` polls for new mail and prints one record per message, which makes it a simple trigger for scripts and agents. `sendhq email batch` sends up to 100 individualized messages in one call.

## Domains, inboxes, and templates

```shell
sendhq domain add example.com
sendhq domain records dom_123
sendhq domain verify dom_123 --wait

sendhq inbox create support --domain dom_123
sendhq inbox list

sendhq template render tpl_123 --data @sample.json
sendhq template publish tpl_123

sendhq deliverability stats
sendhq suppression list
```

`domain records` prints the DNS records to publish, and `domain verify --wait` keeps checking until verification finishes. `inbox create` adds a receiving address on a verified domain. `template render` shows the exact server output for your sample data before you publish.

## Output for scripts and agents

Output is readable in a terminal and becomes JSON when stdout is redirected. Choose a format explicitly with `--format json`, `--format jsonl`, or `--format raw`. Errors are structured on stderr, and exit codes distinguish invalid input, authentication, not found, conflict, and rate limiting, so a script can branch without parsing messages.

```shell
sendhq email list --direction in --unread --format jsonl | jq -r '.subject'
sendhq commands --format json
```

`sendhq commands` describes every command for scripts and agents. For an API operation that has no command yet, `sendhq request METHOD PATH` calls the endpoint directly with `--input` JSON and `--query key=value`.

## Terminal UI and MCP server

`sendhq tui` opens a keyboard-first inbox, composer, and domain view: `1`, `2`, `3` switch views, `j`/`k` move, `c` composes, `v` verifies the selected domain, and `ctrl+s` sends.

`sendhq mcp` runs the same API client as a local MCP server for Claude Code and other agents, with a `--read-only` variant. See [the MCP server docs](https://sendhq.cc/docs/mcp.md) for the full tool list.

```shell
claude mcp add sendhq --env SENDHQ_API_KEY=re_your_key -- sendhq mcp
```
