Skip to main content
The Modrinth API implements rate limiting to ensure fair usage and maintain service quality for all users. Rate limits are applied per IP address using the GCRA (Generic Cell Rate Algorithm).

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 check X-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

Use If-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.
Do not attempt to use or guess the internal rate limit key. Unauthorized use may result in your IP being blocked.

Requesting Higher Limits

If you have a legitimate use case requiring higher rate limits:
  1. Document your use case: Explain why you need higher limits
  2. Show optimization efforts: Demonstrate you’ve implemented caching and batching
  3. Provide contact information: Include your project details and contact info
  4. 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 the CF-Connecting-IP header when Cloudflare integration is enabled.

IP Detection

Rate limits are applied based on:
  1. CF-Connecting-IP header (if Cloudflare is enabled)
  2. Request peer address (fallback)
Using a proxy or VPN may cause you to share a rate limit with other users on the same IP address.

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
Solutions:
  • 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
Solutions:
  • 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:
Solution:
  • 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 headers

429 Response

Implement exponential backoff using the Retry-After header

Best 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