Mailcoach CLI
Use this skill when the user wants to manage email marketing through their Mailcoach instance. This includes managing email lists, subscribers, campaigns, transactional emails, templates, automations, tags, segments, and suppressions.
Prerequisites
The mailcoach CLI must be installed and authenticated. If a command returns a 401 error, the user needs to authenticate first.
# Authenticate with a Mailcoach instance
mailcoach login
# Verify authentication works
mailcoach list-email-lists
See rules/authentication.md for the full login flow.
How commands work
Commands are auto-generated from the Mailcoach OpenAPI spec. Always discover commands dynamically rather than guessing names.
# List all available commands
mailcoach list
# Get help for a specific command (shows all options)
mailcoach <command-name> --help
Command naming
Commands use kebab-case derived from API operation IDs:
list-email-lists, create-email-list, show-email-list, update-email-list, delete-email-list
list-subscribers, create-subscriber, show-subscriber, update-subscriber
list-campaigns, create-campaign, send-campaign, send-campaign-test
list-transactional-mails, send-transactional-mail
list-tags, create-tag, list-segments, create-segment
trigger-automation
Parameter naming
- Path parameters like
{emailList} become required options: --email-list=<uuid>
- Query parameters like
filter[search] become optional options: --filter-search=<value>
- Both
snake_case and camelCase parameter names are converted to --kebab-case (e.g., book_id and bookId both become --book-id)
Sending data
# JSON body (preferred for creates/updates)
mailcoach create-email-list --input '{"name": "Newsletter", "default_from_email": "hi@example.com"}'
# Form fields (repeatable, simpler for flat data)
mailcoach create-email-list --field name="Newsletter" --field default_from_email="hi@example.com"
# File uploads (prefix path with @)
mailcoach create-subscriber-import --email-list=<uuid> --field csv=@/path/to/subscribers.csv
--field values are sent as JSON by default. When any field contains a file (@ prefix), the entire request switches to multipart/form-data.
- You cannot combine
--field and --input in the same command.
Output formats
mailcoach list-email-lists # Human-readable table (default)
mailcoach list-email-lists --json # Raw JSON (useful for parsing)
mailcoach list-email-lists --yaml # YAML output
mailcoach list-email-lists --minify # Minified single-line JSON (implies --json)
mailcoach list-email-lists --H # Include response headers
mailcoach list-email-lists --output-html # Show HTML response bodies (hidden by default)
Always use --json when you need to extract UUIDs or data from responses for use in subsequent commands.
Filtering, sorting, and pagination
mailcoach list-subscribers --email-list=<uuid> --filter-search="john" --sort=email --filter-per-page=50 --filter-page=2
--filter-search: fuzzy text search
--sort: field name, prefix with - for descending (e.g., --sort=-created_at)
--filter-per-page: results per page (max 100, default 15)
--filter-page: page number
Error handling
- 401: Authentication failed. Run
mailcoach login to re-authenticate.
- 422: Validation error. The response body contains details about which fields are invalid.
- 404: Resource not found. Verify the UUID is correct.
- Missing path parameter: The CLI tells you which
--option is required.
- All errors exit with a non-zero code, so you can chain commands with
&&.
- HTML error responses hide the body by default — add
--output-html to see them.
Common workflows
Email lists and subscribers
- rules/email-lists.md — Create and manage email lists, tags, and segments
- rules/subscribers.md — Add, import, tag, and manage subscribers
Campaigns
- rules/campaigns.md — Full campaign lifecycle: create, configure, test, send, and view statistics
Transactional emails
- rules/transactional.md — Send transactional emails via templates or inline content
Templates and automations
- rules/templates.md — Manage reusable email templates
- rules/automations.md — Trigger automations via the CLI
Important notes
- Mailcoach is self-hosted: each user has a unique instance URL configured during
mailcoach login
- The OpenAPI spec is cached for 24 hours. Run
mailcoach clear-cache to force a refresh if commands seem outdated.
- UUIDs are used as resource identifiers throughout the API.
- When chaining commands (e.g., create a list then add subscribers), use
--json to extract UUIDs from responses.
1---2name: mailcoach3description: Manage email marketing with the Mailcoach CLI — email lists, subscribers, campaigns, transactional emails, templates, automations, tags, and segments.4---56# Mailcoach CLI78Use this skill when the user wants to manage email marketing through their Mailcoach instance. This includes managing email lists, subscribers, campaigns, transactional emails, templates, automations, tags, segments, and suppressions.910## Prerequisites1112The `mailcoach` CLI must be installed and authenticated. If a command returns a 401 error, the user needs to authenticate first.1314```bash15# Authenticate with a Mailcoach instance16mailcoach login1718# Verify authentication works19mailcoach list-email-lists20```2122See [rules/authentication.md](rules/authentication.md) for the full login flow.2324## How commands work2526Commands are **auto-generated from the Mailcoach OpenAPI spec**. Always discover commands dynamically rather than guessing names.2728```bash29# List all available commands30mailcoach list3132# Get help for a specific command (shows all options)33mailcoach <command-name> --help34```3536### Command naming3738Commands use kebab-case derived from API operation IDs:3940- `list-email-lists`, `create-email-list`, `show-email-list`, `update-email-list`, `delete-email-list`41- `list-subscribers`, `create-subscriber`, `show-subscriber`, `update-subscriber`42- `list-campaigns`, `create-campaign`, `send-campaign`, `send-campaign-test`43- `list-transactional-mails`, `send-transactional-mail`44- `list-tags`, `create-tag`, `list-segments`, `create-segment`45- `trigger-automation`4647### Parameter naming4849- Path parameters like `{emailList}` become **required** options: `--email-list=<uuid>`50- Query parameters like `filter[search]` become **optional** options: `--filter-search=<value>`51- Both `snake_case` and `camelCase` parameter names are converted to `--kebab-case` (e.g., `book_id` and `bookId` both become `--book-id`)5253### Sending data5455```bash56# JSON body (preferred for creates/updates)57mailcoach create-email-list --input '{"name": "Newsletter", "default_from_email": "hi@example.com"}'5859# Form fields (repeatable, simpler for flat data)60mailcoach create-email-list --field name="Newsletter" --field default_from_email="hi@example.com"6162# File uploads (prefix path with @)63mailcoach create-subscriber-import --email-list=<uuid> --field csv=@/path/to/subscribers.csv64```6566- `--field` values are sent as JSON by default. When any field contains a file (`@` prefix), the entire request switches to `multipart/form-data`.67- You cannot combine `--field` and `--input` in the same command.6869### Output formats7071```bash72mailcoach list-email-lists # Human-readable table (default)73mailcoach list-email-lists --json # Raw JSON (useful for parsing)74mailcoach list-email-lists --yaml # YAML output75mailcoach list-email-lists --minify # Minified single-line JSON (implies --json)76mailcoach list-email-lists --H # Include response headers77mailcoach list-email-lists --output-html # Show HTML response bodies (hidden by default)78```7980Always use `--json` when you need to extract UUIDs or data from responses for use in subsequent commands.8182### Filtering, sorting, and pagination8384```bash85mailcoach list-subscribers --email-list=<uuid> --filter-search="john" --sort=email --filter-per-page=50 --filter-page=286```8788- `--filter-search`: fuzzy text search89- `--sort`: field name, prefix with `-` for descending (e.g., `--sort=-created_at`)90- `--filter-per-page`: results per page (max 100, default 15)91- `--filter-page`: page number9293### Error handling9495- **401**: Authentication failed. Run `mailcoach login` to re-authenticate.96- **422**: Validation error. The response body contains details about which fields are invalid.97- **404**: Resource not found. Verify the UUID is correct.98- **Missing path parameter**: The CLI tells you which `--option` is required.99- All errors exit with a non-zero code, so you can chain commands with `&&`.100- HTML error responses hide the body by default — add `--output-html` to see them.101102## Common workflows103104### Email lists and subscribers105- [rules/email-lists.md](rules/email-lists.md) — Create and manage email lists, tags, and segments106- [rules/subscribers.md](rules/subscribers.md) — Add, import, tag, and manage subscribers107108### Campaigns109- [rules/campaigns.md](rules/campaigns.md) — Full campaign lifecycle: create, configure, test, send, and view statistics110111### Transactional emails112- [rules/transactional.md](rules/transactional.md) — Send transactional emails via templates or inline content113114### Templates and automations115- [rules/templates.md](rules/templates.md) — Manage reusable email templates116- [rules/automations.md](rules/automations.md) — Trigger automations via the CLI117118## Important notes119120- Mailcoach is self-hosted: each user has a unique instance URL configured during `mailcoach login`121- The OpenAPI spec is cached for 24 hours. Run `mailcoach clear-cache` to force a refresh if commands seem outdated.122- UUIDs are used as resource identifiers throughout the API.123- When chaining commands (e.g., create a list then add subscribers), use `--json` to extract UUIDs from responses.