The Open Agent Passport (OAP) API implements comprehensive rate limiting to ensure fair usage and system stability. This document defines the rate limiting rules, headers, and enforcement mechanisms.
All API responses include the following rate limiting headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200
X-RateLimit-Window: 3600
- X-RateLimit-Limit: Maximum number of requests allowed in the current window
- X-RateLimit-Remaining: Number of requests remaining in the current window
- X-RateLimit-Reset: Unix timestamp when the current window resets
- X-RateLimit-Window: Duration of the rate limit window in seconds
| Endpoint | Limit | Window | Notes |
|---|---|---|---|
/api/verify/{agent_id} |
1000 | 1 hour | Per agent ID |
/api/verify/policy/{pack_id} |
500 | 1 hour | Per policy pack |
/api/verify/decisions/{agent_id} |
100 | 1 hour | Per agent ID |
| Endpoint | Limit | Window | Notes |
|---|---|---|---|
/api/passports (POST) |
10 | 1 hour | Per owner |
/api/passports/{agent_id} (PUT) |
50 | 1 hour | Per agent ID |
/api/passports/{agent_id}/status (PUT) |
20 | 1 hour | Per agent ID |
| Endpoint | Limit | Window | Notes |
|---|---|---|---|
/api/verify/attestation/{id} |
2000 | 1 hour | Public endpoint |
/api/policies/{policy_name} |
1000 | 1 hour | Public policy lookup |
Rate limits are applied in tiers:
- Global Rate Limit: 10,000 requests per hour per IP
- Endpoint Rate Limit: Specific limits per endpoint
- User Rate Limit: Additional limits for authenticated users
- Agent Rate Limit: Limits specific to agent operations
Short-term burst requests are allowed:
- Burst Factor: 2x the normal rate limit
- Burst Window: 1 minute
- Burst Reset: 5 minutes
When rate limits are exceeded, the API returns:
{
"error": "rate_limit_exceeded",
"message": "Rate limit exceeded. Please try again later.",
"retry_after": 3600,
"rate_limit_info": {
"limit": 1000,
"remaining": 0,
"reset": 1640995200,
"window": 3600
}
}- 429 Too Many Requests: Rate limit exceeded
- 503 Service Unavailable: System overload protection
Rate limiting is implemented using:
- Redis: For distributed rate limit counters
- Sliding Window: For smooth rate limit enforcement
- Token Bucket: For burst allowance
Rate limiting metrics are tracked:
- Requests per second by endpoint
- Rate limit violations by IP/user
- System load and performance impact
- Respect Headers: Always check rate limit headers
- Exponential Backoff: Implement retry with backoff
- Caching: Cache responses to reduce API calls
- Batching: Combine multiple requests when possible
- Retry Logic: Implement intelligent retry mechanisms
- Fallback: Have fallback strategies for rate limit scenarios
- Monitoring: Track rate limit usage and violations
This rate limiting specification ensures:
- Fair Usage: Prevents abuse while allowing legitimate use
- System Stability: Protects against overload
- Scalability: Supports high-volume operations
- Transparency: Clear communication of limits and status