Rate Limits
The Mentium TMS API enforces rate limits to ensure fair usage and system stability.
Default Limits
| Limit Type | Default Value |
|---|---|
| Requests per minute | 100 |
| Requests per day | 10,000 |
These limits can be customized per API key in your dashboard.
Rate Limit Headers
Every API response includes headers showing your current rate limit status:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640000000| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed per minute |
X-RateLimit-Remaining | Requests remaining in current window |
X-RateLimit-Reset | Unix timestamp when the limit resets |
Handling Rate Limits
When you exceed the rate limit, you'll receive a 429 Too Many Requests response:
json
{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Please retry after 30 seconds.",
"retry_after": 30
}
}Best Practices
Implement exponential backoff
When rate limited, wait and retry with increasing delays:
python
import time
def make_request_with_retry(url, headers, max_retries=5):
for attempt in range(max_retries):
response = requests.get(url, headers=headers)
if response.status_code == 429:
retry_after = int(response.headers.get('Retry-After', 2 ** attempt))
time.sleep(retry_after)
continue
return response
raise Exception("Max retries exceeded")Use batch operations
Instead of making many individual requests, use batch operations to create or update multiple records in a single request.
Cache responses
Cache API responses when appropriate to reduce the number of requests.
Monitor your usage
Track the rate limit headers to proactively manage your request rate.
Increasing Your Limits
If you need higher rate limits, contact api-support@mentium.io to discuss your requirements.