Loading...
Loading...
Understand API rate limits and how to handle them effectively.
60
Requests per minute
50
Max recipients per email
100
Max emails per batch
Every API response includes headers to help you track your rate limit usage:
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum number of requests allowed per minute |
X-RateLimit-Remaining | Number of requests remaining in the current window |
X-RateLimit-Reset | Unix timestamp (seconds) when the rate limit resets |
Retry-After | Seconds to wait before retrying (only on 429 responses) |
When you exceed the rate limit, you'll receive a 429 status code. Here's how to handle it:
async function sendEmailWithRetry(payload, maxRetries = 3) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
const response = await fetch('https://notifyn.net/api/v1/emails', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.NOTIFYN_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
}); if (response.status === 429) {
// Get retry delay from header or use exponential backoff
const retryAfter = response.headers.get('Retry-After');
const delay = retryAfter
? parseInt(retryAfter) * 1000
: Math.pow(2, attempt) * 1000;
console.log(`Rate limited. Retrying in ${delay}ms...`);
await new Promise(resolve => setTimeout(resolve, delay));
continue;
} return response.json();
}
throw new Error('Max retries exceeded');
}| Plan | Monthly Emails | API Keys | Rate Limit |
|---|---|---|---|
| Free | 1,000 | 2 | 60/min |
| Pro | 5,000 | 10 | 60/min |
| Enterprise | Unlimited | 100 | Custom |
Instead of sending 100 individual requests, use the batch endpoint to send up to 100 emails in one request.
Track your remaining requests and slow down before hitting the limit.
When retrying failed requests, increase the delay between attempts exponentially.