Skip to content
CirrusDocs

API reference

Emails

Send one email or a batch, and look up what became of each recipient.

Send one email.

POST/v1/emails

Needs an API key with the email:send scope. Operation sendEmail

Accepts the message and queues it; the 202 means it is certain to be attempted, not that it was delivered. At most 50 recipients in all.

Addresses at simulator.test are never delivered, with a test key or a live one: the outcome named by the part before the @ is simulated. With a live key a message may not mix them with real recipients (422 on to); send them separately. An Idempotency-Key is remembered separately for test keys and live keys, so a live request that reuses a test request's key is sent.

stream defaults to transactional. marketing and promotional need a key with campaign:write (403 stream_not_allowed otherwise) and are held to every check of the compliance engine:

  • every recipient must be a contact of the organisation who is subscribed (not pending double opt-in), has not unsubscribed or opted out of the category, is not suppressed and did not bounce or complain, whose consent was attested (basis consent; basis unknown is refused unless the deployment allows it), and who has not reached the contact-frequency limit;
  • the message must have exactly one recipient in to, cc and bcc together (422 single_recipient_required): it carries that recipient's own unsubscribe link. Use /v1/emails/batch for several people;
  • the organisation must have set its postal address (422 postal_address_not_set).

The platform makes every such message unsubscribable when it sends it: List-Unsubscribe: <https://…/api/v1/public/unsubscribe?token=…> and List-Unsubscribe-Post: List-Unsubscribe=One-Click (RFC 8058; any List-Unsubscribe or List-Unsubscribe-Post in headers is replaced, not merged), and a footer in the HTML and the text part with an unsubscribe link, a link to the recipient's email preferences and the postal address. To place these yourself, write {{unsubscribe_url}}, {{preferences_url}} and {{postal_address}} (spaces inside the braces allowed): they are filled in, HTML-escaped in the HTML part, and a part that contains {{unsubscribe_url}} gets no footer, so it must show the postal address too (422 business_identification_missing otherwise; unsubscribe_missing cannot occur unless a part lacks the link). Transactional mail is sent exactly as submitted.

A refused recipient refuses the request (403, the reason as code, the recipient in details); nothing is stored. The checks run again when the message is sent: a recipient who unsubscribed in between, by any means including the one-click link, is cancelled with the reason. Transactional mail is checked only against the organisation, the domain, the sender and the suppression list, as before.

With an Idempotency-Key, the same key and body returns the original response with Idempotent-Replayed: true and creates nothing; the same key with a different body is 422 idempotency_key_reused. Keys are kept for 24 hours.

Templates. Instead of subject, html and text, send template_id (a template of the organisation, see Templates) with template_data for its merge tags: the template's published current version is sent (422 template_not_published if it has none, 422 validation_failed for an unknown ID). The message's stream is the template's category, and a stream that is given must match it (422 template_category_mismatch). Everything above applies to the filled-in content exactly as if it had been sent as subject, html and text, the compliance checks of marketing and promotional mail included.

Parameters

  • Idempotency-Keyheaderoptional

    Makes the request safe to retry. 1 to 255 printable ASCII characters without spaces.

    string

    length 1 to 255pattern: ^[\x21-\x7e]+$

Request body

