Rate Limiting & Best Practices

Understand the limitations of the API and best practices to optimize your integrations.

API

2 min read

Rate Limiting & Best Practices
Understanding Rate Limits
Best Practices for Handling Rate Limits
Conclusion
Rate Limiting & Best Practices
Understanding Rate Limits
Best Practices for Handling Rate Limits
Conclusion
Rate Limiting & Best Practices
Understanding Rate Limits
Best Practices for Handling Rate Limits
Conclusion

When integrating with the Documint API, it's crucial to understand and respect the rate limiting in place, which ensures fair usage and high availability for all users. This document outlines the API's rate limits and provides best practices for optimizing your integration.

Understanding Rate Limits

Rate limits are enforced to prevent any single user from consuming too many resources and potentially degrading the service for others. Documint's API employs rate limiting as follows:

  • Request Limit: You are allowed up to 100 requests per minute per API token.

  • Burst Limit: To accommodate bursts, you can make up to 20 requests in a single second, but this will count towards your overall minute limit.

Once a limit is exceeded, the API will return a 429 Too Many Requests status code, and you will need to wait before making additional requests.

Rate Limit Headers

Documint's API provides the following headers with each response to help you track your usage:

  • X-RateLimit-Limit: The maximum number of requests you're permitted to make per minute.

  • X-RateLimit-Remaining: The number of requests remaining in the current rate limit window.

  • X-RateLimit-Reset: The time at which the current rate limit window resets in UTC epoch seconds.

Best Practices for Handling Rate Limits

1. Monitor Your Request Rate

Use the rate limit headers provided to monitor your requests and adjust the frequency as necessary.

JavaScript

Copy

Copied

2. Implement Exponential Backoff

When you hit a rate limit, implement an exponential backoff strategy for retrying your requests.

JavaScript

Copy

Copied

3. Cache Responses When Possible

Cache data when it is not expected to change frequently. This will reduce the number of requests you make.

JavaScript

Copy

Copied

4. Spread Out Requests

Instead of making a burst of requests in a short period, spread them out evenly over time.

JavaScript

Copy

Copied

5. Use Webhooks for Real-Time Data

Instead of polling the API for real-time updates, use Documint's webhooks to receive updates when events occur.

6. Understand the API's Retry-After Header

When you receive a 429 status code, use the Retry-After header to determine how long to wait before retrying.

JavaScript

Copy

Copied

Conclusion

Adhering to these best practices will help you maintain a healthy and efficient integration with the Documint API. By being mindful of rate limits, implementing intelligent retry strategies, caching where appropriate, and using webhooks for real-time data, you can ensure that your application interacts with the Documint API in an optimized and responsible manner.

Rate Limiting & Best Practices
Understanding Rate Limits
Best Practices for Handling Rate Limits
Conclusion

© 2024 Documint

Designed by Framestack

© 2024 Documint

Designed by Framestack

© 2024 Documint

Designed by Framestack