Rate Limit Configuration
Default Limits
The API enforces the following rate limits:- 300 requests per minute per IP address
- Burst capacity: 300 requests
Rate limits are the same whether you use an authenticated request (with a token) or an unauthenticated request.
How GCRA Works
Modrinth uses GCRA for smooth rate limiting:- Requests are allowed at a steady rate (300/minute = 5 requests/second)
- You can burst up to 300 requests at once
- After a burst, you must wait for the rate limit to replenish
- The algorithm prevents thundering herd effects
Rate Limit Headers
Every API response includes rate limit information in the headers:Header Descriptions
integer
The maximum number of requests allowed per minute (always 300)
integer
The number of requests remaining in the current rate limit window
integer
The time in seconds until the rate limit fully resets
Monitoring Rate Limits
Always check these headers to avoid hitting rate limits:Rate Limit Exceeded
When you exceed the rate limit, the API returns a 429 Too Many Requests response.429 Response Example
Response Headers on 429
integer
The number of seconds to wait before making another request
integer
Will be 0 when rate limited
integer
Seconds until you can make requests again
Handling Rate Limits
Basic Retry Logic
Implement exponential backoff when you receive a 429:Advanced Rate Limit Management
Use a token bucket or queue to manage requests:Python Example with Backoff
Best Practices
1. Respect Rate Limit Headers
Always checkX-Ratelimit-Remaining before making bulk requests:
2. Implement Caching
Cache API responses to reduce the number of requests:3. Batch Requests
Use bulk endpoints when available:4. Spread Out Requests
Don’t burst all requests at once. Spread them over time:5. Use Conditional Requests
UseIf-None-Match headers with ETags to avoid downloading unchanged data:
6. Monitor Your Usage
Track your API usage over time:Rate Limit Exemptions
Internal Rate Limit Key
Modrinth provides a special rate limit bypass key for internal services. This is not available to public API users.Requesting Higher Limits
If you have a legitimate use case requiring higher rate limits:- Document your use case: Explain why you need higher limits
- Show optimization efforts: Demonstrate you’ve implemented caching and batching
- Provide contact information: Include your project details and contact info
- Contact Modrinth: Email admin@modrinth.com
Higher rate limits are granted on a case-by-case basis for projects that benefit the Modrinth ecosystem.
Cloudflare Integration
Modrinth uses Cloudflare for DDoS protection. The API checks for theCF-Connecting-IP header when Cloudflare integration is enabled.
IP Detection
Rate limits are applied based on:CF-Connecting-IPheader (if Cloudflare is enabled)- Request peer address (fallback)
Troubleshooting
Issue: Rate Limited Despite Low Usage
Possible causes:- Sharing an IP with other users (VPN, corporate network, cloud provider)
- Multiple applications using the same IP
- Burst of requests exceeding the limit
- Implement request spreading (5 requests/second max)
- Use caching to reduce requests
- Contact Modrinth if you have a dedicated IP and still face issues
Issue: Inconsistent Rate Limit Headers
Possible causes:- Redis connectivity issues (API falls back to reduced limits)
- Multiple API servers with slightly different state
- Don’t rely on exact values, use headers as guidance
- Implement retry logic for all requests
Issue: 401 Instead of 429
Cause: If the API cannot determine your IP address, you’ll receive a 401 error:- Check your network configuration
- Ensure you’re not blocking necessary headers
- Contact support if the issue persists
Summary
Current Limit
300 requests per minute per IP address with burst capacity
Headers
Monitor
X-Ratelimit-Remaining and X-Ratelimit-Reset headers429 Response
Implement exponential backoff using the
Retry-After headerBest Practices
Cache responses, batch requests, and spread traffic over time
Next Steps
Error Handling
Learn about all API error codes and responses
API Overview
Return to the API overview page