SendEmailRequestSendEmailRequest

  • fromstringrequired

    The sender, optionally with a name: Shop <orders@shop.example>. Its domain must be verified.

  • tostring or string[]required

    One email address, or a list of them. Each may carry a name, as in Ann <ann@example.org>.

  • ccstring or string[]optional

    One email address, or a list of them. Each may carry a name, as in Ann <ann@example.org>.

  • bccstring or string[]optional

    One email address, or a list of them. Each may carry a name, as in Ann <ann@example.org>.

  • reply_tostring or string[]optional

    One email address, or a list of them. Each may carry a name, as in Ann <ann@example.org>.

  • subjectstringoptional

    One line, at most 998 bytes.

  • htmlstringoptional

    The HTML body. Give html, text or both.

  • textstringoptional

    The plain text body.

  • headersobjectoptional

    Up to 20 custom headers. Only X-*, List-Unsubscribe, List-Unsubscribe-Post, In-Reply-To and References may be set. On marketing and promotional mail the platform sets List-Unsubscribe and List-Unsubscribe-Post itself and drops yours.

    other keys: string values
  • tagsobjectoptional

    Up to 10 tags. Names and values are 1 to 64 letters, digits, hyphens or underscores.

    other keys: string values
  • streamStreamoptional

    Defaults to transactional, or to the template's category with template_id; with template_id a stream that is given must be the template's category.

    One oftransactionalmarketingpromotional
  • template_iduuidoptional

    Send a template's published current version instead of subject, html and text, which must then be left out. Its merge tags are filled from template_data.

  • template_dataTemplateDataoptional

    Values for a template's merge tags: {{first_name}}, {{last_name}}, {{email}} and {{fields.<key>}}. At most 1,000 characters each and 50 fields; field values are strings, numbers or booleans. A tag with no value takes its fallback ({{first_name|there}}) or nothing.

    Show fields (4)
    • first_namestringoptional
    • last_namestringoptional
    • emailstringoptional

      Defaults to the first to address when sending.

    • fieldsobjectoptional
      other keys: string values

Responses

  • 202EmailReceipt

    The message was accepted and queued.

    • Idempotent-Replayed header: `true` when this is the stored response of an earlier request with the same `Idempotency-Key`. Absent otherwise.

    object

    • dataEmailReceiptrequired

      What the API returns for an accepted message.

      Show fields (4)
      • iduuidrequired

        Use it to look the email up later.

      • statusstringrequired
        always "queued"
      • streamStreamrequired

        The kind of email. Streams do not share sending controls.

        One oftransactionalmarketingpromotional
      • test_modebooleanrequired

        Whether a test key submitted it.

  • 400BadRequest
    • invalid_json: the body is not one JSON object, or has a field this endpoint does not accept.

    The body is the error envelope.

  • 401InvalidApiKey
    • unauthenticated: no API key was sent.
    • invalid_api_key: the key is unknown, revoked or expired.

    The body is the error envelope.

  • 403SendingRefused
    • insufficient_scope: the API key does not hold email:send.
    • account_suspended: the organisation is suspended.
    • account_closed: the organisation has been closed.
    • stream_disabled: sending on this stream has been turned off for the organisation.
    • stream_not_allowed: the key may only send transactional email.
    • domain_not_verified: the From domain is not registered or not verified.
    • domain_disabled: the From domain has been disabled.
    • sender_not_authorised: the From address may not be used.

    Marketing and promotional only, when a recipient is refused by the compliance engine (details names each refused recipient; code is the first one's reason): recipient_not_a_contact, consent_pending, consent_basis_unknown (check consent_or_lawful_basis); recipient_unsubscribed, category_opted_out (check not_unsubscribed); recipient_suppressed, contact_bounced, contact_complained (check not_suppressed); frequency_limit_reached (check contact_frequency).

    The body is the error envelope.

  • 422SendingInvalid
    • validation_failed: details names each invalid field (Idempotency-Key for a bad key).

    Marketing and promotional only (check identification_and_unsubscribe):

    • single_recipient_required: more than one recipient (each needs their own unsubscribe link);
    • postal_address_not_set: the organisation has not set its postal address;
    • business_identification_missing: a body part that places its own footer ({{unsubscribe_url}}) does not show the postal address;
    • unsubscribe_missing: a body part lacks the unsubscribe link (only possible with a customer layout).
    • idempotency_key_reused: the key was used before with a different body.
    • template_not_published: template_id names a template with no published version.
    • template_category_mismatch: stream is not the template's category.

    The body is the error envelope.

  • 429RateLimited
    • rate_limited: too many requests. Wait Retry-After seconds.
    • Retry-After header: How many seconds to wait before trying again.
    • RateLimit-Limit header: How many requests the limit that stopped this one allows per period.
    • RateLimit-Remaining header: How many requests are left in the current period.

    The body is the error envelope.

Example

Request
curl -X POST https://api.cirrusmail.example/v1/emails \
  -H "Authorization: Bearer $CIRRUS_API_KEY" \
  -H "Idempotency-Key: order-42" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Shop <orders@shop.example>",
    "to": "ann@example.org",
    "subject": "Your order is on its way",
    "text": "Thanks for your order. It will arrive on Friday."
  }'
