To ensure fair usage and maintain the performance of the system, rate-limits are implemented across all endpoints.
This article will provide an overview of how rate-limits work in the Hook0 REST API, the specific rate-limit values, the consequences of hitting the rate-limits, and best practices for developers to handle rate-limits effectively.
The Hook0 REST API uses Rust actix_governor underneath to enforce rate-limits.
Every endpoint in the Hook0 REST API is subject to rate-limits. These limits apply to all users, regardless of whether they are on a free or paid plan. The rate-limits are as follows:
- Global: 1000 requests per second (burst at 2000)
- Per IP: 100 requests per second (burst at 200)
- Per Token: 10 requests per second (burst at 20)
The API will return a
429 HTTP status code when a user exceeds the allowed request rate.
Developers need to be aware of rate-limits and account for them in their application's error handling. When the API returns a 429 HTTP status code, it indicates that the rate-limit has been exceeded. In such cases, developers should implement a back-off strategy, such as exponential back-off, to retry the request after a specified interval.
- Monitor usage: Keep track of the number of requests made to the API and adjust the request frequency to avoid hitting rate-limits.
- Implement back-off strategies: When the API returns a 429 HTTP status code, implement a back-off strategy to pause and retry the request after a specified interval.
- Optimize API calls: Wherever possible, optimize your application's use of the API by reducing the number of requests or batching requests together.
- Graceful error handling: Ensure that your application can handle rate-limit errors gracefully, displaying appropriate messages to users and maintaining functionality where possible.
- Stay informed: Keep up to date with any changes or updates to the Hook0 REST API rate-limits by monitoring the documentation and subscribing to relevant notifications.
At present, there is no difference in rate-limits between free and paid plans. However, this may change in the future. Be sure to stay informed of any updates to rate-limits by monitoring the Hook0 REST API documentation and subscribing to relevant notifications.
Understanding and handling rate-limits is essential for developing robust and reliable applications using the Hook0 REST API. By adhering to best practices and monitoring your application's usage, you can ensure that your application remains performant and provides a great user experience.
Updated 5 months ago