RavenRelayDocs
Dashboard ↗

API reference / Sending

Send an email

POST /v1/emails accepts a message for durable, asynchronous processing.

POST/v1/emails
Authentication & request headers
AuthorizationBearer tokenrequired
Your project API key. Keep it on your server. Use an rr_test_ key to simulate sending without delivering email.
Idempotency-Keystring
An optional, project-scoped operation key. Reuse it with an identical body after a timeout to avoid creating duplicate emails.

Body parameters

fromstringrequired
Required. Any syntactically valid address in Test; Address or Name <address> on the exact verified project domain in Live.
tostring | string[]required
Required. At least one recipient.
subjectstringrequired
Required. 1–998 characters; no line breaks.
text / htmlstring
At least one nonempty body.
cc / bccstring | string[]
Optional. Maximum 50 recipients across To, CC and BCC.
reply_tostring
Optional mailbox.
headersobject
Optional custom headers. Reserved transport headers are rejected.
tagsobject
Up to 20 ASCII tags. Names beginning rr_ are reserved.
metadataobject
Optional application data, retained in RavenRelay.
attachmentsarray
Optional. Up to 20 files. Each item needs filename plus either base64 content or an HTTPS path URL (fetched once at admission). Optional content_type. Included in the 10 MiB limit after fetch.

The JSON message limit is 10 MiB, including base64 attachment content. Saved template sends are supported; see Email templates with React or Vue. Scheduled sends and batch sends are not supported by this endpoint.

Response

The worker processes the message after admission. The response does not confirm provider acceptance or delivery. In Test, ordinary addresses finish as simulated and reserved sandbox addresses produce deterministic simulated outcomes.

For Live sends, an active workspace suppression stores the entire message as suppressed without a queue job or monthly quota charge. Test ignores live suppressions; use suppressed@sandbox.getravenrelay.com to simulate that outcome.

Retry safely with idempotency

Set Idempotency-Key to a unique application operation ID, using 1–128 printable ASCII characters. Reuse the same key and identical body after a timeout. Keys are scoped to the project.

A replay sends nothing new. It returns HTTP 200 with the Idempotent-Replayed: true header, the original email ID and that email’s current status, so it may show sent or delivered once processing has advanced. Reusing a key with a changed body returns 409 idempotency_conflict. The Node SDK does not automatically retry sends.

Send in batches

POST/v1/emails/batch
Idempotency-Keyheaderrequired
Required for batch requests. Identical retries return the same batch; changed input returns 409.
emailsobject[]required
1–1,000 individual send bodies. Each has its own recipients, subject and content, or a saved template and variables. Every item gets its own email ID and tracking.
attachmentsobject[]
Shared attachments, supplied once and included in every message. Up to 20 shared and individual files combined per email. The batch shares a 10 MiB expanded-content budget.

POST /v1/emails/batch durably accepts up to 1,000 messages and returns a batch_id immediately. Each message becomes its own email with its own ID, timeline, webhooks and open tracking. Batch messages queue behind single sends. Idempotency-Key is required; use the same key and identical ordered request after a timeout to get the same batch. Changing the messages or shared attachments under that key returns 409.

Supply common attachments once at the batch level. They are included in every email, before that email’s individual attachments, with a combined maximum of 20 files per email. Identical file descriptors are stored and fetched once per batch. The request has a 10 MiB JSON limit; rendered bodies plus unique attachments after fetching also share a 10 MiB budget. Shared files count once toward that budget, although each outgoing email carries its own copy and normal recipient/attachment usage still applies. URLs must remain accessible until the worker fetches them.

Completed means admission has finished, not that all emails have been delivered. Each accepted email follows the ordinary asynchronous delivery flow and domain open-tracking setting. Syntax and template errors reject the request before it is stored. HTTP 400 includes every detected error in error.issues, with its zero-based message index, field path, code and message. Shared attachment errors have index null. Fix all reported errors and reuse the same idempotency key; nothing was queued. The Node SDK exposes this array on RavenRelayError.issues. Templates are snapshotted at submission. Later domain, revocation or attachment failures during batch preparation are per-item results. Once queued, quota exhaustion is recorded on the email as failed with failureCode quota_exceeded and emits email.failed. Failed items are final: inspect them and submit corrected items with a new key. A retry of the original batch only returns that batch, without restarting failed items. Unfinished items expire after seven days. A batch counts as one request toward rate limits; monthly quota counts every admitted To, CC and BCC recipient. Each workspace can have at most 10 unfinished batches; further submissions return 429 until processing makes room.

Retrieve batch progress

GET/v1/emails/batch/{id}

Read the batch’s admission progress and per-message results. Each accepted item has its own email ID for delivery details, open tracking and webhooks.

idstringrequired
The batch_id returned when the batch was submitted. Passed in the URL path.
offsetinteger
Zero-based result offset, from 0 to 1,000. Defaults to 0. Each page returns up to 100 results; use next_offset to continue.

GET /v1/emails/batch/:id returns progress and up to 100 results in original order, with a zero-based index and next_offset. Pending items have status pending. Accepted items have their email ID and current delivery status; rejected items contain an error. Send-only keys can read their own batches, while email:read keys can read their project's batches. Bodies and attachment bytes are omitted.

Quotas and rate limits

Test and Live have separate allowances. Each Test key can simulate 100,000 emails per UTC month, within a 500,000-email Test workspace ceiling. Each To, CC and BCC address counts as one email toward its mode’s allowance. The worker also observes provider rate and daily limits. Suppressed Live sends and idempotent replays do not add monthly usage. Exhausted quota marks the email failed with failureCode quota_exceeded and emits email.failed with data.reason quota_exceeded. Check GET /v1/emails/{id} or the Emails dashboard. Batch submission retains its existing request-rate and unfinished-batch limits.

Examples use illustrative email IDs. Accepted requests are processed asynchronously.