Skip to main content
The official 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

Install the Package

Create a Client

Store your API key in an environment variable, never in source. API keys use the lttr_ prefix followed by 64 hexadecimal characters.

The Result Pattern

Every SDK method returns a Result<T> — a discriminated union of { data, error }. The SDK never throws for API or network failures; you check error instead:
Because 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