domains commands let you add and verify sending domains; this page covers their arguments and flags.
Before running the examples, log in with an API key that has the domains:read and domains:write scopes, plus domains:delete:all for the delete example, and replace example.com with a domain you own and can add DNS records for.
Overview
list- List domainscreate- Create a domain for email sendingget- Get a domainverify- Show a domain’s DNS statuscheck-dns- Trigger a DNS validation check for a domainupdate- Update a domain’s settingsdelete- Delete a domain
domains check-dns until the DNS is valid.
List Domains
List the domains in your account with their DNS status and sending type.--status pending and --status failed both list the domains whose DNS is not valid.
Pages work as Lists and Pagination describes.
Create Domain
--non-interactive, or when stdin is not a terminal, a missing domain fails with exit code 4.
The command prints the domain on stdout. The records the domain needs go to stderr, as setup instructions. Each record is marked required or optional. Add every required record. Add an optional record only for the feature its note names: for example, the MX record sends inbound email to AhaSend for inbound routes, which changes where email to that name is delivered. For each record, see domain setup.
--sending-type marketing, on create and update, needs marketing features on your account. Without them, the API answers 400 sending_type must be transactional, and the command fails with exit code 4.
Export DNS Records
--format replaces the setup instructions with the records in a provider format: bind, cloudflare or terraform (version 5 of the Cloudflare Terraform provider). The records also go to stderr. Table output puts a header line above them; plain and CSV output write no header, so you can save the records with 2>:
; in BIND, # in the other formats) comes before each optional record, and before the SPF and DMARC records, to say what the record is for or how to add it. The optional records include an MX record for inbound routes. The Terraform resources set zone_id = var.zone_id, so declare a zone_id variable in your configuration.
--format cannot be used with --no-dns-help or --output json, which print no records. Both combinations fail with exit code 4 before any request.
With --output json, the command prints the API’s response body unchanged and writes no DNS instructions.
Verify Domain
domains verify shows a domain’s DNS status as of its last DNS check. It does not check the DNS again.
--show-records prints the setup instructions for a valid domain too. --output json leaves them out. The command exits with code 0 whether or not the DNS is valid.
Check DNS
After you change the DNS records, rundomains check-dns. It runs a new DNS check. When the domain was checked within the last 60 seconds, the API returns the cached result instead.
domains verify.
Most records verify within minutes. DNS changes can take up to 48 hours to propagate.
Get Domain Details
Show a domain’s DNS status and records, sending type, custom subdomains, DKIM selector and DKIM rotation interval. For a paused domain, the output also shows when and why it was paused.Update Domain
Change a domain’s settings. Only the flags you give are sent; other settings stay as they are. These examples change how a live domain sends, so try them on a test domain, and note the current values withdomains get first so you can set them back.
- Each subdomain must be one DNS label: 1-63 letters, digits and hyphens, without a leading or trailing hyphen. Subdomains lock after DNS verification; to change a locked subdomain, contact support.
--dkim-selectorworks on Platform Partner accounts only. An empty value clears it. The selector also locks after DNS verification, so the empty-value example works only on a domain that is not verified; to change a locked selector, contact support. The selector cannot change while a DKIM key rotation is in progress.--dkim-rotation-intervaltakes 30 to 180 days.--sending-type marketingneeds marketing features on your account, as Create Domain describes. A sending type change applies to new messages within five minutes.
Delete Domain
--force (-f) skips it.
The DNS records you added stay with your DNS provider. Remove them there when you no longer need them.
Common DNS Setup
Existing SPF Records
A domain can have only one SPF record. If you already have one, add the AhaSendinclude: term to it instead of adding a second record:
_dmarc.example.com already has one, keep it instead of adding the AhaSend one.
Subdomains
You can add subdomains for sending:Command Flags
These flags come from the CLI’s--help. All commands also accept the global flags.

