SDK Introduction
Understand what the Lumail TypeScript SDK is for and when to use it in your application.
The Lumail TypeScript SDK is the easiest way to integrate the Lumail API into a JavaScript or TypeScript project. It gives you a typed client for subscribers, campaigns, transactional emails, tags, events, and Lumail tools.
It is built for web apps, SaaS backends, serverless functions, internal dashboards, and scripts. It is not a separate AI-agent runtime. If you are connecting Claude, Cursor, or another assistant directly to Lumail, use the MCP integration. If you need language-agnostic access, use the REST API or Tools API.
Install
pnpm add lumailQuick Start
import { Lumail } from "lumail";
const lumail = new Lumail({
apiKey: process.env.LUMAIL_API_KEY!,
});
const { subscriber } = await lumail.subscribers.create({
email: "[email protected]",
name: "Jane Doe",
tags: ["newsletter"],
triggerWorkflows: true,
});
await lumail.events.create({
eventType: "SUBSCRIBED",
subscriber: subscriber.email,
data: { source: "signup-form" },
});Common Integration Points
| Integration point | What the SDK does |
|---|---|
| Signup forms | Create or update subscribers and trigger workflows |
| Checkout flows | Tag customers, store plan fields, and track payment events |
| Product events | Record subscriber activity for segmentation and analytics |
| Transactional email | Send email from a verified domain |
| Internal admin tools | Search, update, tag, or unsubscribe subscribers |
| Scheduled jobs | Create, schedule, and send campaigns from backend code |
Choose the Right Lumail Interface
| Interface | Best for |
|---|---|
| TypeScript SDK | JavaScript or TypeScript apps that want typed API access |
| REST API | Any language or framework |
| Tools API | Calling Lumail tool actions through one endpoint |
| MCP | Letting AI assistants discover and call Lumail tools directly |
| CLI | Terminal workflows and shell scripts |
Next Steps
- Configuration - create the client and manage API keys
- Resources - subscribers, campaigns, emails, tags, and events
- Tools - call Lumail tools from your app
- Errors and Retries - handle typed errors and rate limits