External API
This page documents the currently implemented DLC Manager external API.
The API is available on both:
- client
- dedicated server
Enable API
Configure the [api] section in config.dc or config-server.dc:
[api]
apiEnabled = true
apiPort = 10086
apiToken = "your_token_here"Fields:
apiEnabled: whether to enable the API serviceapiPort: API port, default10086apiToken: bearer token used for authentication
Authentication
All routes require:
Authorization: Bearer <apiToken>If apiToken is empty, all requests are rejected.
Common Rules
- Base path:
/api - Response format:
Success:
{
"ok": true,
"data": {}
}Failure:
{
"ok": false,
"error": {
"code": "not_found",
"message": "Unknown API route."
}
}OPTIONSis supported for CORS preflight- CORS is enabled with
Access-Control-Allow-Origin: *
Basic Endpoints
GET /api/ping
Health check.
Response fields:
servicerunningmode
GET /api/version
Returns current version data from DLC/info/version.dc.
Response fields:
basedlcrollback_fromchangelog_shownlabel
GET /api/state
Returns API/runtime summary.
Response fields:
serverRunningdedicatedServertotalItemsenabledItemscounts
GET /api/dlc/list
Returns grouped DLC items.
Each item may include:
ididentifiernametypeenabledbaselineEnabledpendinghiddenconfigTypealarmallowEnableByAllappliedTargetsourcePathsourcePathsdisplayNamestipsdependenciesconflicts
GET /api/dlc/pending
Returns pending DLC changes.
Response fields:
countitemsididentifiernametypeenabledbaselineEnabledpending
DLC Root / Config File Endpoints
GET /api/dlc/root/list
Lists editable .dc files under DLC roots.
Returned files are limited to:
<DLC>/info/**/*.dc<DLC>/remote/**/*.dc<DLC>/required/**/*.dc<DLC>/preset/**/*.dc<DLC>/update/**/*.dc<DLC>/notice.dc
Response fields:
rootCountrootsrootIndexrootPathfilesnamepathtypesupported
POST /api/dc/detect-type
Detect config type from path/name/content.
Request body:
{
"name": "example.dc",
"path": "remote/example.dc",
"content": "..."
}Response fields:
typesupported
POST /api/dc/validate
Validate a dc document.
Request body:
{
"type": "remote",
"content": "..."
}Response fields:
typesupportedvalidissues
Issue fields:
severitysourcefieldmessage
POST /api/dc/read
Read a dc file from the DLC workspace.
Request body:
{
"path": "remote/example.dc",
"rootIndex": 0
}Response fields:
namepathrootIndextypesupportedcontent
POST /api/dc/write
Write a dc file into the DLC workspace.
Request body:
{
"path": "remote/example.dc",
"rootIndex": 0,
"type": "remote",
"content": "..."
}Notes:
- For supported config types, the server parses content before writing.
- Paths outside the DLC workspace are rejected.
Response fields:
namepathrootIndextypesupportedwritten
POST /api/notice/content
Request body:
{
"url": "https://example.com/notice.md"
}Response fields:
urlcontent
File Endpoints
POST /api/file/add
Request body:
{
"path": "mods/example.jar",
"content": "..."
}Or:
{
"path": "config/example.txt",
"contentBase64": "SGVsbG8="
}Or:
{
"path": "mods/example.jar",
"source": "downloads/example.jar"
}Or create a directory:
{
"path": "tmp/example",
"directory": true
}Response fields:
pathcreateddirectory
POST /api/file/del
Request body:
{
"path": "mods/example.jar"
}Response fields:
pathdeleted
POST /api/file/mv
Request body:
{
"from": "mods/example.jar",
"to": "mods/example-disabled.jar"
}Response fields:
fromtomoved
POST /api/file/rename
Request body:
{
"path": "mods/example.jar",
"name": "example-disabled.jar"
}Response fields:
fromtorenamed
POST /api/file/upload
Upload raw binary content to a file path inside the game workspace.
Parameters:
path: target save path inside the game directory, for examplemods/example.jarorconfig/example.txt
Request body:
- raw binary body
Supported target path sources:
- query param
path - request header
X-Dlc-Path
Response fields:
pathuploadedsize
DLC Apply Endpoints
POST /api/dlc/enable
Request body:
{
"id": "mod:...|a.jar"
}Or:
{
"ids": ["mod:...|a.jar", "unknown:...|b.zip"]
}Or use identifiers:
{
"identifier": "example_mod"
}{
"identifiers": ["example_mod", "example_pack"]
}Response fields:
enabledchangeslinkedChangesunknownIdsunknownIdentifiers
POST /api/dlc/disable
Request body:
{
"id": "mod:...|a.jar"
}Or:
{
"ids": ["mod:...|a.jar", "unknown:...|b.zip"]
}Or use identifiers:
{
"identifier": "example_mod"
}{
"identifiers": ["example_mod", "example_pack"]
}Response fields:
enabledchangeslinkedChangesunknownIdsunknownIdentifiers
POST /api/dlc/apply
Apply current pending DLC changes only.
Request body:
{
"mode": "restart"
}Supported mode:
restartreload
Response fields:
modechangedCountrequiresRestarthotReloadedappliedChangesmessages
Remote Endpoints
GET /api/remote/list
Returns missing remote items.
Optional header:
X-Dlc-Lang: zh_cnPOST /api/remote/download
Downloads all currently missing remote items immediately.
Response fields:
successdownloadederror
POST /api/remote/download/start
Starts remote download task for selected keys.
Request body:
{
"keys": ["remote:key1", "remote:key2"],
"lang": "zh_cn"
}Response fields:
status
GET /api/remote/download/status
Returns remote download task status.
Optional header:
X-Dlc-Lang: zh_cnRequired Endpoints
GET /api/required/list
Returns required resource items.
Optional header:
X-Dlc-Lang: zh_cnPOST /api/required/download/start
Starts required download task for selected ids.
Request body:
{
"ids": ["id_a", "id_b"],
"lang": "zh_cn"
}Response fields:
status
GET /api/required/download/status
Returns required download task status.
Optional header:
X-Dlc-Lang: zh_cnPOST /api/required/download/cancel
Cancels current required download task.
Response fields:
canceled
POST /api/required/uninstall
Uninstalls selected required resources.
Request body:
{
"ids": ["id_a", "id_b"]
}Response fields:
removed
POST /api/required/apply
Applies selected required resources by id.
Request body:
{
"ids": ["id_a", "id_b"]
}Response fields:
applied
Update Endpoints
GET /api/update/state
Returns current update state and rollback history.
Response fields:
rollbackFromrolledBackhistory
GET /api/update/list
Returns current applicable update packages.
Response fields:
hasUpdatesupdates
Each update row may include:
nameplatformbasebase_newdlcdlc_newhiddenchangelog
POST /api/update/apply
Apply updates.
If no version pair is provided, applies the currently detected update chain.
Request body:
{
"baseOld": "1.0.0",
"dlcOld": "1.0.0",
"baseNew": "1.0.1",
"dlcNew": "1.0.2"
}Response fields:
successmissingmessagemissingPathsaddedRequiredaddedRemote
POST /api/update/rollback
Rollback to target version.
Request body:
{
"target": "1.0.0+1.0.0"
}Response fields:
successmessageversion
POST /api/update/import
Import an existing update package from inside the game directory.
Request body:
{
"path": "downloads/example-update.zip"
}Response fields:
successpath
POST /api/update/import-url
Download an update package from URL, then import it.
Request body:
{
"url": "https://example.com/update.zip",
"fileName": "update.zip"
}Response fields:
successmessagedownloadedPath