Projects
1. The Projects Client
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()2. Getting a Project
Use get() with a project ID or slug:
Project project = modrinth.projects().get("sodium");val 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.
3. Getting Multiple Projects
Use getMany() to fetch multiple projects by ID:
List<Project> projects = modrinth.projects().getMany(
"AANobbMI",
"gvQqBUqZ"
);val projects = modrinth.projects().getMany(
"AANobbMI",
"gvQqBUqZ"
)4. Searching Projects
Use search() with a SearchRequest:
SearchRequest request = SearchRequest.builder()
.query("optimization")
.limit(20)
.build();
SearchResult<Project> result = modrinth.projects().search(request);val request = SearchRequest.builder()
.query("optimization")
.limit(20)
.build()
val result = modrinth.projects().search(request)Search requests support queries, sorting indexes, pagination, and facets. The result contains the matching projects and pagination metadata.
5. Methods
ProjectsClient Methods 5 available methods
get()
Fetches a project by its ID or slug.
getMany()
Fetches multiple projects by their IDs.
search()
Searches for projects using a configured search request.
getVersions()
Returns project versions matching the provided search options.
getLatestVersion()
Resolves the latest project version matching a game version and one or more loaders.
6. Getting Project Versions
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);val options = VersionSearchOptions.builder()
.gameVersions("1.21.11")
.loaders(ModLoader.FABRIC)
.build()
val versions = modrinth.projects()
.getVersions("sodium", options)7. Getting the Latest Version
For the common case, resolve the latest compatible version directly:
Version latest = modrinth.projects().getLatestVersion(
"sodium",
"1.21.11",
ModLoader.FABRIC
);val latest = modrinth.projects().getLatestVersion(
"sodium",
"1.21.11",
ModLoader.FABRIC
)You can also provide multiple game versions and loaders using the alternative overload.
{/* Yes, the private half of ProjectsClient is intentionally not documented... */}