Emails API
Send, schedule, and track email delivery status.
Methods
send(data)Send an email. Supports from, to (string or array), subject, html, text, and optional scheduledAt for scheduling.
get(id)Get email status: queued, sent, delivered, bounced, failed.
cancel(id)Cancel a scheduled email.
list(options)List emails with optional status filter.
Example
// Send an email
const email = await lystica.emails.send({
from: "you@yourdomain.com",
to: "recipient@example.com",
subject: "Hello from Lystica",
html: "<h1>Welcome!</h1>",
text: "Welcome!",
});
// Schedule for later
const scheduled = await lystica.emails.send({
from: "you@yourdomain.com",
to: ["user1@example.com", "user2@example.com"],
subject: "Weekly Update",
html: "<p>Here's your weekly update...</p>",
scheduledAt: "2026-03-01T09:00:00Z",
});
// Check status
const status = await lystica.emails.get("eml_abc123");
console.log(status.status); // "queued" | "sent" | "delivered" | "bounced" | "failed"
// Cancel a scheduled email
await lystica.emails.cancel("eml_abc123");
// List emails
const { data: emails } = await lystica.emails.list({ status: "bounced" });