Skip to main content
The Ark API implements rate limiting to ensure fair usage and platform stability. This guide explains how rate limits work and how to handle them in your application.

Rate Limit Overview

LimitValue
Requests per second5
Rate limits are applied per API key using a sliding window algorithm.

Rate Limit Headers

Example Response Headers

HTTP/1.1 200 OK
X-RateLimit-Limit: 5
X-RateLimit-Remaining: 4
X-RateLimit-Reset: 1705312800

Handling Rate Limits

When you exceed the rate limit, you’ll receive a 429 Too Many Requests response:
{
  "success": false,
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Rate limit exceeded",
    "suggestion": "Wait before retrying"
  },
  "meta": {
    "requestId": "req_abc123"
  }
}
The response includes a Retry-After header indicating how many seconds to wait.

SDK Automatic Retries

All Ark SDKs automatically handle rate limits with exponential backoff:
from ark import Ark

# SDKs automatically retry rate-limited requests
# Default: 2 retries with exponential backoff
client = Ark()

# Customize retry behavior
client = Ark(max_retries=5)  # More retries
client = Ark(max_retries=0)  # Disable retries

Manual Rate Limit Handling

If you need custom rate limit handling:
import ark
import time

client = Ark(max_retries=0)  # Disable auto-retry

def send_with_rate_limit_handling(email_data, max_attempts=3):
    for attempt in range(max_attempts):
        try:
            return client.emails.send(**email_data)
        except ark.RateLimitError as e:
            if attempt == max_attempts - 1:
                raise
            # Get retry-after from headers if available
            wait_time = 1 * (2 ** attempt)  # Exponential backoff
            print(f"Rate limited, waiting {wait_time}s...")
            time.sleep(wait_time)

Best Practices

1. Use SDK Auto-Retries

The SDKs handle rate limits automatically. Just send your requests and they’ll retry with backoff:
# Just send emails - SDK handles rate limits automatically
for user in users:
    client.emails.send(
        from_="[email protected]",
        to=[user.email],
        subject="Update",
        html="<p>Hello!</p>"
    )

2. Use Batch Endpoints

Instead of making multiple individual requests, use the batch endpoint:
# Instead of this (100 requests)
for email in emails:
    client.emails.send(**email)

# Do this (1 request)
client.emails.send_batch(emails=emails)

3. Implement Request Queuing

For applications that need to send many requests, queue them and process at a controlled rate:
import asyncio
from ark import Ark

client = Ark()

async def send_with_rate_limiting(emails, requests_per_second=4):
    interval = 1.0 / requests_per_second
    results = []

    for email in emails:
        result = client.emails.send(**email)
        results.append(result)
        await asyncio.sleep(interval)

    return results

# Usage - stay under 5 req/s limit
results = asyncio.run(send_with_rate_limiting(emails))

4. Use Exponential Backoff

The SDKs handle exponential backoff automatically. Configure the number of retries:
from ark import Ark

# Configure max retries - SDK uses exponential backoff automatically
client = Ark(max_retries=5)

# All requests will retry up to 5 times with exponential backoff
# for rate limits, timeouts, and server errors
email = client.emails.send(
    from_="[email protected]",
    to=["[email protected]"],
    subject="Hello",
    html="<p>Hello!</p>"
)

Endpoint-Specific Limits

Email Sending

EndpointLimitValue
POST /emailsTo recipients50 per email
POST /emailsCC recipients50 per email
POST /emailsBCC recipients50 per email
POST /emailsSubject length998 characters
POST /emailsTag length1000 characters

Batch Emails

EndpointLimitValue
POST /emails/batchEmails per request100
POST /emails/batchRecipients per email50
POST /emails/batchTotal recipients1000 across all emails

Pagination

EndpointDefaultMaximum
GET /emails30 per page100 per page
GET /suppressions30 per page100 per page

Suppressions

EndpointLimitValue
POST /suppressions/bulkSuppressions per request1000

Need Higher Limits?

If you need higher rate limits for your use case, contact us:

Contact Support

Request higher rate limits for your needs