/api/ctai endpoint enforces a per-IP sliding window rate limit to protect the service from abuse. The /api/health endpoint is not rate-limited.
Default limits
| Setting | Default value |
|---|---|
| Requests allowed per window | 5 |
| Window duration | 60 seconds |
cf-connecting-ip, x-forwarded-for, or x-real-ip headers (in that order of preference).
429 response
When you exceed the rate limit, the API returns an HTTP429 status with a JSON body and rate limit headers.
Status: 429 Too Many RequestsContent-Type:
application/json
Response body
Always
"Too many requests".The number of seconds to wait before retrying. Always at least
1.Response headers
| Header | Description |
|---|---|
Retry-After | Seconds to wait before retrying. Same value as retryAfterSeconds in the body. |
X-RateLimit-Limit | Maximum number of requests allowed per window. |
X-RateLimit-Window | Window duration in seconds. |
Handling 429 in your client
Check the HTTP status before reading the response body. If you receive a429, read retryAfterSeconds and pause before retrying.
Configuration
Set these environment variables before starting the server:| Variable | Default | Description |
|---|---|---|
RATE_LIMIT_POINTS | 5 | Maximum requests per IP per window. |
RATE_LIMIT_DURATION | 60 | Window duration in seconds. |