Rate Limits & Best Practices
The Osigu Payments API has been designed to handle high volumes of requests efficiently. Rate limits are enforced on API requests to ensure the platform's stability and reliability. Below are details on rate limits and best practices for optimizing your integration with Osigu Payments.
Rate Limits
Osigu Payments enforces the following rate limits per client:
- Request Limit: 60 requests per minute (subject to change based on service level agreements).
- Burst Limit: A maximum of 10 requests per second can be made quickly before applying throttling.
If a rate limit is exceeded, the API will return a 429 Too Many Requests
status code. When you receive this response, wait for the designated cooldown before resuming requests.
Best Practices for Optimizing API Usage
To ensure efficient use of the Osigu Payments API and avoid hitting rate limits, we recommend the following best practices:
-
Implement Retry Logic:
- When a request fails due to rate limiting (status code
429
), implement a retry mechanism with exponential backoff. This means waiting for progressively longer intervals before each retry attempt, reducing server load and avoiding repeated failures.
- When a request fails due to rate limiting (status code
-
Use Caching for Non-Real-Time Data:
- For data that doesn’t require real-time updates (such as static reference data), cache responses locally on your end. This reduces redundant API calls and improves your application's efficiency.
-
Batch Requests Where Possible:
- If the API supports batch operations, combine multiple operations into a single request. This reduces the number of API calls and lowers the risk of hitting rate limits.
-
Optimize Data Fetching:
- Use query parameters and filters to retrieve only the data you need. Avoid requesting large data sets unnecessarily, as this can contribute to higher usage rates and increased response times.
-
Monitor API Usage:
- Regularly monitor your API usage against rate limits. Set up alerts to notify your team when you are approaching rate limits so they can investigate and optimize API interactions if needed.
-
Handle Token Expiration Gracefully:
- Access tokens are valid for 24 hours and must be renewed when expired. Ensure your application checks for token expiration and renews tokens proactively to avoid interruptions in service.
-
Coordinate High-Volume Requests During Off-Peak Hours:
- If possible, schedule high-volume requests during times of lower traffic. This reduces the likelihood of hitting rate limits and helps ensure smooth operation.
Example Response for Exceeding Rate Limit
When rate limits are exceeded, you will receive a response similar to the following:
{
"code": "TOO_MANY_REQUESTS",
"message": "Rate limit exceeded. Please wait and retry after 60 seconds."
}
This response includes the error type (TOO_MANY_REQUESTS
) and a message with a suggested wait time before retrying. Implement error handling to gracefully manage these responses and minimize the impact on your application.
These best practices will help you maximize the Osigu Payments API and ensure a stable, reliable integration experience.
Updated 6 days ago