Response 202
{
  "data": {
    "id": "b3c1f5a4-7d2e-4c8a-9a1b-0e6f2d4a8c11",
    "status": "queued",
    "stream": "transactional",
    "test_mode": false
  }
}

Set CIRRUS_API_KEY to your key. The values are examples.

Send up to 100 emails in one request.

POST/v1/emails/batch

Needs an API key with the email:send scope. Operation sendEmailBatch

All or nothing: one invalid message rejects the whole batch, with field names such as emails[3].to. The stream and idempotency rules of POST /v1/emails apply.

Parameters

  • Idempotency-Keyheaderoptional

    Makes the request safe to retry. 1 to 255 printable ASCII characters without spaces.

    string

    length 1 to 255pattern: ^[\x21-\x7e]+$

Request body

SendEmailBatchRequestSendEmailBatchRequest

  • emailsSendEmailRequest[]required
    1 to 100 items
    Show fields (13)
    • fromstringrequired

      The sender, optionally with a name: Shop <orders@shop.example>. Its domain must be verified.

    • tostring or string[]required

      One email address, or a list of them. Each may carry a name, as in Ann <ann@example.org>.

    • ccstring or string[]optional

      One email address, or a list of them. Each may carry a name, as in Ann <ann@example.org>.

    • bccstring or string[]optional

      One email address, or a list of them. Each may carry a name, as in Ann <ann@example.org>.

    • reply_tostring or string[]optional

      One email address, or a list of them. Each may carry a name, as in Ann <ann@example.org>.

    • subjectstringoptional

      One line, at most 998 bytes.

    • htmlstringoptional

      The HTML body. Give html, text or both.

    • textstringoptional

      The plain text body.

    • headersobjectoptional

      Up to 20 custom headers. Only X-*, List-Unsubscribe, List-Unsubscribe-Post, In-Reply-To and References may be set. On marketing and promotional mail the platform sets List-Unsubscribe and List-Unsubscribe-Post itself and drops yours.

      other keys: string values
    • tagsobjectoptional

      Up to 10 tags. Names and values are 1 to 64 letters, digits, hyphens or underscores.

      other keys: string values
    • streamStreamoptional

      Defaults to transactional, or to the template's category with template_id; with template_id a stream that is given must be the template's category.

      One oftransactionalmarketingpromotional
    • template_iduuidoptional

      Send a template's published current version instead of subject, html and text, which must then be left out. Its merge tags are filled from template_data.

    • template_dataTemplateDataoptional

      Values for a template's merge tags: {{first_name}}, {{last_name}}, {{email}} and {{fields.<key>}}. At most 1,000 characters each and 50 fields; field values are strings, numbers or booleans. A tag with no value takes its fallback ({{first_name|there}}) or nothing.

      Show fields (4)
      • first_namestringoptional
      • last_namestringoptional
      • emailstringoptional

        Defaults to the first to address when sending.

      • fieldsobjectoptional
        other keys: string values

