Send Email
A polymorphic endpoint for sending email messages to one or more recipients. The endpoint is designed to feel natural in use:
- Start simple with a basic email to a single address.
- Gradually add data to enable complex communications to multiple contacts.
- Optionally supply a template, upsert contacts with profile data, provide merge data at either the template or contact level, add CC/BCC, attach files, and more.
The response includes a request_id and an array of per-recipient
EmailMessageResult objects describing each message created in the process.
Check out the examples with their responses for common use cases, and browse the full input schema to see everything that’s possible with the Send API.
Authorizations
Provide your BetterMail API key as a Bearer token: Authorization: Bearer YOUR_API_KEY. You can generate and manage API keys in the Developer Centre [https://bettermail.app/developer-centre/api] in your BetterMail account.
Body
User-defined, human-friendly key that uniquely identifies a campaign within an account. You can create this key when launching a transactional campaign.
^[A-Za-z0-9-_]{3,40}$"WELCOME_EMAIL"
Single recipient object, an RFC 5322 email address string, or an array containing both.
Arbitrary key-value pairs to upsert/merge into the recipient's profile and to use for template personalization.
{
"first_name": "Emily",
"loyalty": { "level": "gold", "points": 1200 },
"marketing_opt_in": true
}Unified per-message override for email, layered on top of your transactional campaign's defaults. Use this object to override corresponding campaign parts (e.g., from/reply-to/subject/bodies) without changing the campaign itself.
Precedence & merge rules
- Request level applies to all recipients.
- Recipient level, when provided, overrides request level.
- Unset fields fall back to the campaign template values.
- Arrays (
cc,bcc) replace (no merge). headersare merged, with recipient-level keys winning on conflict.- Restricted/system headers (From/To/Cc/Bcc/Subject/Reply-To/In-Reply-To, Content-Type, MIME-Version) must not be set here; they will be ignored.
Bodies & formats
textis the plain-text email body.htmlis rich content and supports BML.
Attachments applied to all recipients.
Recipient-level attachments (if any) are additive.
Size limit: The sum of all attachments for each message (request-level + recipient-level + any unreferenced multipart binaries auto-attached) must not exceed 10 MB. For base64 data, the decoded byte size is used; for multipart files, the uploaded part size is used; for URLs, the fetched content size is used.
In multipart/form-data requests, streamed files can be referenced via file_ref.
Any unreferenced binary parts are auto-attached to each
email message using their filename and content type.
1 - 10 elementsUnion of supported attachment types. In multipart/form-data requests, any unreferenced binary parts are auto-attached to each email message using their filename and content type.
- Option 1
- Option 2
- Option 3