Appearance
Rate Limiting
Mail.td applies rate limits to ensure fair usage and service stability.
Limits
| Layer | Rate Limit | Keyed by | Applies to |
|---|---|---|---|
| Public endpoints | 8 req/s | IP | Domain list, login, registration |
| Free (authenticated) | 8 req/s | IP | Email operations (/api/accounts/{id}/*) |
| Pro (authenticated) | 20 req/s | IP | Same endpoints, higher limit |
| Account creation (free) | 1 per 8s | IP | POST /api/accounts without Pro token |
| Account creation (Pro) | 8 req/s | IP | POST /api/accounts with Pro token |
Rate Limit Response
When you exceed the limit, the API returns 429 Too Many Requests:
json
{
"error": "rate_limit_exceeded"
}Best Practices
- Use WebSocket for real-time updates instead of polling
GET /api/accounts/{id}/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');
}