Base URLs
Modrinth provides two API environments:Use the staging environment for testing and development. Switch to the production environment when your application is ready for production use.
Testing Your Connection
You can verify your API connection by making a GET request to the root endpoint:API Versioning
Modrinth follows a simple versioning pattern with version numbers in the URL path:- v2: Current stable version -
https://api.modrinth.com/v2 - v3: Latest version -
https://api.modrinth.com/v3
Version Migration
When a new major version is released:- The previous version is immediately considered deprecated
- No new features will be added to deprecated versions
- Deprecated versions will be maintained for a limited time
- Eventually, deprecated versions return a permanent 410 error
Data Format
All API endpoints return JSON-formatted responses withContent-Type: application/json.
Identifiers
Modrinth uses consistent identifier formats across the API:Base62 IDs
Most resources use unique 8-digit base62 identifiers:- Projects:
AABBCCDD - Versions:
IIJJKKLL - Users:
EEFFGGHH - Teams:
MMNNOOPP - Reports:
RRSSTTUU
Slugs and Usernames
Projects and users also have human-readable identifiers:- Project slugs:
sodium,fabric-api - Usernames:
my_username
While slugs and usernames can change, base62 IDs are permanent. Use IDs for long-term storage and references.
File Hashes
Version files are identified by SHA-1 or SHA-512 hashes:Pagination
Endpoints that return multiple items support pagination using offset/limit parameters:limit: Number of results per page (default: 10, max: 100)offset: Number of results to skip
Filtering and Sorting
Search Facets
Many endpoints support filtering via facets:categories: Filter by category (e.g., “technology”, “magic”)versions: Filter by game version (e.g., “1.20.1”)project_type: Filter by type (“mod”, “modpack”, “resourcepack”)loaders: Filter by mod loader (“fabric”, “forge”, “quilt”)
Sorting
Search results can be sorted using theindex parameter:
relevance: Most relevant (default)downloads: Most downloadsfollows: Most followsnewest: Newest firstupdated: Recently updated
User Agent Requirement
User Agent Format
Bad:CORS Support
The Modrinth API supports Cross-Origin Resource Sharing (CORS) with a wildcard same-origin policy:OpenAPI Specification
A complete OpenAPI 3.0 specification is available:- Swagger UI: https://api.modrinth.com/docs/swagger-ui
- OpenAPI JSON: https://api.modrinth.com/docs/openapi.json
- OpenAPI YAML: https://docs.modrinth.com/openapi.yaml
Common Response Patterns
Success Responses
200 OK - Request succeededError Responses
All errors follow a consistent format:Next Steps
Authentication
Learn how to authenticate API requests with personal access tokens and OAuth
Rate Limits
Understand rate limiting and how to handle 429 responses
Error Handling
Learn about HTTP status codes and error response formats
Projects API
Explore the projects and versions API endpoints
