Skip to main content
The Modrinth API uses conventional HTTP status codes and returns structured error messages to help you debug issues quickly.

Error Response Format

All API errors follow a consistent JSON structure:
Some errors may include additional details:

HTTP Status Codes

The API uses standard HTTP status codes to indicate the success or failure of requests.

Success Codes (2xx)

success
Request succeeded. Response body contains the requested data.
success
Resource successfully created. Response body contains the new resource.
success
Request succeeded but there’s no response body (e.g., DELETE operations).
success
Resource hasn’t changed since the last request (when using If-None-Match with ETags).

Client Error Codes (4xx)

error
The request is malformed or contains invalid data.Common error types:
  • invalid_input: Invalid request parameters
  • json_error: Malformed JSON in request body
  • xml_error: Malformed XML data
  • validation_error: Data failed validation rules
error
Authentication is required or credentials are invalid.Common error types:
  • unauthorized: Missing or invalid authentication token
  • auth_error: Authentication failed
Solutions:
  • Include a valid Authorization header
  • Check that your token hasn’t expired
  • Verify your token hasn’t been revoked
error
You’re authenticated but don’t have permission to perform this action.Common causes:
  • Token lacks required scope
  • Attempting to modify someone else’s resource
  • Attempting a restricted operation
error
The requested resource doesn’t exist.
Common causes:
  • Invalid project/version/user ID
  • Resource has been deleted
  • Typo in the endpoint URL
error
The request conflicts with the current state of the resource.
Common scenarios:
  • Duplicate slug or username
  • Concurrent modification conflicts
  • Resource state prevents the operation
error
The API version or resource has been permanently removed.
Solution: Migrate to a supported API version (v2 or v3).
error
You’ve exceeded the rate limit.
Response headers:
See Rate Limits for detailed handling strategies.

Server Error Codes (5xx)

error
An unexpected error occurred on the server.Common error types:
  • internal_error: Unexpected server error
  • database_error: Database operation failed
  • search_error: Search engine error
What to do:
  • Retry the request after a short delay
  • If the error persists, report it to Modrinth support
error
The API server received an invalid response from an upstream server.Common causes:
  • Temporary connectivity issues
  • Upstream service degradation
Solution: Retry with exponential backoff.
error
The API is temporarily unavailable.Common causes:
  • Scheduled maintenance
  • Server overload
  • Deployment in progress
Solution: Retry after waiting. Check Modrinth’s status page.
error
The request took too long to process.Common causes:
  • Complex search queries
  • Large file uploads
  • Database slowdowns
Solutions:
  • Simplify your query
  • Break large requests into smaller chunks
  • Retry the request

Common Error Types

Here’s a reference of error type strings returned in the error field:

Authentication Errors

Input Validation Errors

Resource Errors

Rate Limiting

Server Errors

External Service Errors

Error Handling Best Practices

1. Implement Comprehensive Error Handling

2. Use Exponential Backoff for Retries

3. Log Errors for Debugging

4. Provide User-Friendly Error Messages

Debugging Tips

Check Response Headers

Always inspect response headers for debugging information:

Verify Your Request

  1. Check the HTTP method: Ensure you’re using the correct method (GET, POST, etc.)
  2. Validate the URL: Check for typos in the endpoint path
  3. Inspect headers: Ensure required headers are present
  4. Verify request body: Validate JSON syntax and required fields

Test with cURL

Test your requests using cURL to isolate issues:

Common Mistakes

Error: Unable to obtain user IP address! or blocked requestsSolution: Always include a User-Agent header:
Error: invalid_input or decoding_errorSolution: Some endpoints only accept IDs, not slugs. Check the API documentation for the specific endpoint.
Error: unauthorizedSolution: Use the token directly without “Bearer”:
Error: unauthorized with message about missing scopeSolution: Create a new token with the required scopes from your account settings.

Getting Help

If you’re experiencing issues:
  1. Check the documentation: Verify you’re using the correct endpoint and parameters
  2. Search existing issues: Look for similar problems on GitHub
  3. Join the community: Ask questions on Modrinth’s Discord
  4. Contact support: For persistent issues, email support@modrinth.com

What to Include in Bug Reports

When reporting API issues, include:
  • Request details: Method, URL, headers (excluding tokens)
  • Response: Status code, error message, response headers
  • Expected behavior: What you expected to happen
  • Actual behavior: What actually happened
  • Steps to reproduce: Minimal code example
  • Environment: Programming language, library versions

Summary

Consistent Format

All errors return error and description fields in JSON format

Standard Codes

Uses HTTP status codes: 4xx for client errors, 5xx for server errors

Retry Logic

Implement exponential backoff for server errors and rate limits

Helpful Messages

Error descriptions provide actionable guidance for resolution

Next Steps

API Overview

Learn about API basics and common patterns

Authentication

Fix authentication and authorization errors