Guides
Sending email
Everything a request can carry, what comes back, and how to follow a message to its end.
Send one email#
POST /v1/emails needs a key with the email:send scope. The smallest message has a from, a to, a subject and a body. The sender must be at a verified domain.
curl -X POST https://api.cirrusmail.example/v1/emails \
-H "Authorization: Bearer $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Shop <orders@shop.example>",
"to": ["ann@example.org", "bo@example.org"],
"cc": "accounts@shop.example",
"reply_to": "support@shop.example",
"subject": "Order 42 has shipped",
"html": "<p>Your order <strong>42</strong> has shipped.</p>",
"text": "Your order 42 has shipped.",
"headers": {"X-Order-Id": "42"},
"tags": {"kind": "shipping", "order": "42"}
}'The answer is 202 Accepted with an id and the status queued. The 202 means the email is certain to be attempted, not that it was delivered: delivery is reported afterwards, as described below.
What a request can carry#
| Field | Type | Notes |
|---|---|---|
from | string | Required. The sender, optionally with a name: Shop <orders@shop.example>. Its domain must be verified. |
to | string or list | Required. One address, or a list. Each may carry a name, as in Ann <ann@example.org>. |
cc | string or list | Copied recipients. |
bcc | string or list | Blind-copied recipients. |
reply_to | string or list | Where replies go. |
subject | string | One line, at most 998 bytes. Required unless you send a template. |
html | string | The HTML body. Give html, text or both; together they may total 400 KB. |
text | string | The plain-text body. Sending both is best: mail apps that cannot show HTML use this. |
headers | object | Up to 20 custom headers. Only X-*, List-Unsubscribe, List-Unsubscribe-Post, In-Reply-To and References may be set. |
tags | object | Up to 10 tags. Names and values are 1 to 64 letters, digits, hyphens or underscores. |
stream | string | transactional (the default), marketing or promotional. See Marketing and promotional email. |
template_id | uuid | Send a template instead of subject and body. See below. |
template_data | object | The values for the template's merge tags. |
- A message has at most 50 recipients in
to,ccandbcctogether. - The whole request body may be at most 1 MB (
413 body_too_large). The API does not take attachments. - Unknown fields are rejected with
400 invalid_json, not ignored, so a misspelt field never goes unnoticed. - Open and click tracking applies to marketing and promotional email only. Transactional mail is sent exactly as you submit it.
Send up to 100 at once#
POST /v1/emails/batch takes { "emails": [ … ] } with between 1 and 100 messages, each shaped like a single send. It is all or nothing: if one message is invalid the whole batch is refused, and the problem names the field, such as emails[3].to. You get one receipt per message, in the same order.
curl -X POST https://api.cirrusmail.example/v1/emails/batch \
-H "Authorization: Bearer $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: shipping-2026-01-15" \
-d '{"emails": [
{"from": "Shop <orders@shop.example>", "to": "ann@example.org", "subject": "Order 42 has shipped", "text": "Hello Ann."},
{"from": "Shop <orders@shop.example>", "to": "bo@example.org", "subject": "Order 43 has shipped", "text": "Hello Bo."}
]}'Marketing and promotional messages must each have exactly one recipient, so a batch is how you send them to several people.
Send a template#
Instead of subject, html and text, send template_id, the ID of a template you made in the dashboard, with template_data for its merge tags. The template's published current version is used.
curl -X POST https://api.cirrusmail.example/v1/emails \
-H "Authorization: Bearer $CIRRUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Shop <orders@shop.example>",
"to": "ann@example.org",
"template_id": "5e1c0b52-3f43-4a0c-8a7e-9d2c1e6f7a10",
"template_data": {"first_name": "Ann", "fields": {"order_number": 42}}
}'- Merge tags are
{{first_name}},{{last_name}},{{email}}and{{fields.<key>}}. A tag with no value takes its fallback,{{first_name|there}}, or nothing. emaildefaults to the firsttoaddress. Each value is at most 1,000 characters, and there are at most 50 fields.- The message's stream is the template's category. If you also give
stream, it must match (422 template_category_mismatch). A template with no published version is422 template_not_published. - Everything above applies to the filled-in content exactly as if you had sent it written out.
When a send is refused#
A request that cannot be accepted gets an error and creates nothing. The ones you will meet most often:
| Answer | Code | What to do |
|---|---|---|
| 403 | domain_not_verified | The From domain is not registered or not verified. See Domains and DNS. |
| 403 | domain_disabled | The From domain has been disabled. |
| 403 | sender_not_authorised | The From address may not be used: your organisation limits which addresses at the domain can send. |
| 403 | stream_disabled | Sending on this stream has been turned off for your organisation. |
| 403 | stream_not_allowed | The key may only send transactional email. A key needs campaign:write for the other streams. |
| 422 | validation_failed | One or more fields are invalid; details names each. |
| 422 | idempotency_key_reused | The Idempotency-Key was used before with a different body. |
The complete list is in Errors.
Follow a message to its end#
There are three ways to learn what became of an email, from simplest to most efficient.
Ask for the email#
GET /v1/emails/{id} (scope email:read) returns the message and the state of each recipient, with a timestamp for each thing that happened to them: accepted, delivered, hard-bounced, soft-bounced, complained, cancelled and failed. It never returns the body of the email.
Read the events#
GET /v1/events lists delivery events, newest first, for everything or for one email with ?email_id=. It is paginated: see Pagination.
Be told#
Register a webhook and Cirrus calls you for each event. This is the right choice once you send in volume.
Recipient statuses#
Each recipient has its own status. The email's status is the one its recipients share, or mixed when they differ. When a recipient is cancelled or failed, a reason code says why. Statuses only move forward: a late “sent” never overwrites “delivered”.
| Status | Meaning |
|---|---|
queued | Accepted by the API and waiting to be sent. |
sending | A worker is handing it to the email provider. |
sent | The email provider accepted it. Delivery events follow. |
delayed | A soft bounce: the receiving server could not take it yet. A later event may still deliver it. |
delivered | The recipient's mail server accepted it. This is not proof that it reached the inbox or was read. |
bounced | A hard bounce: the address does not exist or refuses the mail. The address is suppressed. |
complained | The person marked it as spam. The address is suppressed. |
cancelled | Stopped by a sending rule before it left. The recipient's reason says which rule. |
failed | The email provider refused it. |
unknown | The provider's answer was lost, so Cirrus cannot tell whether it was sent. It is never sent a second time; a later delivery event may update it. |
What happens after the 202#
Cirrus checks the message again at the moment of sending, not only when you submit it: the domain, the sender, the stream, the suppression list and your allowance. A recipient stopped by one of those is cancelled on its own, with a reason, and the others are sent. If the email provider is briefly unavailable, Cirrus retries by itself, up to six times with growing waits. If the provider's answer is lost, the recipient becomes unknown and is never retried, so you can never get a duplicate from a guess.