Rate Limits

Understanding API rate limits and how to handle them.

Default Limits

EndpointLimitWindow
POST /api/emails100 requestsper minute
GET /api/emails300 requestsper minute
POST /api/templates60 requestsper minute
All other endpoints60 requestsper minute

Rate Limit Headers

Every response includes headers to help you track your usage:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed in the window
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when the window resets

Rate Limit Exceeded

When you exceed the rate limit, you'll receive a 429 Too Many Requests response:

{
  "error": "Rate limit exceeded",
  "retryAfter": 45
}

The retryAfter field indicates seconds until you can retry.

Best Practices

  • Implement exponential backoff when retrying failed requests
  • Monitor rate limit headers to avoid hitting limits
  • Batch operations where possible instead of many individual calls
  • Use webhooks for delivery status instead of polling
  • Cache responses when fetching the same data repeatedly

Retry Logic Example

async function sendWithRetry(email, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    const response = await fetch('https://getmailer.co/api/emails', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer ' + apiKey,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(email)
    });

    if (response.status === 429) {
      const data = await response.json();
      const waitTime = (data.retryAfter || Math.pow(2, i)) * 1000;
      await new Promise(r => setTimeout(r, waitTime));
      continue;
    }

    return response.json();
  }
  throw new Error('Max retries exceeded');
}

Increasing Limits

If you need higher rate limits for your use case, please contact us to discuss your requirements.

Related

Rate Limits - GetMailer Docs | GetMailer