Eranio
Color theme

Modrinth API

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

Modrinth is the second provider with direct server installation and needs no API key. The plugin searches only modpacks that can run on a server, lists their versions and downloads the primary .mrpack file with its SHA-1 hash. This page shows the calls against api.modrinth.com/v2 that sit behind the Modrinth tab of the modpack browser.

Handler: ModrinthProvider
GET /search

Search modpacks

Searches Modrinth for modpacks that can be used on a server and returns title, description, author, downloads, icon and last modification date.

Parameters

Name Type Required Description
query string No Search keyword. Omitted when the search field is empty.
facets string No Filter as a JSON array of arrays. The plugin sends [["project_type:modpack"],["server_side:required","server_side:optional"]].
limit integer No Results per page. The plugin uses the modpacks-per-page setting (default 20).

Response Example

{"hits":[{"slug":"simply-optimized","title":"Simply Optimized","project_type":"modpack","downloads":5000000}],"total_hits":100}

cURL

curl "https://api.modrinth.com/v2/search?query=optimized&facets=[[\"project_type:modpack\"]]"
The plugin sends a fixed facet filter: project_type:modpack combined with server_side:required or server_side:optional. Packs that are marked as client-only are therefore not listed. query is the keyword, limit the page size and offset the number of skipped results. Modrinth needs no key. The total shown in the browser comes from total_hits.

Internal Behavior

Mapping into the browser list: project_id, title, description, icon_url, author, downloads and date_modified. In the facet array the two server_side entries share one inner array and are therefore combined with OR, while the project type is a separate inner array combined with AND.
To install, the plugin downloads the .mrpack file, reads modrinth.index.json from the archive, downloads every file listed under files (using its first download address) and copies the overrides folder into the server directory. It also sets up a Fabric or Quilt server jar from the dependencies of the index. For Forge and NeoForge packs the loader is not installed automatically; the plugin logs a warning instead.
GET /project/{id|slug}/version

List modpack versions

Lists the versions of a Modrinth modpack with name, version number, release date, download count and changelog.

Parameters

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

Response Example

[{"id":"ver123","version_number":"1.5.0","game_versions":["1.20.1"],"files":[{"url":"https://cdn.modrinth.com/...","filename":"pack-1.5.0.mrpack"}]}]

cURL

curl "https://api.modrinth.com/v2/project/simply-optimized/version"
The plugin sends no filters for this call and shows all versions that Modrinth returns. The changelog of every version is kept and shown in the version selection. The game_versions parameter listed here is valid at Modrinth, but the plugin does not use it. For the download the plugin calls /version/{versionId}, takes the file marked primary (or the first file if none is marked) and remembers its SHA-1 hash from hashes.sha1 and its size.

Internal Behavior

A version without any file cannot be installed and ends the installation with a log entry. Version lists are fetched in parallel for several packs when the browser page is built, which keeps opening the list fast.