Rate Limits¶
SubX API implements rate limiting to ensure fair usage and maintain service quality for all users.
Overview¶
Rate limits are applied per API key (or per IP for unauthenticated requests) to:
- Ensure normal usage - Prevent excessive requests that could impact service performance
- Guarantee service quality - Maintain fast response times for all users
- Fair resource allocation - Ensure all developers have equitable access to the API
How It Works¶
Each API key has request limits applied on a per-minute sliding window. If you exceed the limit, you'll receive a 429 Too Many Requests response with a Retry-After header indicating how many seconds to wait.
Response Headers¶
Every API response includes rate limit headers so you can track your current quota:
| Header | Description | Example |
|---|---|---|
X-RateLimit-Limit |
Maximum requests allowed per window | 60 |
X-RateLimit-Remaining |
Requests remaining in the current window | 42 |
X-RateLimit-Reset |
Unix timestamp (epoch) when the window resets | 1710700000 |
X-RateLimit-Window |
Window duration in seconds | 60 |
Retry-After |
Seconds to wait before retrying (429 responses only) | 45 |
Example Headers¶
Successful response (200):
HTTP/1.1 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 42
X-RateLimit-Reset: 1710700000
X-RateLimit-Window: 60
Rate limited response (429):
HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1710700000
X-RateLimit-Window: 60
Retry-After: 45
Using Retry-After¶
When you receive a 429 response, use the Retry-After header to know exactly how long to wait:
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)
Best Practices
- Monitor
X-RateLimit-Remainingto proactively slow down before hitting the limit - Use the
Retry-Afterheader value instead of hardcoded delays - Cache results when possible to reduce API calls
- Request only the data you need (use appropriate
limitparameters) :::
Need Higher Limits?¶
If your use case requires higher rate limits, please contact support with details about your application and expected usage patterns.