Eranio
Color theme

Modrinth API

Base: https://api.modrinth.com/v2

Modrinth is an open mod platform whose public API needs no key, which makes it the easiest provider to start with. The plugin searches projects with facets, lists the versions of a project and reads the primary file of a version for the download. This page shows the Modrinth calls behind the mod browser at api.modrinth.com/v2, including the filters the plugin builds from your server settings.

Handler: ModrinthProvider
GET /search

Search projects

Searches Modrinth projects with facets and returns hits with title, author, description, downloads, icon and supported versions.

Parameters

Name Type Required Description
query string No Search keyword. Leave empty to list the most downloaded mods.
facets string No Filter as a JSON array of arrays, for example [["project_type:mod"],["categories:fabric"]].
limit integer No Results per page. The plugin uses the mods-per-page setting (default 20), Modrinth itself defaults to 10.
offset integer No Number of results to skip, calculated from the page number.

Response Example

{"hits":[{"slug":"fabric-api","title":"Fabric API","description":"Essential hooks for modding with Fabric","project_type":"mod","downloads":250000000,"icon_url":"https://cdn.modrinth.com/...","versions":["1.20.1","1.21"]}],"offset":0,"limit":10,"total_hits":1}

cURL

curl "https://api.modrinth.com/v2/search?query=fabric-api&facets=[[\"project_type:mod\"]]&limit=5"
No API key is needed. The plugin always sends the facet project_type:mod and adds more facets from your choices: a loader category (not for the entries all or any), the selected game version and a category. A short version like 1.21 is expanded to all matching release versions such as 1.21.1 and 1.21.4, taken from the Mojang version list. The index parameter carries the sort order: relevance when you entered a keyword, downloads when the keyword is empty. limit is the mods-per-page setting and offset is (page minus 1) times limit.

Internal Behavior

The facets are sent as a JSON array of arrays: entries in the same inner array are combined with OR, separate inner arrays with AND. So a version filter with several patch versions matches any of them, while loader and version must both match.
Results come back as hits with total_hits. The plugin maps project_id (or the slug), title, description, author, downloads, icon_url, date_modified and categories into its own list format. A non-200 answer is logged as a Modrinth warning and the browser shows an empty list.
GET /project/{id|slug}

Get project

Returns a single Modrinth project by ID or slug with description, download count, side support and loaders.

Parameters

Name Type Required Description
id|slug string Yes Project ID (for example AANobbMI) or slug (for example sodium).

Response Example

{"slug":"fabric-api","title":"Fabric API","description":"Essential hooks...","downloads":250000000,"project_type":"mod","server_side":"required","loaders":["fabric","quilt"]}

cURL

curl "https://api.modrinth.com/v2/project/fabric-api"
The Game Mods Installer does not call this endpoint itself. For Modrinth it works with the data of the search hits, because the slug is identical to the ID it stores. The endpoint is part of the public Modrinth API and is listed so you can check a project ID or slug before you rely on it, for example in a script that talks to the installed mods list. The answer contains server_side and client_side, which tell you whether a mod belongs on a server at all.

Internal Behavior

No plugin code is involved, the test tool calls api.modrinth.com directly. A 404 means the ID or slug does not exist. Modrinth accepts both forms, but the plugin stores the project ID as mod_id for installed mods.
GET /project/{id|slug}/version

List versions

Lists all versions of a Modrinth project with version number, release date, supported game versions, loaders and files.

Parameters

Name Type Required Description
id|slug string Yes Project ID or slug.
loaders string No JSON array of loaders, for example ["fabric"]. Valid at Modrinth, not sent by the plugin.
game_versions string No JSON array of game versions, for example ["1.20.1"]. Valid at Modrinth, not sent by the plugin.

Response Example

[{"id":"abcd1234","version_number":"0.91.0","game_versions":["1.20.1"],"loaders":["fabric"],"files":[{"url":"https://cdn.modrinth.com/...","filename":"fabric-api-0.91.0.jar","hashes":{"sha1":"..."}}],"dependencies":[]}]

cURL

curl "https://api.modrinth.com/v2/project/fabric-api/version?loaders=[\"fabric\"]&game_versions=[\"1.20.1\"]"
Modrinth accepts the filters loaders and game_versions as JSON arrays. The plugin sends neither of them in its own request and narrows the list afterwards by game version and loader. The files array of a version contains the download link; the plugin takes the file marked primary and falls back to the first file. If a version has no files, it cannot be installed. Version lists are cached for a while, so a version that was published a minute ago may not show up yet.

Internal Behavior

For the download the plugin calls /version/{versionId} and reads files[].url and files[].filename. Required dependencies (dependency_type required) are read from the same answer; a dependency with a pinned version_id is taken as is, otherwise the plugin picks the first version of the dependency whose game version and loader overlap with the parent, and the newest one if nothing overlaps. The automatic installation of dependencies before the mod is currently done for CurseForge only.