Skip to main content
Integrate Lettr into your Node.js application to send transactional emails. Choose the guide that matches your framework. Using Cursor? Jump straight in using this prompt

Prerequisites

Before you begin, make sure you have:
  1. A Lettr account — sign up at app.lettr.com
  2. An API key created in your dashboard
  3. A verified sending domain
  4. Node.js 18 or higher

The SDK

The official lettr package is the recommended way to use Lettr from Node.js — a type-safe client that returns a Result ({ data, error }) instead of throwing:
import { Lettr } from "lettr";

const client = new Lettr(process.env.LETTR_API_KEY!);

const { data, error } = await client.emails.send({
  from: "you@yourdomain.com",
  to: ["recipient@example.com"],
  subject: "Hello from Lettr",
  html: "<p>Your email content here.</p>",
});

if (error) throw new Error(error.message);
console.log(data.request_id);

SDK Guides

PageWhat You’ll Learn
InstallationInstall, create a client, and the Result pattern
Sending EmailsHTML, text, templates, attachments, scheduling, errors
TemplatesManage Lettr templates and merge tags
DomainsAdd, verify, and manage sending domains
WebhooksManage webhook endpoints
AudienceLists, contacts, topics, properties, segments
CampaignsList, send, and schedule campaigns

Framework Guides

Next.js

Send emails from Next.js API routes and server components

Nuxt

Integrate Lettr with Nuxt server routes

Direct API Usage

If you’d rather not add a dependency, send via the REST API using fetch:
const apiKey = 'lttr_xxxxxxxxxxxx';

const response = await fetch('https://app.lettr.com/api/emails', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    from: 'you@yourdomain.com',
    to: ['recipient@example.com'],
    subject: 'Hello from Lettr',
    html: '<p>Your email content here.</p>',
  }),
});

const data = await response.json();
console.log(data);
For the full API reference, see the Send Email endpoint.