API reference

Emails

Send transactional emails and follow every email of the space

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.

to
string required
One recipient: ada@example.com or Ada Lovelace <ada@example.com>.
from
string
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.
replyTo
string
Where replies go. Defaults to the template reply-to, then to the space's.
subject
string
Up to 500 characters. Required with raw content; with a template, it overrides the template subject.
template
string
Id or alias of a template. Its published version is sent, never its draft.
variables
object
Values for the template, read as {{ data.name }}. 32 KB at most. Every required variable of the template must be set, not null or blank.
markdown
string
Content in Markdown, wrapped in the space design, email blocks included. Cannot be combined with html or text.
blocks
object
A blocks document as a JSON object: { "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.
html
string
Raw HTML, sent as given. Kula derives the plain-text part if you don't send text.
text
string
Plain-text version.
preheader
string
Preview text shown after the subject in inboxes, up to 500 characters, with markdown, blocks or html. A template has its own: sending both is refused.
headers
object
Extra headers, 20 at most, such as 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.
tags
object
Up to 20 key/value pairs of your own, such as {"order_id": "1042"}. They come back in every webhook about this email, and filter and group the stats.
track
object
{"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.
Don't track clicks on an email holding a sign-in, password reset or other single-use link: the link would go through Kula's redirect server and be stored by Kula.

Send either a template or content (markdown, blocks, or html and/or text), never both. Content is limited to 1 MB.

Raw content in blocks
{
  "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" }
  }'
201 Created
{
  "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.

StatusCodeWhen
400validation_error, bad_request, invalid_to, invalid_fromMissing recipient or content, template and content together, variables over 32 KB…
400reserved_headerA header of headers is reserved to Amazon SES or the mail servers. The message names it
400invalid_blocksblocks doesn't follow the email format. The message gives the path
400missing_variablesA required variable of the template is absent, null or blank. The message names it
400domain_not_verifiedThe sender does not use a verified domain of the space
402quota_exceededThe monthly limit of your plan is reached, or a payment failed
404not_foundNo template with this id or alias
409template_not_publishedThe 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" }
  ]'
200 OK
{
  "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.

campaignId
string
The recipients of a campaign.
listId
string
The emails of the campaigns sent to a list, including through a segment of it. Flow and transactional emails are left out. It follows the campaign's list, not the recipient's current subscriptions.
flowId
string
The emails sent by a flow.
templateId
string
The emails sent with a template, by your app or by the flow steps linked to it.
status
string
One status, such as BOUNCED. Values in Get an email.
email
string
One recipient address, exact match.
tag
string
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.
source
string
CAMPAIGN, FLOW, TRANSACTIONAL, TEST or CONFIRMATION.
stream
string
MARKETING or TRANSACTIONAL.
from
string
2026-10-01 or an ISO instant, inclusive.
to
string
2026-10-01 (the whole day) or an ISO instant, exclusive.
page
integer
From 0.
size
integer
50 by default, 100 at most.
curl "https://api.kulamail.com/v1/emails?campaignId=5b2e9c1d-7a3f-4e8b-9d0c-1f2a3b4c5d6e&status=BOUNCED"   -H "Authorization: Bearer ml_your_api_key"
200 OK
{
  "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.

tag
string
key:value, repeatable: emails carrying every tag given. Same rules as in List emails.
templateId
string
The emails sent with a template.
campaignId
string
The recipients of a campaign.
flowId
string
The emails sent by a flow.
source
string
CAMPAIGN, FLOW, TRANSACTIONAL, TEST or CONFIRMATION.
stream
string
MARKETING or TRANSACTIONAL.
from
string
2026-10-01 or an ISO instant, inclusive. The last 30 days by default.
to
string
2026-10-01 (the whole day) or an ISO instant, exclusive. 366 days after from at most.
groupBy
string
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"
200 OK
{
  "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
}
FieldMeaning
statsCounters and rates of every matching email, as in the campaign stats
openTracked, clickTrackedSent emails that carried the open pixel, or tracked links: every marketing email, and the transactional emails sent with track
openRate, clickRateComputed over tracked emails only. 0 with openTracked or clickTracked at 0 means not measured
groupsWith groupBy only. 100 groups at most, the largest first
groups[].keyThe source, the template, campaign or flow id, or the tag value. null groups the emails without one
groups[].nameThe current name of the template, campaign or flow, null if deleted or for a tag
truncatedtrue 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"
200 OK
{
  "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" }
  ]
}
FieldValues
message.statusQUEUED, SENDING, SENT, DELIVERED, BOUNCED, COMPLAINED, FAILED, SUPPRESSED, CANCELLED
message.bounceTypeHARD, SOFT or BLOCKED. Bounces explained
message.sourceCAMPAIGN, FLOW, TRANSACTIONAL, TEST, CONFIRMATION
events[].typeSENT, DELIVERED, DELAYED, BOUNCED, COMPLAINED, OPENED, CLICKED, UNSUBSCRIBED, FAILED, REJECTED
events[].machinetrue for opens and clicks made by a privacy proxy or a link scanner, not a person
trackThe tracking asked for a transactional email. Marketing emails follow the settings of the space
Instead of polling, subscribe a webhook to 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=true to see them.
curl "https://api.kulamail.com/v1/emails/8f6c2a1e-3b4d-4e5f-9a0b-1c2d3e4f5a6b/content?reveal=true" \
  -H "Authorization: Bearer ml_your_api_key"
200 OK
{
  "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" }
    }
  ]
}
FieldValues
availablefalse when the content is gone, with unavailableReason
unavailableReasonexpired (transactional email older than 30 days), source_deleted (source deleted or content purged), render_failed
maskedtrue when {{ data.* }} values are hidden
withheldtrue when the content is hidden: html and text are null
sourceChangedtrue when the template or flow step changed after the email was sent: the content may differ
checksAdvice 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.