Emails
The send routes send transactional emails: one recipient each, triggered by something the person did (a password reset, a receipt, an invitation). Transactional emails explained. The read routes cover every email of the space, campaigns and flows included.
Content modes:
- a template written in the dashboard, with variables (recommended);
- markdown, wrapped in your space's email design;
- blocks, a laid-out email in the email format, wrapped in the same design;
- raw html and/or text, sent as given.
Send an email
POST /v1/emails
Queues one email, usually sent within seconds. Allowed with a sending access key.
ada@example.com or Ada Lovelace <ada@example.com>.Name <address> or an address. It must use a verified domain of the space. Defaults to the template sender, then to the space's default sender.{{ data.name }}. 32 KB at most. Every required variable of the template must be set, not null or blank.html or text.{ "version": 1, "sections": [...] }, wrapped in the space design. 512 KB at most. Cannot be combined with markdown or html; text replaces the derived plain-text version.text.markdown, blocks or html. A template has its own: sending both is refused.X-Entity-Ref-ID or In-Reply-To. Headers Kula manages (From, Reply-To, To, Subject, List-Unsubscribe, Content-Type, X-Mailler-*…) are ignored. Headers Amazon SES reads (X-SES-*), trace and authentication headers (Received, Received-SPF, Authentication-Results, DomainKey-Signature, ARC-*, Resent-*) and the other Content-* headers are refused.{"opens": true, "clicks": true} to track this email: an open pixel, links rewritten through your tracking subdomain. Each field is false by default. The Track opens and Track clicks settings of the space apply to marketing emails only and don't change this.Send either a template or content (markdown, blocks, or html and/or text), never both. Content is limited to 1 MB.
{
"to": "ada@example.com",
"subject": "Your order has shipped",
"blocks": {
"version": 1,
"sections": [
{ "columns": [ { "width": 100, "blocks": [
{ "type": "heading", "text": "On its way" },
{ "type": "text", "markdown": "Order **#1042** left our warehouse this morning." },
{ "type": "button", "label": "Track the package", "url": "https://acme.com/orders/1042" }
] } ] }
]
}
}
An Idempotency-Key header makes the request safe to retry: see Idempotency.
curl https://api.kulamail.com/v1/emails \
-H "Authorization: Bearer ml_your_api_key" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: reset-7f3a9c" \
-d '{
"to": "ada@example.com",
"template": "password-reset",
"variables": {
"reset_url": "https://app.acme.com/reset?token=7f3a9c",
"expires_in": "30 minutes"
},
"tags": { "user_id": "usr_1042" }
}'
const response = await fetch('https://api.kulamail.com/v1/emails', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.KULA_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': `reset-${token}`
},
body: JSON.stringify({
to: user.email,
template: 'password-reset',
variables: {
reset_url: `https://app.acme.com/reset?token=${token}`,
expires_in: '30 minutes'
},
tags: { user_id: user.id }
})
})
const email = await response.json()
{
"id": "8f6c2a1e-3b4d-4e5f-9a0b-1c2d3e4f5a6b",
"status": "QUEUED",
"to": "ada@example.com",
"createdAt": "2026-10-17T09:30:00Z"
}
status is QUEUED, or SUPPRESSED when the address hard bounced before: nothing is sent and nothing is counted. A replay of an earlier Idempotency-Key answers 200 with the header Idempotent-Replayed: true.
| Status | Code | When |
|---|---|---|
| 400 | validation_error, bad_request, invalid_to, invalid_from | Missing recipient or content, template and content together, variables over 32 KB… |
| 400 | reserved_header | A header of headers is reserved to Amazon SES or the mail servers. The message names it |
| 400 | invalid_blocks | blocks doesn't follow the email format. The message gives the path |
| 400 | missing_variables | A required variable of the template is absent, null or blank. The message names it |
| 400 | domain_not_verified | The sender does not use a verified domain of the space |
| 402 | quota_exceeded | The monthly limit of your plan is reached, or a payment failed |
| 404 | not_found | No template with this id or alias |
| 409 | template_not_published | The template has never been published |
Send a batch
POST /v1/emails/batch
Sends up to 100 emails in one request. The body is an array of emails, each with the same fields as Send an email. Allowed with a sending access key.
Each email is accepted or refused on its own: one invalid email does not stop the others. Results come back in the order of the request.
With an Idempotency-Key header, email number i (from 0) uses the key <key>-<i>. To control keys yourself, set an idempotencyKey field (200 characters at most) on each email instead.
curl https://api.kulamail.com/v1/emails/batch \
-H "Authorization: Bearer ml_your_api_key" \
-H "Content-Type: application/json" \
-d '[
{ "to": "ada@example.com", "template": "invoice", "variables": { "amount": "$19.00" }, "idempotencyKey": "invoice-1042" },
{ "to": "not-an-address", "template": "invoice", "variables": { "amount": "$49.00" }, "idempotencyKey": "invoice-1043" }
]'
{
"data": [
{ "index": 0, "id": "8f6c2a1e-3b4d-4e5f-9a0b-1c2d3e4f5a6b", "status": "QUEUED" },
{ "index": 1, "error": "invalid_to", "message": "Enter a valid recipient address" }
]
}
A missing required variable refuses only its own email, with missing_variables. The request itself fails with 400 only when the array is empty or holds more than 100 emails.
List emails
GET /v1/emails
Lists the emails of the space (transactional, campaign or flow), newest first. Requires a full access key.
BOUNCED. Values in Get an email.key:value, split on the first :. Repeat it to require several tags: tag=webinar:w_123&tag=type:reminder. A key containing : can't be filtered on.CAMPAIGN, FLOW, TRANSACTIONAL, TEST or CONFIRMATION.MARKETING or TRANSACTIONAL.2026-10-01 or an ISO instant, inclusive.2026-10-01 (the whole day) or an ISO instant, exclusive.curl "https://api.kulamail.com/v1/emails?campaignId=5b2e9c1d-7a3f-4e8b-9d0c-1f2a3b4c5d6e&status=BOUNCED" -H "Authorization: Bearer ml_your_api_key"
{
"items": [
{
"id": "8f6c2a1e-3b4d-4e5f-9a0b-1c2d3e4f5a6b",
"toEmail": "ada@example.com",
"subject": "October news",
"source": "CAMPAIGN",
"stream": "MARKETING",
"status": "BOUNCED",
"bounceType": "HARD",
"contactId": "0d9e8f7a-6b5c-4d3e-2f1a-0b9c8d7e6f5a",
"campaignId": "5b2e9c1d-7a3f-4e8b-9d0c-1f2a3b4c5d6e",
"flowId": null,
"templateId": null,
"createdAt": "2026-10-17T09:00:00Z",
"sentAt": "2026-10-17T09:00:03Z",
"deliveredAt": null,
"bouncedAt": "2026-10-17T09:00:05Z",
"complainedAt": null,
"openedAt": null,
"openCount": 0,
"clickedAt": null,
"clickCount": 0,
"unsubscribedAt": null
}
],
"page": 0,
"size": 50,
"total": 1
}
openedAt and clickedAt are the first open and click made by a person: privacy proxies and link scanners are left out, as in the campaign stats. For the events of one email, see Get an email.
Get email stats
GET /v1/emails/stats
Counters and rates of a set of emails of the space, optionally grouped. Requires a full access key.
key:value, repeatable: emails carrying every tag given. Same rules as in List emails.CAMPAIGN, FLOW, TRANSACTIONAL, TEST or CONFIRMATION.MARKETING or TRANSACTIONAL.2026-10-01 or an ISO instant, inclusive. The last 30 days by default.2026-10-01 (the whole day) or an ISO instant, exclusive. 366 days after from at most.source (CAMPAIGN, FLOW, TRANSACTIONAL, CONFIRMATION, TEST), template, campaign, flow or tag:<key>, such as tag:type. One at a time.Emails are counted by the date they were created. A period over 366 days answers 400.
curl "https://api.kulamail.com/v1/emails/stats?tag=webinar:w_123&groupBy=tag:type" \
-H "Authorization: Bearer ml_your_api_key"
{
"from": "2026-10-14T00:00:00Z",
"to": "2026-11-13T09:12:00Z",
"stats": {
"recipients": 1200, "queued": 0, "sent": 1198, "delivered": 1190, "bounced": 8, "complained": 0,
"opened": 640, "clicked": 210, "unsubscribed": 0, "failed": 0, "suppressed": 2, "cancelled": 0,
"openTracked": 1198, "clickTracked": 1198,
"deliveryRate": 0.9933, "bounceRate": 0.0067, "complaintRate": 0.0,
"openRate": 0.5378, "clickRate": 0.1765, "unsubscribeRate": 0.0
},
"groups": [
{ "key": "reminder", "name": null, "stats": { "recipients": 800, "…": "…" } },
{ "key": "invitation", "name": null, "stats": { "recipients": 400, "…": "…" } }
],
"truncated": false
}
| Field | Meaning |
|---|---|
stats | Counters and rates of every matching email, as in the campaign stats |
openTracked, clickTracked | Sent emails that carried the open pixel, or tracked links: every marketing email, and the transactional emails sent with track |
openRate, clickRate | Computed over tracked emails only. 0 with openTracked or clickTracked at 0 means not measured |
groups | With groupBy only. 100 groups at most, the largest first |
groups[].key | The source, the template, campaign or flow id, or the tag value. null groups the emails without one |
groups[].name | The current name of the template, campaign or flow, null if deleted or for a tag |
truncated | true when more than 100 groups matched |
Grouping by template, campaign or flow needs no tag: renaming a template doesn't split its stats.
Get an email
GET /v1/emails/{id}
Returns any email of the space (transactional, campaign or flow) with its events. Requires a full access key.
curl https://api.kulamail.com/v1/emails/8f6c2a1e-3b4d-4e5f-9a0b-1c2d3e4f5a6b \
-H "Authorization: Bearer ml_your_api_key"
{
"message": {
"id": "8f6c2a1e-3b4d-4e5f-9a0b-1c2d3e4f5a6b",
"toEmail": "ada@example.com",
"subject": "Reset your password",
"source": "TRANSACTIONAL",
"stream": "TRANSACTIONAL",
"status": "DELIVERED",
"bounceType": null,
"contactId": "0d9e8f7a-6b5c-4d3e-2f1a-0b9c8d7e6f5a",
"campaignId": null,
"flowId": null,
"templateId": "c41d7e2a-9b8f-4a6e-b3d2-5f1e0a9c8b7d",
"createdAt": "2026-10-17T09:30:00Z",
"sentAt": "2026-10-17T09:30:02Z",
"deliveredAt": "2026-10-17T09:30:04Z",
"bouncedAt": null,
"complainedAt": null,
"openedAt": null,
"openCount": 0,
"clickedAt": null,
"clickCount": 0,
"unsubscribedAt": null
},
"fromEmail": "hello@acme.com",
"fromName": "Acme",
"replyTo": null,
"contactId": "0d9e8f7a-6b5c-4d3e-2f1a-0b9c8d7e6f5a",
"statusDetail": null,
"mailboxProvider": "GOOGLE",
"importReview": false,
"attempts": 1,
"sendAfter": "2026-10-17T09:30:00Z",
"tags": { "user_id": "usr_1042" },
"track": { "opens": false, "clicks": false },
"events": [
{ "id": "1a2b…", "type": "SENT", "machine": false, "url": null, "userAgent": null, "detail": null, "occurredAt": "2026-10-17T09:30:02Z" },
{ "id": "3c4d…", "type": "DELIVERED", "machine": false, "url": null, "userAgent": null, "detail": null, "occurredAt": "2026-10-17T09:30:04Z" }
]
}
| Field | Values |
|---|---|
message.status | QUEUED, SENDING, SENT, DELIVERED, BOUNCED, COMPLAINED, FAILED, SUPPRESSED, CANCELLED |
message.bounceType | HARD, SOFT or BLOCKED. Bounces explained |
message.source | CAMPAIGN, FLOW, TRANSACTIONAL, TEST, CONFIRMATION |
events[].type | SENT, DELIVERED, DELAYED, BOUNCED, COMPLAINED, OPENED, CLICKED, UNSUBSCRIBED, FAILED, REJECTED |
events[].machine | true for opens and clicks made by a privacy proxy or a link scanner, not a person |
track | The tracking asked for a transactional email. Marketing emails follow the settings of the space |
email.delivered, email.bounced and the other email events.Get the content of an email
GET /v1/emails/{id}/content
Returns the email as its recipient read it, rebuilt from its campaign, flow step or template. Requires a full access key.
- No tracking: links are the original ones, no open pixel. Unsubscribe and preferences links are set to
#. - Contact data (
{{ contact.* }}) is today's, not the data of the day it was sent. - Transactional emails are kept 30 days. Their
{{ data.* }}values are replaced with••••and an email sent with its own content is withheld, as they may hold sign-in links or codes. Add?reveal=trueto see them.
curl "https://api.kulamail.com/v1/emails/8f6c2a1e-3b4d-4e5f-9a0b-1c2d3e4f5a6b/content?reveal=true" \
-H "Authorization: Bearer ml_your_api_key"
{
"available": true,
"unavailableReason": null,
"subject": "Reset your password",
"html": "<!DOCTYPE html>…",
"text": "Reset your password: https://app.acme.com/reset?token=7f3a9c",
"masked": false,
"withheld": false,
"sourceChanged": false,
"checks": [
{
"code": "no_reply_sender",
"level": "WARNING",
"message": "The email comes from no-reply@acme.com, which tells readers not to answer. ...",
"detail": { "address": "no-reply@acme.com", "field": "fromEmail" }
}
]
}
| Field | Values |
|---|---|
available | false when the content is gone, with unavailableReason |
unavailableReason | expired (transactional email older than 30 days), source_deleted (source deleted or content purged), render_failed |
masked | true when {{ data.* }} values are hidden |
withheld | true when the content is hidden: html and text are null |
sourceChanged | true when the template or flow step changed after the email was sent: the content may differ |
checks | Advice for your next emails, with the codes of the pre-send checks: [] when nothing was found, null when the content is not available. Without reveal, links keep their domain only (http://acme.com/…) |
Webhooks never carry the content of an email: read it here from the message_id of the event.