Appearance
Rate Limiting
Mail.cx applies rate limits to ensure fair usage and service stability.
Limits
| Rate Limit | Description |
|---|---|
| 8 req/s per IP | All endpoints (/api/ and /pro/api/) |
Rate Limit Response
When you exceed the limit, the API returns 429 Too Many Requests:
json
{
"error": "rate_limited",
"message": "Too many requests, please slow down"
}Best Practices
- Use WebSocket for real-time updates instead of polling
GET /api/messagesrepeatedly - Cache domain lists — available domains rarely change
- Use exponential backoff when retrying after a
429 - Batch operations where possible — don't create/delete accounts in tight loops
Example: Retry with Backoff
javascript
async function fetchWithRetry(url, options, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const res = await fetch(url, options);
if (res.status !== 429) return res;
const delay = Math.pow(2, i) * 1000; // 1s, 2s, 4s
await new Promise(r => setTimeout(r, delay));
}
throw new Error('Rate limit exceeded after retries');
}