Back to Documentation

Rate Limits

Understand API rate limits and how to handle them in your application.

Overview

Rate limits protect the API from excessive use and ensure fair access for all users. Limits are applied per API key and reset every minute or hour depending on the endpoint.

Exceeding rate limits will result in 429 Too Many Requests responses. Plan your integration accordingly and implement proper retry logic.

Rate Limit Headers

Every API response includes headers to help you track your rate limit usage:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed in the current window
X-RateLimit-RemainingRemaining requests in the current window
X-RateLimit-ResetUnix timestamp when the rate limit resets
Retry-AfterSeconds to wait before retrying (only on 429 responses)

Limits by Endpoint

Email API

EndpointStarterProEnterprise
POST /emails100/min1,000/min10,000/min
GET /emails500/min2,000/min20,000/min
GET /emails/:id500/min2,000/min20,000/min

SMS API

EndpointStarterProEnterprise
POST /sms50/min500/min5,000/min
GET /sms500/min2,000/min20,000/min
GET /sms/:id500/min2,000/min20,000/min

Voice API

EndpointStarterProEnterprise
POST /calls10/min100/min1,000/min
GET /calls500/min2,000/min20,000/min

Handling Rate Limits

JavaScript Example

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

    if (response.status === 429) {
      const retryAfter = response.headers.get('Retry-After') || 60;
      console.log(`Rate limited. Retrying in ${retryAfter}s...`);
      await new Promise(r => setTimeout(r, retryAfter * 1000));
      continue;
    }

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

Python Example

python
import time
import requests

def send_with_retry(data, max_retries=3):
    for i in range(max_retries):
        response = requests.post(
            'https://api.ekdsend.com/v1/emails',
            headers={
                'Authorization': 'Bearer ek_live_xxxxxxxxxxxxx',
                'Content-Type': 'application/json'
            },
            json=data
        )
        
        if response.status_code == 429:
            retry_after = int(response.headers.get('Retry-After', 60))
            print(f"Rate limited. Retrying in {retry_after}s...")
            time.sleep(retry_after)
            continue
        
        return response.json()
    
    raise Exception('Max retries exceeded')

Best Practices

Use Exponential Backoff

When retrying after a rate limit, use exponential backoff to avoid overwhelming the API.

Monitor Headers

Check X-RateLimit-Remaining before making requests to proactively avoid hitting limits.

Batch When Possible

Use bulk endpoints to send multiple messages in a single request instead of individual calls.

Handle Gracefully

Always implement proper error handling for 429 responses in your application.

Need Higher Limits?

If your application requires higher rate limits than your current plan allows, you have two options: