Skip to main content

Rate Limiting

Silent Witness applies rate limits to ensure fair usage and service quality.

Request Limits

LimitValue
Requests per hour1,000 per API key
Window typeSliding (not fixed hourly reset)

File Upload Limits

ConstraintValue
Maximum file size50MB per file
Supported image typesJPEG, PNG, GIF, WebP
Supported document typesPDF
Empty filesNot allowed

File type is detected from the file's bytes, not the Content-Type header your client sends.

Rate Limit Response

When you exceed the limit, the API returns 429 Too Many Requests:

{
"success": false,
"error": "Rate limit exceeded",
"error_code": "too_many_requests",
"error_type": "rate_limit_error",
"request_id": "req_abc123"
}

Handling Rate Limits

Implement exponential backoff when you receive a 429:

import time
import requests

def api_request(method, path, max_retries=3, **kwargs):
for attempt in range(max_retries):
resp = requests.request(
method, f"{BASE_URL}{path}",
headers={"X-API-Key": API_KEY},
**kwargs,
)

if resp.status_code == 429:
delay = 2 ** attempt # 1s, 2s, 4s
print(f"Rate limited, retrying in {delay}s...")
time.sleep(delay)
continue

return resp

raise Exception("Max retries exceeded")

Best Practices

  • Implement backoff — don't retry immediately after a 429
  • Upload files in parallel — file uploads are independent and can run concurrently
  • Cache responses — avoid re-fetching data you already have (e.g., case details)
  • Use one key per application — separate keys have separate limits
  • Contact support — request higher limits at support@silentwitness.ai if needed