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](/docs/ai-integration/mcp-claude). If you need language-agnostic access, use the [REST API](/docs/api-reference) or [Tools API](/docs/ai-integration/tools-api).

## Install

```bash
pnpm add lumail
```

## Quick Start

```typescript
import { Lumail } from "lumail";

const lumail = new Lumail({
  apiKey: process.env.LUMAIL_API_KEY!,
});

const { subscriber } = await lumail.subscribers.create({
  email: "user@example.com",
  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](/docs/sdk/configuration) - create the client and manage API keys
- [Resources](/docs/sdk/resources) - subscribers, campaigns, emails, tags, and events
- [Tools](/docs/sdk/tools) - call Lumail tools from your app
- [Errors and Retries](/docs/sdk/errors-retries) - handle typed errors and rate limits