Responses

  • 202

    Every message was accepted. One receipt per message, in order.

    • Idempotent-Replayed header: `true` when this is the stored response of an earlier request with the same `Idempotency-Key`. Absent otherwise.

    object

    • dataEmailReceipt[]required
      Show fields (4)
      • iduuidrequired

        Use it to look the email up later.

      • statusstringrequired
        always "queued"
      • streamStreamrequired

        The kind of email. Streams do not share sending controls.

        One oftransactionalmarketingpromotional
      • test_modebooleanrequired

        Whether a test key submitted it.

  • 400BadRequest
    • invalid_json: the body is not one JSON object, or has a field this endpoint does not accept.

    The body is the error envelope.

  • 401InvalidApiKey
    • unauthenticated: no API key was sent.
    • invalid_api_key: the key is unknown, revoked or expired.

    The body is the error envelope.

  • 403SendingRefused
    • insufficient_scope: the API key does not hold email:send.
    • account_suspended: the organisation is suspended.
    • account_closed: the organisation has been closed.
    • stream_disabled: sending on this stream has been turned off for the organisation.
    • stream_not_allowed: the key may only send transactional email.
    • domain_not_verified: the From domain is not registered or not verified.
    • domain_disabled: the From domain has been disabled.
    • sender_not_authorised: the From address may not be used.

    Marketing and promotional only, when a recipient is refused by the compliance engine (details names each refused recipient; code is the first one's reason): recipient_not_a_contact, consent_pending, consent_basis_unknown (check consent_or_lawful_basis); recipient_unsubscribed, category_opted_out (check not_unsubscribed); recipient_suppressed, contact_bounced, contact_complained (check not_suppressed); frequency_limit_reached (check contact_frequency).

    The body is the error envelope.

  • 422SendingInvalid
    • validation_failed: details names each invalid field (Idempotency-Key for a bad key).

    Marketing and promotional only (check identification_and_unsubscribe):

    • single_recipient_required: more than one recipient (each needs their own unsubscribe link);
    • postal_address_not_set: the organisation has not set its postal address;
    • business_identification_missing: a body part that places its own footer ({{unsubscribe_url}}) does not show the postal address;
    • unsubscribe_missing: a body part lacks the unsubscribe link (only possible with a customer layout).
    • idempotency_key_reused: the key was used before with a different body.
    • template_not_published: template_id names a template with no published version.
    • template_category_mismatch: stream is not the template's category.

    The body is the error envelope.

  • 429RateLimited
    • rate_limited: too many requests. Wait Retry-After seconds.
    • Retry-After header: How many seconds to wait before trying again.
    • RateLimit-Limit header: How many requests the limit that stopped this one allows per period.
    • RateLimit-Remaining header: How many requests are left in the current period.

    The body is the error envelope.

Example

Request
curl -X POST https://api.cirrusmail.example/v1/emails/batch \
  -H "Authorization: Bearer $CIRRUS_API_KEY" \
  -H "Idempotency-Key: order-42" \
  -H "Content-Type: application/json" \
  -d '{
    "emails": [
      {
        "from": "Shop <orders@shop.example>",
        "to": "ann@example.org",
        "subject": "Your order",
        "text": "Thanks, Ann."
      },
      {
        "from": "Shop <orders@shop.example>",
        "to": "bo@example.org",
        "subject": "Your order",
        "text": "Thanks, Bo."
      }
    ]
  }'
Response 202
{
  "data": [
    {
      "id": "b3c1f5a4-7d2e-4c8a-9a1b-0e6f2d4a8c11",
      "status": "queued",
      "stream": "transactional",
      "test_mode": false
    }
  ]
}

Set CIRRUS_API_KEY to your key. The values are examples.

Get an email with the status of each recipient.

GET/v1/emails/{emailID}

Needs an API key with the email:read scope. Operation getEmail

Parameters

  • emailIDpathrequired

    The ID returned when the email was submitted.

    uuid

