How Rate Limiting Works
The Clix API uses a token bucket algorithm to manage request rates. Here’s how it works:- Token Bucket - Each project starts with a fixed number of tokens
- Request Cost - Each API request consumes one token
- Refill - The token bucket refills at regular intervals
- Tracking - Rate limits are tracked per project using the
X-Clix-Project-IDheader
429 Too Many Requests response until the bucket refills.
Rate Limit Policy
| API Group | Limit | Time Window |
|---|---|---|
| Management Operations | 1,000 requests | 1 second |
- User management endpoints (create, update, delete users)
- Message sending endpoints
- Campaign triggering endpoints
Understanding Response Headers
Every API response includes rate limit information in the response headers:| Header | Description | Example |
|---|---|---|
X-RateLimit-Limit | Total tokens in your bucket (requests per refill period) | 1000 |
X-RateLimit-Remaining | Tokens available right now | 842 |
X-RateLimit-Reset | Unix timestamp (seconds) when bucket refills | 1699617005 |
When You Hit a Rate Limit
Exceeding your rate limit results in a 429 Too Many Requests HTTP response:What Happens Next
- Your bucket is temporarily empty (no tokens available)
- The bucket automatically refills after the interval specified in your rate limit
- For Management API: The bucket refills every 1 second with 1,000 tokens
- You can immediately retry after the refill time shown in
X-RateLimit-Resetheader
Retry-After Header
When rate limited, the response includes:Designing for Scale
Strategy 1: Exponential Backoff Retry Logic
When receiving a 429 response, automatically retry with increasing delays:Strategy 2: Request Batching and Sequencing
Group operations and spread them over time to avoid burst traffic:Strategy 3: Monitor Token Bucket State
Use response headers to track your token consumption and adjust pacing:Token Bucket Example
Here’s a visual representation of how tokens flow:Calculating Request Rates
With a 1,000 token limit per 1 second refill:- Sustained rate: ~1,000 requests/second
- Burst capacity: Up to 1,000 consecutive requests before rate limiting
- Recovery time: 1 second for full bucket refill
- For steady workloads: Distribute requests evenly across the 1-second window
- For bursty workloads: Use retries and backoff when approaching the limit
Request Higher Limits
If your use case requires higher rate limits:- Email: [email protected]
- Docs: https://docs.clix.so