Common Errors
401 Unauthorized
This error means the API could not authenticate your request. You will receive an HTTP 401 response. Error:Missing API Key
Missing API Key
Every request must include the If the header is missing entirely, the API will reject the request with a 401 status.
Authorization header with a valid Bearer token:Invalid Key Format
Invalid Key Format
All Lettr API keys start with the
le_ prefix. Double-check for:- Typos or extra whitespace in the key
- A missing or incorrect
Bearerprefix in the header value - Quotes or escape characters accidentally included in the key string
Revoked or Deleted Key
Revoked or Deleted Key
If an API key has been deleted from the dashboard, it immediately stops working. Go to Settings > API Keys in the Lettr dashboard to confirm your key still exists and create a new one if needed.
403 Forbidden
A 403 response means your key was recognized but is not allowed to perform the requested action. There are two main causes.Insufficient Permissions
Error:IP Address Restriction
Error:- Go to Settings > API Keys in the dashboard
- Find the key and check its IP restriction settings
- Add your server’s IP address to the allow list, or remove the restriction if it is no longer needed
Verifying Your API Key
Run a simple test request to confirm your key is valid and working:The
-i flag includes response headers in the output, which is helpful for debugging.Correct Authentication Usage
All requests to the Lettr API must include theAuthorization header with a Bearer token.
GET request:
Environment Variables
Never hard-code API keys in your source code. Store them in environment variables instead. Using a.env file:
Webhook Signature Verification Issues
When receiving webhooks from Lettr, you should verify thelettr-signature header to confirm the request is authentic. Below are common issues and how to solve them.
Use the Raw Request Body
Signature verification must be performed against the raw, unparsed request body. If your framework parses the body as JSON before you verify the signature, the comparison will fail. Express.js — correct setup:Common Pitfalls
Wrong header name
Wrong header name
The signature header is
lettr-signature. Make sure you are not looking for a different header name such as x-signature or x-lettr-signature.Body already parsed as JSON
Body already parsed as JSON
If you apply
express.json() globally before your webhook route, the body will be a parsed object and signature verification will fail. Use express.raw() specifically on the webhook route as shown above.Wrong webhook secret
Wrong webhook secret
Each webhook endpoint in the dashboard has its own secret. Make sure the
LETTR_WEBHOOK_SECRET environment variable matches the secret shown for the specific endpoint you configured.Key Security Best Practices
Never commit keys to git
Never commit keys to git
Add
.env to your .gitignore file. If a key is accidentally committed, revoke it immediately in the dashboard and create a new one.Use environment-specific keys
Use environment-specific keys
Create separate API keys for development, staging, and production environments. This limits the impact if any single key is compromised.
Rotate keys regularly
Rotate keys regularly
Create a new key, update your environment to use it, then delete the old key. Aim to rotate keys at least every 90 days.
Use minimum permissions
Use minimum permissions
If your application only sends emails, use a key with Sending Only permissions. Only use Full Access keys when you need to manage domains, templates, or other account resources.