REST API
Authentication
Authenticate with the Emailens API using API keys or session cookies.
API key (recommended)
Pass your API key in the Authorization header:
curl -X POST https://emailens.dev/api/preview \
-H "Authorization: Bearer ek_your_api_key" \
-H "Content-Type: application/json" \
-d '{"html": "..."}'API keys start with ek_ and are tied to your account. Generate them from Dashboard > API Keys.
Key limits by plan
| Plan | Max API keys |
|---|---|
| Free | 0 (web app only) |
| Dev ($9/mo) | 1 |
| Pro ($19/mo) | 10 |
Session cookie
When using the web app, authentication is handled via session cookies (Better Auth). This is automatic — no configuration needed.
The session cookie is set when you sign in via:
- Email/password
- Google OAuth
- GitHub OAuth
Anonymous access
The API works without authentication, but with lower limits:
- 30 requests/minute (vs 60 authenticated)
- 3 previews/day (vs plan limits)
- No saved previews
- No API keys