{"id":27010817,"url":"https://github.com/minimusubi/curseforge-api","last_synced_at":"2025-04-04T11:27:32.553Z","repository":{"id":49403604,"uuid":"517663386","full_name":"minimusubi/curseforge-api","owner":"minimusubi","description":"An easy to use library to help you consume the CurseForge for Studios API","archived":false,"fork":false,"pushed_at":"2024-04-15T16:48:17.000Z","size":463,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T00:24:11.192Z","etag":null,"topics":["curseforge","curseforge-api","curseforge-core-api","eternal-api"],"latest_commit_sha":null,"homepage":"https://minimusubi.github.io/curseforge-api/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/minimusubi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-07-25T12:50:43.000Z","updated_at":"2024-05-01T07:28:08.000Z","dependencies_parsed_at":"2024-04-15T17:06:12.383Z","dependency_job_id":"6467cfbd-71d2-41d0-a8d8-2449967e1cd8","html_url":"https://github.com/minimusubi/curseforge-api","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minimusubi%2Fcurseforge-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minimusubi%2Fcurseforge-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minimusubi%2Fcurseforge-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minimusubi%2Fcurseforge-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minimusubi","download_url":"https://codeload.github.com/minimusubi/curseforge-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247168621,"owners_count":20895143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curseforge","curseforge-api","curseforge-core-api","eternal-api"],"created_at":"2025-04-04T11:27:31.987Z","updated_at":"2025-04-04T11:27:32.541Z","avatar_url":"https://github.com/minimusubi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- omit in toc --\u003e\n# curseforge-api 🚀\nThis is a JavaScript module built around the new [CurseForge for Studios API](https://docs.curseforge.com/#getting-started) (also formerly known as \"Eternal API\" and \"CurseForge Core API\") following the deprecation of the older, unnofficial API. It is designed to be easy to use and has zero dependencies 🙌. More information about the CurseForge for Studios API is [available here](https://docs.curseforge.com/).\n\nThis module provides TypeScript typings.\n\nThis module uses `fetch()` under the hood to make requests. However, if you're using Node.js, keep in mind that `fetch()` was not added until `v17.5.0`, and is behind the `--experimental-fetch` flag until `v18.0.0`. For this reason, where `fetch()` is unavailable, the module can use a fetch polyfill such as [node-fetch](https://www.npmjs.com/package/node-fetch).\n\n\u003c!-- omit in toc --\u003e\n## Table of Contents\n1. [Documentation](#documentation)\n2. [Installation](#installation)\n\t1. [Node.js](#nodejs)\n\t2. [Deno and Browser](#deno-and-browser)\n3. [Usage](#usage)\n\t1. [Using a `fetch()` Polyfill](#using-a-fetch-polyfill)\n\t2. [Documentation](#documentation-1)\n\t3. [Examples](#examples)\n\t\t1. [Search for a mod via slug](#search-for-a-mod-via-slug)\n\t\t2. [Fetch a mod via project ID](#fetch-a-mod-via-project-id)\n\t\t3. [Fetch the latest Forge 1.18.2 file for Just Enough Items (JEI)](#fetch-the-latest-forge-1182-file-for-just-enough-items-jei)\n\t\t4. [Fetch a mod file and download URL](#fetch-a-mod-file-and-download-url)\n4. [Enums](#enums)\n\n## Documentation\nDocumentation is [available here](https://minimusubi.github.io/curseforge-api/) and is automatically generated from the source with [TypeDoc](https://typedoc.org/).\n\n## Installation\nImport the package depending on what type of environment you're using it in.\n\n### Node.js\nInstall the package [via npm](https://www.npmjs.com/package/curseforge-api):\n```\nnpm install curseforge-api\n```\n\nand import it in your script:\n```js\nimport {CurseForgeClient} from 'curseforge-api';\n```\n\n### Deno and Browser\nImport modules directly via CDN (for example, [esm.sh](https://esm.sh/), [Skypack](https://www.skypack.dev/), [jsDelivr](https://www.jsdelivr.com/) or [unpkg](https://www.unpkg.com/)):\n```js\n// Recommended for Deno\nimport {CurseForgeClient} from 'https://esm.sh/curseforge-api';\n// OR\nimport {CurseForgeClient} from 'https://cdn.skypack.dev/curseforge-api';\n// OR\nimport {CurseForgeClient} from 'https://cdn.jsdelivr.net/npm/curseforge-api';\n// OR\nimport {CurseForgeClient} from 'https://unpkg.com/curseforge-api'\n```\n\n## Usage\nStart by creating a [client](https://minimusubi.github.io/curseforge-api/classes/CurseForgeClient.html), which you will use to make most API queries:\n```js\nconst client = new CurseForgeClient('YOUR_API_KEY');\n```\n\n### Using a `fetch()` Polyfill\nIf you're using Node.js \u003c v17.5.0, you'll want to provide a `fetch()` polyfill such as [node-fetch](https://www.npmjs.com/package/node-fetch):\n```js\nimport fetch from 'node-fetch';\n\n// Pass fetch to the client\nconst client = new CurseForgeClient('YOUR_API_KEY', {fetch});\n```\n\nYou can also provide a different polyfill, for example, if you're running this in a browser environment and target older browsers that don't support `fetch()`. As seen above, simply pass the polyfilled `fetch` function to the client constructor via the options.\n\n### Documentation\nAll classes, functions, enums, and types are [documented here](https://minimusubi.github.io/curseforge-api/).\n\n### Examples\n#### Search for a mod via slug\n```js\nimport {CurseForgeGameEnum} from 'curseforge-api';\n\nconst modsResults = await client.searchMods(CurseForgeGameEnum.Minecraft, {slug: 'jei'});\nconst jei = modsResults.data[0];\nconsole.log(jei.name); // =\u003e 'Just Enough Items (JEI)'\nconsole.log(jei.id); // =\u003e 238222\n```\n\n#### Fetch a mod via project ID\n```js\nconst jei = await client.getMod(238222);\nconsole.log(jei.name); // =\u003e 'Just Enough Items (JEI)'\nconsole.log(jei.id); // =\u003e 238222\n```\n\n#### Fetch the latest Forge 1.18.2 file for Just Enough Items (JEI)\n```js\nimport {CurseForgeModLoaderType} from 'curseforge-api';\n\nconst files = await mod.getFiles(238222, {\n\tgameVersion: '1.18.2',\n\tmodLoaderType: CurseForgeModLoaderType.Forge,\n\tpageSize: 1,\n});\nconsole.log(files.data[0].fileName); // =\u003e 'jei-1.18.2-9.7.1.232.jar'\n```\n\n#### Fetch a mod file and download URL\n```js\nconst file = await mod.getFile(3847103);\nconsole.log(file.displayName); // =\u003e 'jei-1.18.2-9.7.0.209.jar'\nconsole.log(await file.getDownloadURL()); // =\u003e 'https://edge.forgecdn.net/files/3847/103/jei-1.18.2-9.7.0.209.jar'\n```\n\n## Enums\nFor convenience, the game IDs that were available at the time of publishing are [available as an enum](https://minimusubi.github.io/curseforge-api/enums/CurseForgeGameEnum.html). You can use this wherever you need to provide a game ID.\n\nThere are also enums and typings available for all documented types on the [CurseForge for Studios API](https://docs.curseforge.com/#schemas).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminimusubi%2Fcurseforge-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminimusubi%2Fcurseforge-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminimusubi%2Fcurseforge-api/lists"}