API Key Security
Your API key is the single credential that authorizes requests to the Lettr API. Treat it like a database password.Store Keys in Environment Variables
Never hardcode API keys in your source code. Use environment variables instead:Keep Keys Out of Version Control
Add your environment files to.gitignore before your first commit:
Use the Right Permission Level
Lettr API keys have two permission levels:| Permission Level | Use Case |
|---|---|
| Sending Only | Application code that only needs to send emails — use this for production services |
| Full Access | Admin tasks like managing domains, templates, and account settings |
Use Separate Keys Per Environment
Create distinct API keys for each environment:- Development — a Sending Only key pointing to test recipients
- Staging — a Sending Only key for pre-production testing
- Production — a Sending Only key for live email sending
- Admin — a Full Access key used only for dashboard-level operations
Rotate Keys Regularly
Rotate your API keys periodically and immediately if you suspect exposure. You can create new keys and revoke old ones from the Lettr dashboard without downtime — create the new key first, update your environment variables, then revoke the old key.Webhook Security
Webhooks push event data to your server. Without verification, anyone who discovers your webhook URL could send fake events to your application.Verify Webhook Signatures
Every webhook request from Lettr includes alettr-signature header. Verify this signature before processing any event:
Use HTTPS for Webhook Endpoints
Always use anhttps:// URL for your webhook endpoint. HTTP endpoints transmit event data — including recipient email addresses — in plain text across the network.
See Webhook Authorization for the full signature verification reference.
Account Security
Enable Two-Factor Authentication
Enable 2FA for every team member in the Lettr dashboard under your account security settings. This protects against password compromise — even if an attacker obtains a password, they can’t access the dashboard without the second factor.2FA is configured per user in the dashboard. If you manage a team, require all members to enable it as part of your onboarding process.
Review Team Access
Periodically review who has access to your Lettr account through the dashboard:- Remove team members who no longer need access
- Verify that each member’s role matches their current responsibilities
- Audit when new members were added and by whom
Configure IP Restrictions
If your API requests originate from known IP addresses (such as production servers), configure IP restrictions in the Lettr dashboard to reject requests from unrecognized sources. This adds a layer of defense even if an API key is leaked.Data Protection
Minimize Sensitive Data in Emails
Email is not a secure transport channel. Avoid including sensitive information directly in email content or metadata:| Don’t Include | Do Instead |
|---|---|
| Full credit card numbers | Last four digits only |
| Passwords or secrets | A link to securely reset or retrieve |
| Social security numbers | Reference an account number |
| Full API keys or tokens | A masked version with a link to the dashboard |
| Medical or financial details | A notification to log in and view securely |
Be Careful with Metadata and Custom Headers
Any data you attach to an email — custom headers, metadata fields, tags — is stored by Lettr and may appear in logs, webhooks, and dashboard views. Don’t use metadata fields to store passwords, tokens, or personally identifiable information that isn’t necessary for email delivery.Monitoring and Incident Response
Use Webhooks to Detect Unusual Activity
Set up webhook handlers to flag abnormal patterns:Review Dashboard Logs Regularly
Check the Lettr dashboard periodically for:- Unexpected sending volume — a spike could mean a compromised key
- Emails to unfamiliar recipients — could indicate unauthorized use
- Failed authentication attempts — someone may be trying stolen credentials
- New API keys you didn’t create — another team member may need to verify, or an account may be compromised
If you discover any sign of unauthorized access, rotate all API keys immediately and contact support@lettr.com.
Security Checklist
Use this checklist when setting up a new Lettr integration or auditing an existing one:Store API keys in environment variables
Move all API keys out of source code and into environment variables. Verify your
.env files are in .gitignore.Use Sending Only keys for application code
Check that production services use Sending Only keys, not Full Access keys. Reserve Full Access for admin operations only.
Use separate keys per environment
Create distinct keys for development, staging, and production so a compromise in one doesn’t affect the others.
Verify webhook signatures
Confirm your webhook handler checks the
lettr-signature header using the raw request body before processing any event.Use HTTPS for all endpoints
Ensure your webhook URLs and any client-side requests use HTTPS, not HTTP.
Enable 2FA for all team members
Verify every user on your Lettr account has two-factor authentication enabled in the dashboard.
Audit team access
Review the team members list in the dashboard and remove anyone who no longer needs access.
Remove sensitive data from email content
Audit your email templates to ensure they don’t contain passwords, full card numbers, or other sensitive data.