Send Transactional Email
Send an email such as an account activation, password reset or receipt directly from your code, with your own HTML. No automation or campaign is needed, so one request can cover every language or variant your application supports.
- Approval required. Transactional Email is off for new workspaces. Request access in the dashboard under Transactional Email: tell us your use case, message types, expected monthly volume, website and desired hourly limit. This opens a ticket with our team, who enable the feature and set your hourly limit.
- The
subject,html,textandpreview_textare rendered with the templating engine, with yourdataobject available as{{data.*}}. - Each recipient (
to, everyccand everybcc) counts as one email against your plan's monthly email limit and your workspace's Transactional Email hourly limit, so 500 recipients count as 500 emails. The hourly limit is separate from the campaign hourly limit. Accorbcccopy we can't hand to our mail servers after retries is refunded to your monthly limit and listed infailed_recipients. - Open and click tracking are off unless you turn them on with
track_opensandtrack_clicks. - Logs and content are kept for 30 days. Daily statistics are kept permanently. Attachments are never stored: only their filename, content type and size are logged.
Use a workspace API key in the Authorization: Bearer YOUR_API_KEY header. Keep the key on your server. API requests share the workspace's 100-requests-per-second limit.
Endpoint
POST https://api.campaignlark.com/v1/emails/send
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
from | object | required | { "email": "hello@yourdomain.com", "name": "Your App" }. The address is trimmed and lowercased, and its domain must be one of your verified domains. It doesn't need to be a sender identity. name is optional. |
reply_to | object | optional | { "email", "name" }. Any valid address; name is optional. |
to | object | required | { "email": "jane@example.com", "name": "Jane" }. name is optional. |
cc | array | optional | Recipients as { "email", "name" } objects. Shown to all recipients. |
bcc | array | optional | Recipients as { "email", "name" } objects. Never shown in the message headers. |
subject | string | required | Single line, at most 255 characters. Templated. |
html | string | required | At most 1 MB. Templated. |
text | string | optional | Plain-text part, at most 1 MB. Templated. Generated from html when omitted. |
preview_text | string | optional | Inbox preview text, at most 255 characters. Templated. |
data | object | optional | Any JSON values, available in templates as {{data.*}}. |
headers | object | optional | Up to 20 custom headers as { "X-Header": "value" }. Names may contain letters, digits and hyphens; values must be a single line. |
attachments | array | optional | { "filename", "content", "content_type" } objects. content is base64. At most 10 MB in total after decoding. content_type is optional and detected from the filename when omitted. |
track_opens | boolean | optional | Add an open-tracking pixel. Default false. |
track_clicks | boolean | optional | Rewrite links for click tracking. Default false. |
add_unsubscribe_header | boolean | optional | Add List-Unsubscribe with one-click unsubscribe and enable {{actions.unsubscribe_url}}. Default false. See Unsubscribe. |
reference | string | optional | Your own reference, at most 100 characters, such as a user ID. Not an idempotency key. |
At most 500 recipients in total across to, cc and bcc.
Headers that CampaignLark sets can't be overridden: From, To, Cc, Bcc, Subject, Reply-To, Date, Message-ID, Return-Path, MIME-Version, Content-*, List-Unsubscribe*, DKIM-Signature and X-Tracking-ID.
The full request body must also fit within the API's request size limit; base64 makes attachments about a third larger than their decoded size.
Contacts
You don't pass a contact ID. If the to address matches one of your contacts (case-insensitive), the email is linked to that contact:
{{contact.*}}fields are available in templates.- Opens, clicks, bounces and complaints update the contact.
Sending is rejected if any to, cc or bcc address belongs to a contact that hard-bounced (CLEANED) or marked an email as spam (COMPLAINED). Unsubscribed contacts can still receive transactional email unless you set add_unsubscribe_header.
Unsubscribe
With add_unsubscribe_header: true:
- The
toaddress must match an existing contact, otherwise the request is rejected. - The request is rejected if that contact is unsubscribed.
- The email gets
List-UnsubscribeandList-Unsubscribe-Postheaders, and{{actions.unsubscribe_url}}is available in templates. Unsubscribing updates the contact.
Without the flag, no unsubscribe header is added and the contact's subscription status is ignored.
Templating
Available variables: data.*, contact.* (when linked), workspace.*, misc.server_time, preview_text, and actions.unsubscribe_url (with add_unsubscribe_header). All helpers work. Template syntax is checked when you send, so a broken template returns 400 instead of failing later.
One request can cover every language:
Sample Request
POST https://api.campaignlark.com/v1/emails/send
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"from": { "email": "hello@yourdomain.com", "name": "Your App" },
"to": { "email": "jane@example.com", "name": "Jane" },
"bcc": [{ "email": "audit@example.com" }],
"subject": "{{#if (eq data.language \"de\")}}Aktiviere dein Konto{{else}}Activate your account{{/if}}",
"html": "<p>{{#if (eq data.language \"de\")}}Hallo{{else}}Hi{{/if}} {{data.name}}, <a href=\"{{data.link}}\">activate</a>.</p>",
"data": { "language": "de", "name": "Jane", "link": "https://app.example.com/activate/abc" },
"headers": { "X-Entity-Ref-ID": "user-42" },
"attachments": [{ "filename": "welcome.txt", "content": "V2VsY29tZSB0byBDYW1wYWlnbkxhcmsh", "content_type": "text/plain" }],
"track_clicks": true,
"reference": "user-42"
}
Response
Success — 201 Created
{
"data": {
"id": "69b2a1f0be03b743d4b9b7c1",
"status": "QUEUED",
"to": "jane@example.com",
"subject": "Aktiviere dein Konto",
"contact_id": "69a01c2fbe03b743d4b90011",
"reference": "user-42",
"track_opens": false,
"track_clicks": true,
"add_unsubscribe_header": false,
"created_at": "2026-11-26T09:00:00Z"
}
}
The response confirms queuing, not delivery. Save id to retrieve the email. contact_id is null when to doesn't match a contact. Subscribe to transactional_email.* webhooks for delivery notifications.
Errors
Application errors return 400 Bad Request unless listed otherwise:
{
"error": {
"message": "Transactional Email isn't enabled for this workspace. Request access on the Transactional Email page in the dashboard."
}
}
| Status | Message | Cause |
|---|---|---|
400 | We couldn't read the request. Please send valid JSON with from, to, subject and html. | The body could not be parsed. |
400 | Transactional Email isn't enabled for this workspace. Request access on the Transactional Email page in the dashboard. | The workspace hasn't been approved for Transactional Email. |
400 | Your workspace must be verified before sending email. ... | The workspace is not approved. |
400 | This workspace is suspended. Please contact support for assistance. | The workspace is suspended. |
400 | You can only send from a verified domain in this workspace. ... | The from domain isn't in this workspace, or its SPF or DKIM isn't verified. |
400 | Please provide a valid from email address. | from is missing or malformed (same for reply_to). |
400 | Please provide a valid to email address. | An address is missing or malformed (same for cc and bcc). |
400 | You can send to at most 500 recipients in total across to, cc and bcc. | Too many recipients. |
400 | Please provide a single-line subject between 1 and 255 characters. | Subject missing, too long or multi-line. |
400 | Please provide html content up to 1 MB. | HTML missing or too large. |
400 | The html has a templating error: ... Fix the template syntax and try again. | Invalid template syntax (same for subject, text, preview_text). |
400 | The Subject header is set by CampaignLark and can't be overridden. | A reserved custom header was supplied. |
400 | Attachments can be at most 10 MB in total. | Decoded attachments exceed 10 MB. |
400 | We can't send to jane@example.com because the address hard-bounced. | A recipient is a cleaned contact. |
400 | We can't send to jane@example.com because the recipient marked an email as spam. | A recipient is a complained contact. |
400 | Your plan's monthly email limit has been reached. Upgrade your plan to send more emails. | Not enough monthly emails left for all recipients. |
429 | You've reached your hourly limit of 100 transactional emails. Try again after 10:00 UTC or ask support to raise it. | The Transactional Email hourly limit would be exceeded. |
401 | Please provide a valid API key in the Authorization header. | No API key. |
401 | The API key you provided is invalid or has been revoked. | Invalid or revoked API key. |
429 | You have exceeded the rate limit of 100 requests per second. Please try again later. | The workspace API rate limit was exceeded. |
The hourly limit is counted per UTC clock hour and per recipient. Do not automatically resend after an uncertain response: each successful request sends a new email, even with the same reference.