File Manager API
Get File List
GET /api/files/listQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
target: string; // File(name or directory) Path
page: number; // Starts from 0
page_size: number; // 1 - 100, default 10
file_name: string; // Optional, filter by file name
}Response
{
"status": 200,
"data": {
"items": [
{
"name": "Genshin Impact",
"size": 0, // byte
"time": "Fri Jun 07 2024 08:53:34 GMT+0800 (中国标准时间)",
"mode": 777, // Linux file permission
"type": 0 // 0 = Folder, 1 = File
},
{
"name": "NEKO-MIMI SWEET HOUSEMATES Vol. 1",
"size": 0,
"time": "Thu Jun 06 2024 18:25:14 GMT+0800 (中国标准时间)",
"mode": 777,
"type": 0
},
{
"name": "Poly Bridge",
"size": 0,
"time": "Thu Jun 06 2024 18:25:14 GMT+0800 (中国标准时间)",
"mode": 777,
"type": 0
},
{
"name": "Wuthering Waves",
"size": 0,
"time": "Fri Jun 07 2024 04:32:58 GMT+0800 (中国标准时间)",
"mode": 666,
"type": 0
},
{
"name": "AngryBirdsSeasons",
"size": 0,
"time": "Thu Jun 06 2024 18:25:14 GMT+0800 (中国标准时间)",
"mode": 777,
"type": 0
},
{
"name": "secret base_君がくれたもの【Covered by Kotoha】.mp4",
"size": 13253857,
"time": "Thu Jun 06 2024 19:37:35 GMT+0800 (中国标准时间)",
"mode": 666,
"type": 1
}
],
"page": 0,
"pageSize": 100,
"total": 6,
"absolutePath": "\\"
},
"time": 1718594177859
}Get File Status
GET /api/files/statusQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Response
{
"status": 200,
"data": {
"instanceFileTask": 0, // Number of file tasks for this instance
"globalFileTask": 0, // Number of file tasks across the daemon
"downloadFileFromURLTask": 0, // Number of active URL download tasks
"downloadTasks": [
{
"taskId": "xxx",
"path": "/path/to/file",
"total": 1024,
"current": 512,
"status": 0,
"error": null
}
],
"platform": "linux", // OS platform
"isGlobalInstance": false, // Whether the instance is the global instance
"disks": [] // Windows disk list
},
"time": 1718594177859
}TIP
The disks field is only populated on Windows systems.
Get File Contents
PUT /api/files/TIP
This route shares the same endpoint PUT /api/files/ with "Update File". When the request body contains only target (without text), the file contents are read. When text is provided, the file is written.
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"target": "/eula.txt"
}Response
{
"status": 200,
"data": "eula=false\n", // file content
"time": 1718594177859
}Update File
PUT /api/files/TIP
This route shares the same endpoint PUT /api/files/ with "Get File Contents". When the request body contains text, the file is written. When only target is provided, the file contents are read.
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"target": "/eula.txt",
"text": "eula=true\n" // file content
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Download File
ALL /api/files/downloadQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
file_name: string; // Path + FileName, Example: /backup/world.zip
daemonId: string;
uuid: string; // Instance ID
}Response
{
"status": 200,
"data": {
"password": "b2d8a6fa3bc8467ebd1563dc4f7179be1718010317889",
"addr": "localhost:24444", // Daemon Addr
"remoteMappings": {} // Remote address mappings
},
"time": 1718594177859
}Usage
GET http(s)://{{Daemon Addr}}/download/{{password}}/{{fileName}}
// For example:
GET http://localhost:24444/download/db8271f526...49468abd74/world.zipTIP
The password is a one-time credential. After the download request completes, the credential is invalidated.
Upload File
1. Get Upload Config
ALL /api/files/uploadQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
upload_dir: string;
daemonId: string;
uuid: string; // Instance ID
}Response
{
"status": 200,
"data": {
"password": "b2d8a6fa3bc8467ebd1563dc4f7179be1718010317889",
"addr": "localhost:24444", // Daemon Addr
"remoteMappings": {} // Remote address mappings
},
"time": 1718594177859
}2. Upload File
POST http(s)://{{Daemon Address}}/upload/{{password}}Query Param (optional)
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
unzip: boolean; // Optional, if true, unzip the uploaded file after upload
code: string; // Optional, encoding for unzip (e.g. utf-8, gbk, big5)
overwrite: string; // Optional, "false" to keep the existing file with auto-rename
}Request Headers
Content-Type: multipart/form-dataRequest FormData
file: (Binary Data)Response
OKTIP
The daemon also supports resumable uploads via POST /upload-new/:key and POST /upload-piece/:id endpoints, suitable for uploading large files in chunks.
Download From URL
POST /api/files/download_from_urlQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"url": "https://example.com/file.zip", // URL to download from
"file_name": "/backup/file.zip" // Save path + file name
}Response
{
"status": 200,
"data": "a1b2c3d4e5f6...", // Download task ID
"time": 1718594177859
}TIP
The download runs in the background on the daemon. Use the Get File Status endpoint to track download progress and obtain the actual task ID (downloadTasks[].taskId) for stopping.
Stop Download From URL
POST /api/files/download_from_url_stopQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"taskId": "a1b2c3d4e5f6..." // Download task ID (from Get File Status)
}Response
{
"status": 200,
"data": true, // true = stopped successfully, false = task not found
"time": 1718594177859
}Copy
POST /api/files/copyQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"targets": [
[
"/server.jar", // source
"/cache/server.jar" // target
]
// ... more
]
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Move or Rename
PUT /api/files/moveQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"targets": [
[
"/server.jar", // source
"/cache/server.jar" // target
],
// support rename
[
"/ops.json", // source
"/ops.txt" // target
]
// ... more
]
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Chmod
PUT /api/files/chmodQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"target": "/server.jar", // File or directory path
"chmod": 755, // Permission number
"deep": false // Whether to apply recursively to directories
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}WARNING
chmod is only supported on Linux systems.
Chmod Batch
PUT /api/files/chmod_batchQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"targets": [
"/server.jar",
"/config.json"
], // Array of file/directory paths
"chmod": 755, // Permission number
"deep": false // Whether to apply recursively
}Response
{
"status": 200,
"data": {
"success": 2, // Number of successfully chmod'd items
"failed": 0, // Number of failed items
"total": 2, // Total number of items
"results": [
{
"target": "/server.jar",
"success": true
},
{
"target": "/config.json",
"success": true
}
]
},
"time": 1718594177859
}WARNING
chmod is only supported on Linux systems.
Zip
POST /api/files/compressQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"type": 1,
"code": "utf-8", // only utf-8
"source": "/test.zip", // zip file path
"targets": [
"/world", // support folder
"/config.json",
"/server.jar"
]
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Unzip
POST /api/files/compressQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"type": 2,
"code": "utf-8", // format of the compressed file
// support: utf-8, gbk, big5
"source": "/test.zip", // zip file path
"targets": "/cache" // unzip to
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Delete
DELETE /api/filesQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"targets": [
"/world", // support folder
"/cache/config.json",
"/server.jar"
]
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Touch File
POST /api/files/touchQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"target": "/test" // File name
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Create Folder
POST /api/files/mkdirQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}Request Body
{
"target": "/backup" // Folder name
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
MCSManager