The CurseForge API allows users to automate managing their projects, and retrieve data such as game versions and dependencies from CurseForge.


Please note URIs relative to the site the project is on (https://minecraft.curseforge.com for example), unless otherwise noted


Take me to...


Generate a Token

To access the API, you must first generate an API token. To do that, go to API Tokens.


Authentication

To authenticate with the API, you must provide your generated token using the X-Api-Token header, or the token query string parameter.


Game Dependencies API

To retrieve a list of game dependencies issue a GET request to /api/game/dependencies. It will return an array of json objects containing the following data:


{
    id: 42,
    name: "Bukkit",
    slug: "bukkit"
}

Game Versions API

To retrieve a list of game versions issue a GET request to /api/game/versions. It will return an array of json objects containing the following data:


{
    id: 158,
    gameVersionTypeID: 42,
    name: "1.8.4",
    slug: "1-8-4"
}

Project Upload File API

To upload a file, issue a POST multipart/form-data request to /api/projects/{projectId}/upload-file, containing two fields: metadata and file, which must be the actual file. The ID of your project will be in the URL when you go to its overview page.


metadata must contain a json object with the following fields:


{
	changelog: "A string describing changes.", // Can be HTML or markdown if changelogType is set.
    changelogType: ["text", "html", "markdown"], // Optional: defaults to text
    displayName: "Foo", // Optional: A friendly display name used on the site if provided.
    parentFileID: 42, // Optional: The parent file of this file.
    gameVersions: [157, 158], // A list of supported game versions, see the Game Versions API for details. Not supported if parentFileID is provided.
    releaseType: "alpha", // One of "alpha", "beta", "release".
    relations:
    {
        projects: 
        [{
        	slug: "mantle", // Slug of related plugin.
            type: ["embeddedLibrary", "incompatible", "optionalDependency", "requiredDependency", "tool"] // Choose one
        }]
     } // Optional: An array of project relations by slug and type of dependency for inclusion in your project.
}


On successful upload, returns a json object containing the new file's ID:


{
	id: 20402
}

Project File Management API

To update a file, issue a POST multipart/form-data request to /api/projects/{projectId}/update-file, containing the field: metadata. The ID of your project will be in the URL when you go to its overview page.


metadata must contain a json object with the following fields:


{
	fileID: 20402, // This is the file ID you are updating. This is required.
    
    // Note: These are all optional fields, you can include any of these in any combination.
    // The API will fail if you do not include any settings to change.
    changelog: "A string describing changes.", // Can be HTML or markdown if changelogType is set.
    changelogType: ["text", "html", "markdown"], // Choose one, defaults to text
    displayName: "Foo", // A friendly display name used on the site if provided.
    gameVersions: [157, 158], // A list of supported game versions, see the Game Versions API for details. Not supported if parentFileID is provided.
    releaseType: "alpha", // One of "alpha", "beta", "release".
    relations: 
    {
    	projects: 
        	[{
            	slug: "mantle", // Slug of related plugin.
                type: ["embeddedLibrary", "incompatible", "optionalDependency", "requiredDependency", "tool"] // Choose one
            }]
     } // Optional: An array of project relations by slug and type of dependency for inclusion in your project.
}


On successful upload, returns a json object containing the old file ID:

{
	id: 20402
}

Maven

CurseForge includes a maven endpoint so that you can include your dependancies using any build scripts that support maven. Please note that due to how maven works you do not provide your API key as a header, but as part of the maven URL. 


https://www.curseforge.com/api/maven/{projectSlug}/{mavenArtifact}/{mavenVersion}/{projectFileNameArtifact}-{projectFileNameVersion}-{projectFileNameTag}.jar


This is the Maven full URL. Below is the explanation of each part, and where you can find that information. For the examples below we will be using the CoFHCore Project.


{projectSlug}: The slug of the project you want to use. In our example its cofhcore

{mavenArtifiact}: This should be the files name, in our example CoFHCore-1.10.2

{mavenVersion}: This should be what release you want, in our case we are going to use release as this gives us the latest, but you can also use the file version in the name (Such as 4.1.0.155 for CoFHCore-1.10.2-4.1.0.155-universal.jar)

{projectFileNameArtifact}: The same as mavenArtifact

{projectFileNameVersion}: The same as mavenVersion

{projectFileNameTag}: The name tag on the file, on older mods it would be dev on newer ones it might be universal, in our case its universal


This puts our final example link at:


https://minecraft.curseforge.com/api/maven/cofhcore/CoFHCore-1.10.2/release/CoFHCore-1.10.2-release-universal.jar

If you want to use the maven with ForgeGradle I've also provided the same example in the script below


This goes above apply plugin: 'forge'


repositories 
{
	maven
    {
    	name = "CurseForge"
        url = "https://minecraft.curseforge.com/api/maven/"
    }
}


Then add this to dependencies:


compile 'cofhcore:CoFHCore-1.10.2:release:universal'


Localization

Export

The localization API allows exporting via a GET request. Below is the list of optional parameters that are accepted by the endpoint. These all correspond to the available feature on the export page, and none are required.


https://wow.curseforge.com/api/projects/{projectID}/localization/export

 

 

ParameterOptionsDefault

Description

export-type[Table, TableAdditions, GlobalStrings]TableAdditionsWhat format you want your export to be in
lang[enUS, deDE, esES, ect]enUSThe locale for language you are exporting
unlocalized[ShowPrimary, ShowPrimaryAsComment, ShowBlankAsComment, Ignore]ShowPrimaryWhat happens to unlocalized phrases must be one of the following
table-nameAny stringLName of the your table, this defaults to L
escape-non-ascii-characters[true, false]falseEscape non-ASCII characters
true-if-value-equals-key[true, false]falseSet value to true if equals to key
concatenante-subnamespaces[true, false]falseConcatenate subnamespaces with /
namespacesAny namespace name, comma delimitedBase NamespaceList of namespaces you want to include by name, defaults to your base namespace


Import

The localization API allows importing via a POST request with a JSON data blob. 


https://wow.curseforge.com/api/projects/{projectID}/localization/import


 Below is an example payload:


{
	metadata:
    {
    	//Note all of these are optional exception language
        language: "enUS", //[enUS, deDE, esES, ect], Required, No Default
        namespace: "toc", //Any namespace name, comma delimited. Default: Base Namespace
        formatType: TableAdditions, //['GlobalStrings','TableAdditions','SimpleTable']. Default: TableAdditions
        missing-phrase-handling: DoNothing //['DoNothing', 'DeleteIfNoTranslations', 'DeleteIfTranslationsOnlyExistForSelectedLanguage', 'DeletePhrase']. Default: DoNothing
     },
     localizations: "Localizations To Import"
}