lettr package is a type-safe API client for Node.js and TypeScript. It covers sending, templates, domains, webhooks, audience, and campaigns — with no thrown exceptions: every method returns a Result you destructure into data and error.
Requirements
- Node.js 18 or higher
- A verified sending domain and an API key
Install the Package
Create a Client
The Result Pattern
Every SDK method returns aResult<T> — a discriminated union of { data, error }. The SDK never throws for API or network failures; you check error instead:
data and error are discriminated, TypeScript narrows data to non-null only after you’ve handled error. See Sending Emails → Error Handling for the full error model.
Verify Your Setup
Available Resources
What’s Next
Sending Emails
Send HTML, text, and template emails
Next.js
Use the SDK in Next.js