Overview
Guardian API supports optional rate limiting using Redis (Upstash compatible). Rate limiting helps prevent API abuse and ensures fair usage.Setup
1. Create Upstash Redis Database
- Create a free account at Upstash
- Create a new Redis database
- Copy the Redis URL from your dashboard
2. Configure Environment
Add tobackend/.env:
3. Restart API
Default Limits
| Limit Type | Default Value |
|---|---|
| Requests per IP | 100 per minute |
| Window | 60 seconds |
Behavior
When Limit Exceeded
Response Code: 429 Too Many Requests Response Body:Fail-Open Design
If Redis is unavailable:- API continues to work
- Rate limiting is temporarily disabled
- Warning logged but requests succeed
This fail-open design ensures the API remains available even if Redis has issues.
Custom Rate Limits
To customize rate limits, modifybackend/app/core/rate_limit.py:
Monitoring
Check rate limit usage by monitoring Redis:Disable Rate Limiting
To disable rate limiting, simply don’t setREDIS_URL in your .env file or remove it entirely.
See Also
- Environment Variables - All configuration options
- Installation - Setup guide