Skip to main content

Send

MethodPathScopeSDK
POST/api/v1/sendsendmailroom.send

Renders one template and sends one email. For many recipients use campaigns or sequences instead of looping.

Request

FieldTypeNotes
templatestringRequired. Registry key; must be enabled for the project/brand.
tostringRecipient email. Required unless contactId is given.
contactIduuidSend to an existing contact. Takes precedence over to.
typetransactional | marketingDefaults to the template's declared type.
subjectstringOverrides the project default and the template default.
dataobjectVariables the template renders. See Templates.
brandstringBrand slug; falls back to the contact's brand, then the project default.
fromobject{ email, name? } — must sit on a verified sending domain.
idempotencyKeystringAlso accepted as the Idempotency-Key header.
curl -X POST https://mailroom.example.com/api/v1/send \
-H "Authorization: Bearer pk_live_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: receipt:ord_123" \
-d '{
"to": "ada@example.com",
"template": "receipt",
"type": "transactional",
"data": { "orderNumber": "1043", "lineItems": [{ "name": "Widget", "price": "12.00" }] }
}'

Response

{ "ok": true, "id": "3f8b1c0a-…" }

id is the delivery provider's message id — the same value that appears as resend_id on the send log row. It is absent only if the provider accepted the mail without returning one.

Marketing sends create contacts

With type: "marketing", Mailroom needs a contact to anchor the per-recipient unsubscribe link, so an unknown to address is upserted into the contact list before sending. List-Unsubscribe and List-Unsubscribe-Post headers are set and unsubscribeUrl is injected into the template. Transactional sends get neither.

Errors

StatuscodeCause
422invalid_requestPayload failed validation, or neither to nor contactId was given
404not_foundcontactId does not exist in this project
422no_brandThe project has no brand to send under
422unknown_templateNo such template for this project/brand
422template_not_enabledTemplate exists but is not enabled
422invalid_contentPublished content does not satisfy the template schema
422send_failedProvider rejected it, rendering failed, or the recipient is suppressed
403email_unverifiedThe organization owner's email is not verified yet
429Rate limited; honour Retry-After

A suppressed recipient is a send_failed with "recipient is suppressed", and the attempt is written to the send log with status: "failed" — check suppressions before treating it as a delivery fault.