Prerequisites
Before you begin, make sure you have:API Key
Create an API key in the Lettr dashboard
Verified Domain
Add and verify your sending domain
- Vercel account with a project deployed or ready to deploy
- Next.js project (recommended) or a Node.js serverless function
- Node.js 18.x or 20.x runtime
Quick Setup
1
Install the Lettr SDK
2
Add environment variables
Add your API key via the Vercel dashboard or CLI:When prompted, paste your API key (starts with
lttr_). Then add your from email:3
Create an API route
Create a file at
app/api/send/route.ts (App Router) or pages/api/send.ts (Pages Router) with the code examples below.4
Deploy
https://your-domain.vercel.app/api/send.Next.js App Router (Recommended)
For Next.js 13+ projects using the App Router, create a file atapp/api/send/route.ts:
The
maxDuration export configures the maximum execution time for the function. Email sending typically completes in under 1 second, but setting a higher limit accounts for retries and network latency.Next.js Pages Router
For Next.js projects using the Pages Router, create a file atpages/api/send.ts:
What’s Next
Advanced Guide
Learn about Server Actions, Edge Runtime, and advanced patterns
AWS Lambda
Deploy on AWS Lambda
Cloudflare Workers
Deploy on Cloudflare
API Reference
Complete API documentation