Responses

  • 200Message

    The message with its recipients. Never the body.

    object

    • dataMessagerequired

      A submitted email. The body is never returned.

      Show fields (11)
      • iduuidrequired
      • statusMessageStatusrequired

        The status its recipients share, or mixed when they differ.

        One ofqueuedsendingsentdelayeddeliveredbouncedcomplainedcancelledfailedunknownmixed
      • reasonstringoptional

        Why the message was cancelled or failed, as a code. Absent otherwise. A message cancelled by the compliance engine carries the reason of its first recipient; see MessageRecipient.reason.

      • streamStreamrequired

        The kind of email. Streams do not share sending controls.

        One oftransactionalmarketingpromotional
      • fromstringrequired

        The sender's address.

      • subjectstringrequired
      • tostringrequired

        The first recipient; recipient_count says how many there are.

      • recipient_countintegerrequired
      • test_modebooleanrequired
      • submitted_atdate-timerequired

        When the API accepted the request.

      • recipientsMessageRecipient[]optional

        The status of each recipient. Left out of lists.

        Show fields (11)
        • emailstringrequired
        • typestringrequired
          One oftoccbcc
        • statusRecipientStatusrequired

          Where one recipient's copy is: queued, sending, sent (the provider accepted it), delayed (soft bounce), delivered (the recipient's mail server accepted it), bounced (hard bounce), complained, cancelled (stopped by a sending rule; see reason), failed (the provider refused it) or unknown (the provider's answer was lost).

          One ofqueuedsendingsentdelayeddeliveredbouncedcomplainedcancelledfailedunknown
        • reasonstringoptional

          Why this recipient was cancelled or failed. Absent otherwise. A recipient cancelled by the compliance engine at the moment of sending carries one of its reason codes, each belonging to one of the eight checks:

          • account_and_domain_active: account_suspended, account_closed, organisation_not_active,

          stream_disabled, domain_not_registered, domain_not_verified, domain_disabled;

          • sender_authorised: sender_not_authorised;
          • consent_or_lawful_basis: recipient_not_a_contact, consent_pending, not_on_list,

          consent_basis_unknown;

          • not_unsubscribed: recipient_unsubscribed, category_opted_out, list_opted_out;
          • not_suppressed: recipient_suppressed, contact_bounced, contact_complained;
          • contact_frequency: frequency_limit_reached;
          • sending_allowance: quota_exceeded, campaign_paused;
          • identification_and_unsubscribe: single_recipient_required, unsubscribe_missing, postal_address_not_set,

          business_identification_missing.

        • accepted_atdate-timerequiredcan be null

          When the email provider accepted the message.

        • delivered_atdate-timerequiredcan be null

          When the recipient's mail server accepted it. Not proof that it reached the inbox or was read.

        • hard_bounced_atdate-timerequiredcan be null
        • soft_bounced_atdate-timerequiredcan be null
        • complained_atdate-timerequiredcan be null
        • cancelled_atdate-timerequiredcan be null
        • failed_atdate-timerequiredcan be null
  • 401InvalidApiKey
    • unauthenticated: no API key was sent.
    • invalid_api_key: the key is unknown, revoked or expired.

    The body is the error envelope.

  • 403InsufficientScope
    • insufficient_scope: the API key does not hold the scope this operation needs.
    • account_suspended: the organisation is suspended; none of its keys work until that is lifted.
    • account_closed: the organisation has been closed; none of its keys will work again.

    The body is the error envelope.

  • 404NotFound
    • not_found: the resource does not exist, or belongs to an organisation the caller is not a member of.

    The two are not told apart, so IDs cannot be probed.

    The body is the error envelope.

  • 429RateLimited
    • rate_limited: too many requests. Wait Retry-After seconds.
    • Retry-After header: How many seconds to wait before trying again.
    • RateLimit-Limit header: How many requests the limit that stopped this one allows per period.
    • RateLimit-Remaining header: How many requests are left in the current period.

    The body is the error envelope.

Example

Request
curl https://api.cirrusmail.example/v1/emails/b3c1f5a4-7d2e-4c8a-9a1b-0e6f2d4a8c11 \
  -H "Authorization: Bearer $CIRRUS_API_KEY"
Response 200
{
  "data": {
    "id": "b3c1f5a4-7d2e-4c8a-9a1b-0e6f2d4a8c11",
    "status": "queued",
    "reason": "string",
    "stream": "transactional",
    "from": "Shop <orders@shop.example>",
    "subject": "Your order",
    "to": "string",
    "recipient_count": 0,
    "test_mode": false,
    "submitted_at": "2026-01-15T09:30:00Z",
    "recipients": [
      {
        "email": "ann@example.org",
        "type": "to",
        "status": "queued",
        "reason": "string",
        "accepted_at": "2026-01-15T09:30:00Z",
        "delivered_at": "2026-01-15T09:30:00Z",
        "hard_bounced_at": "2026-01-15T09:30:00Z",
        "soft_bounced_at": "2026-01-15T09:30:00Z",
        "complained_at": "2026-01-15T09:30:00Z",
        "cancelled_at": "2026-01-15T09:30:00Z",
        "failed_at": "2026-01-15T09:30:00Z"
      }
    ]
  }
}