Rate Limit

The rate limit defines the maximum number of requests an application can make to the API within a specified period of time. This mechanism is crucial to maintain the overall health and reliability of the services.

Why we use rate limiting

API stability and performance

  • Prevents a single client from overloading servers with excessive requests.

  • Ensures consistent and predictable response times for all clients.

  • Protects backend services from unexpected traffic spikes.

  • Maintains a stable and controlled load pattern on the infrastructure.

Security benefits

  • Strengthens defense against attack attempts, such as brute force.

  • Mitigates the risk of distributed denial-of-service attacks (DDoS).

  • Reduces impacts caused by poorly implemented integrations.

  • Limits potential damage resulting from compromised API credentials.

Resource allocation

  • Ensures balanced access to API resources for all clients.

  • Prevents abusive usage by some from degrading others' experience.

  • Allows prioritizing traffic according to business criteria and needs.

  • Encourages more efficient and sustainable API consumption practices.

How the rate limit works

  • Each call counts toward the allowed requests per second limit.

  • The default value is 10 RPS.

  • When exceeding the limit, the API returns HTTP 429 Too Many Requests.

Handling 429 errors (Too Many Requests)

When you receive a 429 error, implement the following strategies to handle it appropriately:

Request a temporary increase (or fixed) of the rate limit

  • If your operation will have an increase in request volume per second (temporarily or permanently), notify the Unico team so we can raise the rate limit for your environment.

Preferably, this rate limit increase request should be made BEFORE the volume actually increases (thus mitigating the chances of your application becoming inoperative due to hitting the current rate limit).

Review application behavior

  • Audit your code to identify inefficient API usage patterns.

  • Check for unintended loops or redundant API calls.

  • Distribute your requests more evenly over time, instead of sending them in large volumes within a short interval.

Implement caching

  • Cache frequently accessed data that rarely changes.

  • Implement appropriate cache invalidation strategies.

  • Use suitable expiration times based on data volatility.

  • Consider using ETags or Last-Modified for conditional requests.

Last updated

Was this helpful?