Rate limiting
Safely retry API requests without side effects
To ensure fair usage and maintain high performance for all users, Posta implements rate limiting on API requests. This guide explains our rate limiting policy and how to handle rate limit errors.
Rate limit policy
Our standard rate limit is 150 requests per 5-second window per API Key. This limit applies to all endpoints.
We offer higher rate limits on a case-by-case basis. If you need increased limits, contact our support team to discuss your specific use case.
Rate limit headers
Every API response includes headers to help you track your rate limit status:
Header | Description |
---|---|
X-Rate-Limit-Limit | The maximum number of requests allowed in the current window |
X-Rate-Limit-Remaining | The number of requests remaining in the current window |
X-Rate-Limit-Reset | The time when the current rate limit window resets, in ISO 8601 UTC format |
Example headers:
Handling rate limits
When you exceed the rate limit, the API will return a 429 Too Many Requests
status code. To handle rate limits effectively and optimize your API usage, follow these best practices:
-
Monitor headers: Keep track of the
X-Rate-Limit-Remaining
header to anticipate when you might approach the limit. -
Distribute requests: Spread your requests evenly across time instead of sending them in bursts.
-
Implement retries with exponential backoff: When you receive a 429 response, wait for an increasing amount of time before retrying. This helps prevent overwhelming the API with immediate retries.
-
Optimize with batching: Where possible, use bulk endpoints or batch multiple operations into a single request to reduce the total number of API calls.
-
Cache responses: Store API responses locally when appropriate to reduce the need for repeated calls.
-
Monitor your usage: Regularly review your API usage patterns to identify opportunities for optimization and to anticipate when you might need to request a rate limit increase.
By following these practices, you can make the most efficient use of your rate limit and minimize disruptions to your integration.
If you consistently hit rate limits despite following these best practices, contact our support team to discuss your use case and potentially increase your rate limits.