Skip to content

Projects

The ProjectsClient provides access to Modrinth projects.

You can fetch individual projects, retrieve multiple projects at once, search for projects, and resolve project versions.

modrinth.projects()

Use get() with a project ID or slug:

Project project = modrinth.projects().get("sodium");

The returned Project is automatically attached to the current Modrinth client, allowing client-dependent convenience methods such as Project.getLatestVersion() to be used. :contentReference[oaicite:1]{index="1"}

Use getMany() to fetch multiple projects by ID:

List<Project> projects = modrinth.projects().getMany(
"AANobbMI",
"gvQqBUqZ"
);

Use search() with a SearchRequest:

SearchRequest request = SearchRequest.builder()
.query("optimization")
.limit(20)
.build();
SearchResult<Project> result = modrinth.projects().search(request);

Search requests support queries, sorting indexes, pagination, and facets. The result contains the matching projects and pagination metadata. :contentReference[oaicite:2]{index="2"}

ProjectsClient Methods7 available methods
get()

Fetches a project by its ID or slug.

Returns: Project
getMany()

Fetches multiple projects by their IDs.

Returns: List<Project>
search()

Searches for projects using a configured search request.

Returns: SearchResult<Project>
getVersions()

Returns project versions matching the provided search options.

Returns: List<Version>
getLatestVersion()

Resolves the latest project version matching a game version and one or more loaders.

Returns: Version

Use getVersions() to fetch versions matching a VersionSearchOptions configuration:

VersionSearchOptions options = VersionSearchOptions.builder()
.gameVersions("1.21.11")
.loaders(ModLoader.FABRIC)
.build();
List<Version> versions = modrinth.projects()
.getVersions("sodium", options);

For the common case, resolve the latest compatible version directly:

Version latest = modrinth.projects().getLatestVersion(
"sodium",
"1.21.11",
ModLoader.FABRIC
);

You can also provide multiple game versions and loaders using the alternative overload. :contentReference[oaicite:3]{index="3"}