SDK Resources
Use the Lumail SDK resource clients for subscribers, campaigns, transactional emails, tags, and events.
The SDK groups API operations by resource. Each resource client maps to common Lumail workflows.
Subscribers
Create or update a subscriber and optionally trigger matching workflows.
const { subscriber } = await lumail.subscribers.create({
email: "[email protected]",
name: "Jane Doe",
tags: ["newsletter", "customer"],
fields: { plan: "pro" },
triggerWorkflows: true,
skipDoubleOptIn: true,
});Update subscriber fields or replace tags later:
await lumail.subscribers.update("[email protected]", {
fields: { plan: "enterprise" },
tags: ["enterprise"],
replaceTags: true,
});Campaigns
Create campaigns, fetch details, update drafts, and send immediately or on a schedule.
const { campaignId } = await lumail.campaigns.create({
subject: "Welcome to the newsletter",
name: "Welcome Campaign",
preview: "Here is what to expect.",
contentType: "MARKDOWN",
});
await lumail.campaigns.send(campaignId, {
scheduledAt: "2026-06-01T09:00:00Z",
timezone: "Europe/Paris",
});Transactional Emails
Send transactional email from a verified domain.
await lumail.emails.send({
to: "[email protected]",
from: "[email protected]",
subject: "Your receipt",
markdown: "Thanks for your purchase.",
});To send a React Email template, render it to HTML and pass html - see Send React Email Templates with Lumail.
Email Verification
Validate an address before storing or sending to it.
const result = await lumail.emails.verify({ email: "[email protected]" });
if (!result.success) {
console.log(result.code, result.error, result.suggestion);
}Tags
List, create, fetch, and rename tags.
const { tags } = await lumail.tags.list();
const { tag } = await lumail.tags.create({ name: "vip" });
await lumail.tags.update(tag.id, { name: "customer" });Events
Track product activity and business events on a subscriber profile.
await lumail.events.create({
eventType: "SUBSCRIBER_PAYMENT",
subscriber: "[email protected]",
data: {
amount: 99,
currency: "USD",
plan: "pro",
},
});