Rate limits: How to reduce 403, 422, & 429 errors
If you've encountered 403, 422, or 429 errors while using MailerSend's API, it's important to understand what these errors indicate, as well as the rate limits and quotas associated with your plan.
Daily Request Quotas
MailerSend has a daily request quota for API and SMTP relay services which varies depending on your subscription plan. Every request made counts against your daily quota, which is reset daily at midnight UTC.Premium
|Plan||Quota / day|
What happens when you exceed your quota?
When you hit your daily quota, you will start receiving a 429 HTTP error. Two HTTP headers will be returned with every API request to indicate the quota limit and when the quota will be reset.
Rate limit errors
429 - Too many requests
What it means: You've exceeded your rate limit or daily quota.
Types of rate limits:
Rate limit per minute: This type of rate limit caps the number of API requests that can be made per minute.
Daily quota: This is a longer-term limit on how many API requests you can make in a 24-hour period.
For each MailerSend plan level, there are rate limits specified for different types of requests:
|Endpoint||Normal account||Under review account|
|All API requests (excluding v1/email)||60 requests per minute||60 requests per minute|
|API requests to v1/email||120 requests per minute||10 requests per minute|
|API requests to v1/bulk||10 requests per minute||1 request per minute|
422 - Validation errors
What it means: This error means a validation error was found when processing your request.
How to reduce validation errors:
Ensure your API requests are formatted correctly and all required parameters have been included
Refer to MailerSend's developer documentation for sample code and guidelines
If you're using MailerSend templates, ensure that you're following the correct template structure
403 - Forbidden errors
What it means: A 403 Forbidden error indicates that you're trying to access a resource on the server that you're not authorized to access. Unlike 401 Unauthorized errors, where authentication might solve the problem, a 403 Forbidden error signifies that authentication won't help. Your credentials may be valid, but you still don't have permission for a specific request.
Invalid API Key: If the API key you're using is invalid, expired, or revoked, you might encounter a 403 error
Insufficient permissions: Your API key might be valid but lacking the necessary permissions to perform a specific operation
Account status: If your MailerSend account is suspended, under review, or otherwise restricted, API calls may result in 403 errors
IP blocking: If requests are coming from an IP address that has been blocked due to suspicious activity, you might get a 403 error
How to reduce 403 errors
Check API Key: Make sure that your API key is correct, active, and not expired
Review permissions: Ensure your API key or user account has the permissions necessary for the action you're trying to perform. You may need to generate a new key with broader permissions
Check account status: Make sure your account is active and in good standing
Examine IP Address: Confirm your IP address is not on any blocklists
Check Endpoint URLs: Make sure you're requesting an existing endpoint and that the URL is spelled correctly
Consult documentation: Always refer to MailerSend’s API documentation to ensure you're making requests correctly