Skip to content

Rate Limiting

FreJun implements API rate limiting (throttling) to ensure fair usage and maintain service quality for all users. Rate limits are applied per organization and help prevent abuse while ensuring system stability.

FreJun enforces two types of rate limits:

  • Limit: 200 requests per minute per organization
  • Scope: Applied per endpoint
  • Purpose: Prevents short-term bursts of excessive requests

If you exceed this limit, you’ll receive a 429 error with the message:

Too many requests (org per minute limit reached)
  • Limit: 10,000 requests per day per organization
  • Scope: Applied per endpoint
  • Purpose: Ensures fair usage across all organizations over longer periods

If you exceed this limit, you’ll receive a 429 error with the message:

Too many requests (org per day limit reached)

When you hit a rate limit, the API will return:

  • HTTP Status Code: 429 Too Many Requests
  • Response Body: Contains details about which limit was exceeded

To avoid hitting rate limits:

  1. Implement Exponential Backoff: When you receive a 429 error, wait before retrying, and increase the wait time with each subsequent failure

  2. Cache Responses: Store API responses locally when appropriate to reduce the number of requests

  3. Batch Operations: Where possible, combine multiple operations into a single API call

  4. Monitor Your Usage: Track your API usage to stay within limits

  5. Handle Rate Limit Errors Gracefully: Implement proper error handling for 429 responses in your application

Here’s an example of how to handle rate limiting in your code:

import time
import requests
def make_api_request(url, headers, max_retries=3):
retries = 0
backoff = 1 # Initial backoff in seconds
while retries < max_retries:
response = requests.get(url, headers=headers)
if response.status_code == 200:
return response.json()
elif response.status_code == 429:
print(f"Rate limit exceeded. Retrying in {backoff} seconds...")
time.sleep(backoff)
backoff *= 2 # Exponential backoff
retries += 1
else:
response.raise_for_status()
raise Exception("Max retries exceeded")