Documentation
API Rate Limits
Understanding the rate limits and quotas for the PromptAI API.
Overview
To ensure fair usage and maintain service stability, the PromptAI API implements rate limiting. Rate limits are applied on a per-API key basis and vary depending on your subscription plan.
When you exceed your rate limit, the API will return a 429 Too Many Requests
response code.
Rate Limit Headers
The API includes rate limit information in the response headers to help you track your usage:
Header | Description |
---|---|
X-RateLimit-Limit | The maximum number of requests allowed in the current time window |
X-RateLimit-Remaining | The number of requests remaining in the current time window |
X-RateLimit-Reset | The time at which the current rate limit window resets (Unix timestamp) |
Example Response Headers
HTTP/1.1 200 OK
Content-Type: application/json
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1619712000
...
Rate Limit Plans
Rate limits vary based on your subscription plan. Here are the current rate limits for each plan:
Free Plan
- Requests per minute: 20
- Requests per day:∞ unlimited
- Requests per month:∞ unlimited
Pro Plan (SOON)
- Requests per minute:∞ unlimited
- Requests per day:∞ unlimited
- Requests per month:∞ unlimited
Need higher limits? Contact our sales team to discuss custom enterprise plans.
Handling Rate Limits
When you exceed your rate limit, the API will return a 429 Too Many Requests
response with a JSON body explaining the error.
Example Rate Limit Error
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1619712000
{
"status": "error",
"message": "Rate limit exceeded. Please try again in 45 seconds.",
"retry_after": 45
}
Best Practices for Handling Rate Limits
- Implement exponential backoff when retrying requests after receiving a rate limit error
- Monitor the
X-RateLimit-Remaining
header to track your usage - Cache responses when possible to reduce the number of API calls
- Batch requests together when fetching multiple resources
- Consider upgrading your plan if you consistently hit rate limits