Common Errors
401 Unauthorized
This error means the API could not authenticate your request. You will receive an HTTP 401 response. Error:Authorization header is missing entirely, the message is API key is required. instead.
Causes & Solutions:
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
lttr_ 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 API Keys in the Lettr dashboard sidebar 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 API Keys in the dashboard sidebar
- 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:API key is valid. and your team ID. This endpoint works with both Full Access and Sending Only keys.
If the key is invalid, you will receive an HTTP 401 response:
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 Authentication Issues
Lettr doesn’t sign webhook payloads, so there is no signature header to verify. Instead, each webhook is configured with an authentication type (None, Basic, or OAuth 2.0) and Lettr sends the matching credentials with every delivery. Below are common issues and how to solve them.Check the Basic Auth Credentials
With Basic authentication, Lettr sends anAuthorization: Basic ... header built from the username and password you entered when creating the webhook. The endpoint should decode it and compare both values.
Express.js — correct setup:
Common Pitfalls
Looking for a signature header
Looking for a signature header
Lettr doesn’t send a signature header such as
lettr-signature or x-signature. Authenticate requests with the Authorization header instead, using the Basic or OAuth 2.0 credentials configured on the webhook.Wrong webhook credentials
Wrong webhook credentials
Each webhook in the dashboard has its own authentication settings. Make sure the credentials your endpoint checks match the ones configured for that specific webhook. For OAuth 2.0, confirm that the token URL, client ID, and client secret are correct, because Lettr fetches a token from your OAuth server before each delivery.
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.
Related Topics
API Keys
Learn how to create and manage your API keys.
Permissions
Understand the difference between Full Access and Sending Only keys.
Webhook Authorization
Set up and verify webhook authentication.