Email · 3 min read
Send a Transactional Email
Send an order, shipping or account email to one person from a saved email template
Sends one transactional email, such as an order confirmation, a shipping update or a password reset, from an email template you built in the dashboard. Values you send in data fill the template's merge tags.
Use this only for messages the person needs. Marketing email (offers, newsletters, reminders to buy) goes through email campaigns and journeys, which check consent and add an unsubscribe link.
Setup required. Before you can send, your account needs:
- LemuAI's email service turned on. Contact hello@lemuai.com to enable it.
- A verified sending domain and at least one sender. See Email Setup.
- A saved template. Transactional templates are best marked as transactional in the editor.
/api/v1/email/sendHeaders#
| Name | Required | Description |
|---|---|---|
X-API-Key | Yes | An API key from your organization. See Authentication. |
Content-Type | Yes | application/json |
Request body#
| Field | Type | Required | Description |
|---|---|---|---|
template_id | integer | Yes | The template to send. It is the number at the end of the template's address when you open it in the dashboard, for example /email/templates/42. |
to | string | Yes | The recipient's email address, 3 to 320 characters. |
data | object | No | Values for the template's merge tags, such as order id, items or total. See below. |
sender_id | integer | No | The sender (From name and address) to use. Default: your default sender from Email Setup. |
template_version | integer | No | A saved version of the template to send. Default: the latest saved version. |
subject | string | No | A subject line to use instead of the template's, up to 998 characters. Merge tags work here too. |
What the template can use#
| Merge tag | Filled with |
|---|---|
{{ event.order_id }} or {{ data.order_id }} | A value from the data you sent. Both names work, so templates built for journeys with event.* tags can be reused here. |
{{ contact.first_name }}, {{ contact.custom.plan }} | The contact whose email is to, if there is one. Empty if no contact has that address. |
{{ organization.name }}, {{ organization.address }} | Your organization's name and postal address. |
Use | default("there") for values that may be missing, and | money("INR") to format prices. See Personalize with merge tags.
Example request:
curl -X POST https://app.lemuai.com/api/v1/email/send \
-H "X-API-Key: lemu_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"template_id": 42,
"to": "priya@example.com",
"data": {
"order_id": "SO-10422",
"total": 2499,
"items": [
{ "title": "Running shoes", "quantity": 1, "price": 2499 }
],
"tracking_url": "https://track.example.com/SO-10422"
}
}'Response#
200: the email was handed to the sending service.
{
"message_id": 77341,
"provider_message_id": "0109019a2c5e1f4b-6f1d8c2a-9b7e-4f3a-8d21-5e0c7b9a1d34-000000"
}| Field | Type | Description |
|---|---|---|
message_id | integer | The message's id in LemuAI. Its delivery status (delivered, opened, clicked, bounced) appears in the contact's messages when to belongs to a contact. |
provider_message_id | string | The sending service's id for the email. |
Consent and suppression#
Transactional email doesn't need the person's email consent, and it is sent even when your marketing email is paused. It is still never sent to an address on your suppression list (for example after a hard bounce, a spam complaint or an unsubscribe). Those requests return 422 with skipped set to suppressed.
Errors#
| Status | When |
|---|---|
400 | The template has never been saved, you have no sender (add one in Email Setup), or to isn't a valid email address. |
401 | The API key is missing or not valid. |
404 | No template with this template_id in your organization. |
422 | Nothing was sent. detail.skipped says why: domain_not_verified (the sender's domain isn't verified), suppressed (the address is on your suppression list), render_failed (a merge tag couldn't be filled, see detail.message) or no_address. Also returned when a field is missing or has the wrong type. |
502 | The sending service refused the email. It is logged as failed. |
See Errors for the error format.
Was this page helpful?
Docs