Templates
A template is a reusable email, written once in Templates:
| Use | How | Stays linked |
|---|---|---|
| Sent by your app | POST /v1/emails with its alias | Yes: the published version is sent |
| In a flow | An email step links the template | Yes: publishing updates every flow using it |
| In a campaign | Start from when creating the campaign | No: the content is copied |
Transactional emails
A transactional email is sent by your app to one person, because of something they just did: a password reset, a sign-in link, a receipt, an invitation. It needs no list and has no unsubscribe link. It travels on its own stream, so it keeps flowing when marketing is paused.
Two ways to send
| Template | Raw content | |
|---|---|---|
| Content lives in | Kula: anyone on the team edits it in the dashboard | Your code |
| You send | The template alias and variables | The subject and the HTML, Markdown or blocks |
| Best for | Most emails | Emails your app already renders |
Create a template
Open Templates › New template. Under Start from, pick a blank email, one of your templates (copied), or a starter template: receipt, password reset, magic link, verification code, and the marketing ones. Starter templates come with their variables and take the design of your space.
The template page has three tabs:
| Tab | Holds |
|---|---|
| Content | Subject, Preview text and the editor, with Write and Preview |
| Settings | Name (internal), Alias (the key your code sends as template, such as password-reset), sender and variables |
| Usage and API | The flows linked to the template and the snippet to send it |
Put the main link in a button and sign-in codes in a code (Insert › Code in the text toolbar): the designer.
Variables
Use data.* variables for the values your app sends: {{ data.reset_url }}, {{ data.order.total }}. Declare them in Settings › Variables:
| Field | Use |
|---|---|
| Name | reset_url for {{ data.reset_url }} |
| Required | The send is refused without it |
| Example | Fills the preview and test emails |
- A required variable missing, null or blank:
POST /v1/emailsanswers400 missing_variables. - A
data.*used in the content but not declared raises a pre-send check. - Variables are versioned with the content: a change goes live on Publish.
If the recipient is also a contact of your space, {{ contact.first_name }} and the contact's attributes work too.
Draft and published versions
A template has a draft and a published version. The API always sends the published version: editing the draft does not change emails in production.
| Status | Meaning |
|---|---|
| Draft | Never published: the API refuses to send it |
| Published | The draft and the published version are the same |
| Unpublished changes | You edited the draft since the last publication |
Preview and Send a test use the draft. Click Publish to make the draft live, or Discard draft to go back to the published version.
Publishing also updates every flow linked to the template.
AI assistants can write a template draft but never publish it: they ask a member, who clicks Approve and publish.
Send it from your app
Create an API key in Settings › API keys. A key with sending access is enough, and safer to store in an app. Then call POST /v1/emails:
curl https://api.kulamail.com/v1/emails \
-H "Authorization: Bearer $KULA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: reset-8f6c2a1e" \
-d '{
"to": "ada@example.com",
"template": "password-reset",
"variables": {
"name": "Ada",
"reset_url": "https://acme.com/reset?token=abc123"
}
}'
The email is queued and leaves within seconds. Usage and API shows the same snippet, in cURL and Node, with your alias and the examples of your variables.
- Sender: the sender of the template, or the default sender of the space. Override it with
from, on a verified domain. - Idempotency: send an
Idempotency-Keyheader. If your app retries after a timeout, Kula returns the first email instead of sending a second one. - Batches: send up to 100 emails in one call with
POST /v1/emails/batch. - Tags: attach key/value
tagsto find the email in webhooks and count by tag. - Tracking: off unless you ask, with
track. Track opens and clicks.
Every field and error: Emails API.
A tool that can't call an API (Supabase, Ghost, WordPress) sends through the SMTP relay instead.
A separate stream
| Marketing | Transactional | |
|---|---|---|
| Priority in the queue | Normal | First |
| Paused on a reputation alert | Yes | No |
| Warm-up of a new domain | Applies | Skipped |
| Contact review | Applies | Skipped |
| Unsubscribed contacts | Skipped | Still receive it |
| Hard-bounced addresses | Skipped | Skipped |
A hard-bounced address is blocked on both streams: the email comes back with the status SUPPRESSED and is not sent.
Use it in a flow
In a flow, an email step either has its own content or links a template. Linked, the step sends the template's published version:
- publishing a change updates every flow using it;
{{ data.x }}reads the trigger event's properties, like{{ event.x }}: a template written for the API works as is in a flow triggered by that event;- Detach copies the content into the step and drops the link.
A flow email is a marketing email, even with a template: it carries an unsubscribe link and follows the marketing rules.
| Rule | Why |
|---|---|
| A flow can't be activated while a linked template was never published | Nothing to send yet |
| A run fails if its trigger event lacks a required variable | The run page names the missing variables |
| A flow triggered by a list can't link a template with required variables | There is no event to fill them |
| A template linked to a flow can't be deleted | Detach it or remove the step first |
Use it in a campaign
In Campaigns › New campaign, pick a template under Start from. Subject, preview text, sender and content are copied into the campaign: later edits to the template don't change it. Campaigns.
Follow what happens
- Activity lists every email, with its status and events. Filter on the transactional stream.
- The Usage and API tab shows the flows using the template and its sends over 30 days.
- Webhooks tell your app when an email is delivered, bounces, is opened or clicked.
Raw content you send (HTML, Markdown or blocks, without a template) is kept 30 days, then deleted.
Track opens and clicks
Transactional emails are not tracked by default. Ask for it email by email:
{
"to": "ada@example.com",
"template": "webinar-reminder",
"variables": { "starts_at": "Thursday, 6 pm" },
"tags": { "webinar": "w_123", "type": "reminder" },
"track": { "opens": true, "clicks": true }
}
Over SMTP, add the header X-Kula-Track: opens, clicks. The Track opens and Track clicks settings of the space apply to marketing emails only.
Stats by tag
GET /v1/emails/stats, with a full access key, counts the emails matching your tags, and groupBy splits them. A webinar platform sends an invitation, reminders and a same-day notice for each webinar, tagged webinar and type. The results of webinar w_123, by type:
curl "https://api.kulamail.com/v1/emails/stats?tag=webinar:w_123&groupBy=tag:type" \
-H "Authorization: Bearer $KULA_API_KEY"
One group per type: invitation, reminder, same-day, each with deliveries, bounces, opens and clicks. Open and click rates are computed over tracked emails only. Get email stats.