Rate LimitsΒΆ
ReputeAPI enforces rate limits to ensure fair usage and system stability.
Rate Limit TiersΒΆ
| Tier | Requests/Month | Requests/Minute | Requests/Second |
|---|---|---|---|
| Free | 1,000 | 10 | 2 |
| Basic | 10,000 | 60 | 10 |
| Premium | 50,000 | 120 | 20 |
| Enterprise | Custom | Custom | Custom |
Rate Limit HeadersΒΆ
Every API response includes rate limit information:
| Header | Description |
|---|---|
X-RateLimit-Limit |
Maximum requests allowed per minute |
X-RateLimit-Remaining |
Remaining requests in current window |
X-RateLimit-Reset |
Unix timestamp when the limit resets |
Rate Limit ExceededΒΆ
When you exceed your rate limit:
{
"error": "Rate limit exceeded",
"message": "You have exceeded your rate limit of 60 requests per minute",
"retry_after": 60
}
HTTP Status: 429 Too Many Requests
Handling Rate LimitsΒΆ
Python Example with RetryΒΆ
import requests
import time
def check_domain_with_retry(domain, max_retries=3):
"""Check domain with automatic retry on rate limit"""
for attempt in range(max_retries):
response = requests.get(
"https://api.reputeapi.com/api/v1/check",
params={"domain": domain},
headers={"X-API-Key": os.getenv("REPUTE_API_KEY")}
)
if response.status_code == 200:
return response.json()
elif response.status_code == 429:
# Rate limited - wait and retry
retry_after = int(response.headers.get("Retry-After", 60))
print(f"Rate limited. Waiting {retry_after} seconds...")
time.sleep(retry_after)
continue
else:
response.raise_for_status()
raise Exception("Max retries exceeded")
# Usage
result = check_domain_with_retry("example.com")
Exponential BackoffΒΆ
import time
def exponential_backoff(attempt):
"""Calculate backoff time with jitter"""
backoff = min(300, (2 ** attempt) + random.uniform(0, 1))
return backoff
for attempt in range(5):
try:
response = requests.get(...)
if response.status_code == 429:
wait_time = exponential_backoff(attempt)
time.sleep(wait_time)
continue
break
except Exception as e:
if attempt == 4:
raise
Best PracticesΒΆ
1. Cache ResponsesΒΆ
from functools import lru_cache
from datetime import timedelta
@lru_cache(maxsize=1000)
def get_domain_score(domain):
response = requests.get(
f"https://api.reputeapi.com/api/v1/score",
params={"domain": domain},
headers={"X-API-Key": API_KEY}
)
return response.json()
2. Use Webhooks (Enterprise)ΒΆ
Instead of polling, use webhooks to get notified of changes:
# Register webhook
requests.post(
"https://api.reputeapi.com/v1/webhooks",
json={
"url": "https://yourapp.com/webhook",
"events": ["domain.score_changed"]
},
headers={"X-API-Key": API_KEY}
)
3. Batch RequestsΒΆ
Use bulk endpoints when checking multiple domains:
# Instead of 100 individual requests
domains = ["example1.com", "example2.com", ...]
# Make 1 bulk request
response = requests.post(
"https://api.reputeapi.com/v1/validate/bulk",
json={"domains": domains},
headers={"X-API-Key": API_KEY}
)
4. Monitor Rate LimitsΒΆ
def monitor_rate_limits(response):
"""Log rate limit usage"""
limit = response.headers.get("X-RateLimit-Limit")
remaining = response.headers.get("X-RateLimit-Remaining")
usage_pct = (1 - int(remaining) / int(limit)) * 100
if usage_pct > 80:
print(f"β οΈ Warning: {usage_pct:.0f}% of rate limit used")
5. Spread RequestsΒΆ
Don't burst all requests at once:
import time
domains = ["domain1.com", "domain2.com", ...]
for domain in domains:
result = check_domain(domain)
# Add small delay to avoid bursting
time.sleep(0.1) # 100ms delay = max 10 req/sec
Upgrade Your PlanΒΆ
Need higher limits? Upgrade your plan
Rate Limit FAQsΒΆ
Q: Are rate limits per API key or per account? A: Per API key. You can create multiple keys for different applications.
Q: Do failed requests count toward limits? A: Yes, all requests (successful or not) count toward your limit.
Q: Can I temporarily exceed my limit? A: No. Requests beyond your limit will be rejected with HTTP 429.
Q: What happens if I upgrade mid-month? A: Your new limits take effect immediately.
Next StepsΒΆ
- Common Errors - Handle errors gracefully
- Best Practices - Optimize API usage
- Bulk Validation - Check multiple domains