Skip to content
CirrusDocs

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#

Fields of a send request
FieldTypeNotes
fromstringRequired. The sender, optionally with a name: Shop <orders@shop.example>. Its domain must be verified.
tostring or listRequired. One address, or a list. Each may carry a name, as in Ann <ann@example.org>.
ccstring or listCopied recipients.
bccstring or listBlind-copied recipients.
reply_tostring or listWhere replies go.
subjectstringOne line, at most 998 bytes. Required unless you send a template.
htmlstringThe HTML body. Give html, text or both; together they may total 400 KB.
textstringThe plain-text body. Sending both is best: mail apps that cannot show HTML use this.
headersobjectUp to 20 custom headers. Only X-*, List-Unsubscribe, List-Unsubscribe-Post, In-Reply-To and References may be set.
tagsobjectUp to 10 tags. Names and values are 1 to 64 letters, digits, hyphens or underscores.
streamstringtransactional (the default), marketing or promotional. See Marketing and promotional email.
template_iduuidSend a template instead of subject and body. See below.
template_dataobjectThe values for the template's merge tags.
  • A message has at most 50 recipients in to, cc and bcc together.
  • 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.
  • email defaults to the first to address. 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 is 422 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:

Common refusals when sending
AnswerCodeWhat to do
403domain_not_verifiedThe From domain is not registered or not verified. See Domains and DNS.
403domain_disabledThe From domain has been disabled.
403sender_not_authorisedThe From address may not be used: your organisation limits which addresses at the domain can send.
403stream_disabledSending on this stream has been turned off for your organisation.
403stream_not_allowedThe key may only send transactional email. A key needs campaign:write for the other streams.
422validation_failedOne or more fields are invalid; details names each.
422idempotency_key_reusedThe 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”.

Recipient statuses
StatusMeaning
queuedAccepted by the API and waiting to be sent.
sendingA worker is handing it to the email provider.
sentThe email provider accepted it. Delivery events follow.
delayedA soft bounce: the receiving server could not take it yet. A later event may still deliver it.
deliveredThe recipient's mail server accepted it. This is not proof that it reached the inbox or was read.
bouncedA hard bounce: the address does not exist or refuses the mail. The address is suppressed.
complainedThe person marked it as spam. The address is suppressed.
cancelledStopped by a sending rule before it left. The recipient's reason says which rule.
failedThe email provider refused it.
unknownThe 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.