Instance API
Instance List
GET /api/service/remote_service_instancesQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string; // required
page: number; // required, >= 1
page_size: number; // required, 1 ~ 50
instance_name?: string; // filter by instance nickname (fuzzy match)
status?: string; // filter by status code: -1 busy, 0 stopped, 1 stopping, 2 starting, 3 running
tag?: string; // JSON-encoded string array, e.g. '["tag1","tag2"]'
}Response
{
"status": 200,
"data": {
"page": 1,
"pageSize": 10,
"maxPage": 1,
"allTags": ["tag1", "tag2"],
"data": InstanceDetail[]
},
"time": 1718594177859
}Each item in
datafollows the InstanceDetail shape, but list items do not includeprocessInfoorspace.
Instance Detail
GET /api/instanceQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}Response
{
"status": 200,
"data": InstanceDetail,
"time": 1718594177859
}Create Instance
POST /api/instanceQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
}Request Body
Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf",
"config": InstanceConfig,
"nickname": "New Server"
},
"time": 1718594177859
}Upload Instance File
Create a new instance and register an upload passport for cross-end file upload. Used during instance creation when files need to be uploaded to the daemon.
POST /api/instance/uploadQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
upload_dir: string;
}Request Body
Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf",
"password": "upload-passport-token",
"addr": "192.168.1.100:24444",
"remoteMappings": []
},
"time": 1718594177859
}Update Instance Config (Admin)
Update the full configuration of an instance. Requires administrator permission.
PUT /api/instanceQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}Request Body
Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}Update Instance Config (User)
Update a restricted subset of instance configuration for normal (low-privilege) users. Sensitive fields are filtered and sanitized server-side. Only a limited set of fields is accepted; all other fields are ignored.
PUT /api/protected_instance/instance_updateQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}Request Body
The body is a subset of InstanceConfig. Accepted fields include:
{
pingConfig?: {
ip?: string,
port?: number,
type?: number
},
eventTask?: {
autoStart: boolean,
autoRestart: boolean,
autoRestartMaxTimes: number
},
terminalOption?: {
haveColor: boolean,
pty: boolean,
ptyWindowCol: number,
ptyWindowRow: number
},
extraServiceConfig?: {
openFrpTunnelId: string,
openFrpToken: string
},
crlf?: number,
oe?: string,
ie?: string,
fileCode?: string,
stopCommand?: string,
rconIp?: string,
rconPort?: number,
rconPassword?: string,
enableRcon?: boolean,
tag?: string[],
// advanced params (admin-only fields are validated server-side)
}WARNING
The tag field is only accepted when the caller has top-level (admin) permission. Tags are trimmed, limited to 20 characters each, and a maximum of 6 tags.
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Delete Instance
DELETE /api/instanceQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string,
}Request Body
{
"uuids": [
"50c73059001b436fa85c0d8221c157cf",
"11c2f4c89b9e4e1da819dc56bf16f151"
], // Instance IDs to delete
"deleteFile": false // Whether to delete instance files on disk
}Response
{
"status": 200,
"data": {
"instanceUuids": [
"50c73059001b436fa85c0d8221c157cf",
"11c2f4c89b9e4e1da819dc56bf16f151"
],
"instances": [
{
"instanceUuid": "50c73059001b436fa85c0d8221c157cf",
"nickname": "Server A"
},
{
"instanceUuid": "11c2f4c89b9e4e1da819dc56bf16f151",
"nickname": "Server B"
}
]
},
"time": 1718594177859
}Start Instance
TIP
This route is defined with router.all(...), so it accepts any HTTP method. The frontend uses GET.
GET /api/protected_instance/openQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}Stop Instance
TIP
This route is defined with router.all(...), so it accepts any HTTP method. The frontend uses GET.
GET /api/protected_instance/stopQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}Restart Instance
TIP
This route is defined with router.all(...), so it accepts any HTTP method. The frontend uses GET.
GET /api/protected_instance/restartQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}Kill Instance
TIP
This route is defined with router.all(...), so it accepts any HTTP method. The frontend uses GET.
GET /api/protected_instance/killQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}Send Command
Send a command to the instance's terminal via HTTP. The route is defined with router.all(...) and accepts any HTTP method.
WARNING
The frontend uses WebSocket (stream/input event) for command input instead of this HTTP API. This HTTP route is reserved as an API interface for programmatic access.
GET /api/protected_instance/commandQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
command: string
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Batch Operations
Perform operations on multiple instances across daemons. Each route accepts an array of { instanceUuid, daemonId } objects in the request body.
| Route | Operation |
|---|---|
POST /api/instance/multi_open | Start instances |
POST /api/instance/multi_stop | Stop instances |
POST /api/instance/multi_restart | Restart instances |
POST /api/instance/multi_kill | Kill instances |
Request Body
[
{ "instanceUuid": "50c73059001b436fa85c0d8221c157cf", "daemonId": "dc3a3f..." },
{ "instanceUuid": "11c2f4c89b9e4e1da819dc56bf16f151", "daemonId": "dc3a3f..." }
]Response
{
"status": 200,
"data": true,
"time": 1718594177859
}TIP
These routes do not wait for each operation to complete. They fire-and-forget in the background and immediately return true.
Get Output Log
GET /api/protected_instance/outputlogQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
size?: string // Truncate the log to the specified size.
// Accepts a plain number (bytes) or a number
// suffixed with "KB" (e.g. "10KB").
// Returns the last N bytes of the log.
// If not set, returns all logs.
}Response
{
"status": 200,
"data": "[INFO]: Done (12.138s)! For help, type \"help\"\n",
"time": 1718594177859
}Asynchronous Task
Start an asynchronous task on the instance. The task_name query parameter determines the task type and the required request body.
POST /api/protected_instance/asynchronousQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
task_name: string // Task type, e.g. "update", "quick_install"
}Request Body
The body depends on task_name:
task_name | Body | Description |
|---|---|---|
"update" | { time: number } | Update the instance software using its configured update command |
"quick_install" | { time: number, newInstanceName: string, targetLink: string, setupInfo?: any } | Quick-install a new instance (admin only) |
Response (for task_name: "update")
{
"status": 200,
"data": true,
"time": 1718594177859
}Response (for task_name: "quick_install")
{
"status": 200,
"data": {
"instanceConfig": InstanceConfig,
"instanceStatus": 0,
"instanceUuid": "50c73059001b436fa85c0d8221c157cf",
"status": 0,
"taskId": "task-uuid"
},
"time": 1718594177859
}Query Asynchronous Task
Query the status of an asynchronous task. The route is defined with router.all(...). The frontend uses POST.
POST /api/protected_instance/query_asynchronousQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
task_name: string // Task type to query, e.g. "quick_install"
}Request Body
{
"taskId": "task-uuid" // Optional. If omitted, lists all tasks of this type (admin only).
}Response (single task)
{
"status": 200,
"data": {
"taskId": "task-uuid",
"status": 0,
"detail": {
"instanceConfig": InstanceConfig,
"instanceStatus": 0,
"instanceUuid": "50c73059001b436fa85c0d8221c157cf",
"status": 0,
"taskId": "task-uuid"
}
},
"time": 1718594177859
}When taskId is omitted, data is an array of the above objects.
Stop Asynchronous Task
Stop a running asynchronous task. The route is defined with router.all(...) and accepts any HTTP method.
ALL /api/protected_instance/stop_asynchronousQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}Request Body
{
"taskId": "task-uuid" // Optional. If provided, stops the specific task;
// otherwise stops the instance's current async task.
}Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Stream Channel
Request a dedicated data-stream channel with the daemon. Returns connection credentials for establishing a WebSocket connection to the daemon for terminal I/O.
POST /api/protected_instance/stream_channelQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}Response
{
"status": 200,
"data": {
"password": "stream-passport-token",
"addr": "192.168.1.100:24444",
"prefix": "/socket.io/",
"remoteMappings": []
},
"time": 1718594177859
}Process Config List
Check which files in the instance directory are recognized as configuration files.
POST /api/protected_instance/process_config/listQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}Request Body
{
"files": ["server.properties", "config.yml"]
}Response
{
"status": 200,
"data": [
{
"file": "server.properties",
"check": true
},
{
"file": "config.yml",
"check": true
}
],
"time": 1718594177859
}Get Process Config File
Read the content of a specific configuration file.
GET /api/protected_instance/process_config/fileQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
fileName: string, // File path relative to the instance working directory
type?: string // Config file type hint
}Response
{
"status": 200,
"data": {}, // Parsed config file content
"time": 1718594177859
}Update Process Config File
Write new content to a specific configuration file.
PUT /api/protected_instance/process_config/fileQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
fileName: string, // File path relative to the instance working directory
type?: string // Config file type hint
}Request Body
The new configuration content (object to write).
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Reinstall Instance
Reinstall the instance using a preset package. The preset package is identified by matching title and description from the quick install list.
POST /api/protected_instance/install_instanceQuery 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
{
"title": "Minecraft 1.20.4 Java",
"description": "[Paper] Low hardware configuration machine use, Fast setup."
}WARNING
The title and description must exactly match an entry in the preset package list configured by the administrator. Other fields in the body (such as targetUrl) are ignored for security reasons.
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}Quick Install List
Get the list of available preset packages for quick installation. The source is configured via systemConfig.presetPackAddr.
GET /api/instance/quick_install_listQuery Param
None.
Response
{
"status": 200,
"data": {
"languages": [
{ "label": "English", "value": "en" }
],
"packages": [
{
"language": "en",
"description": "Fast setup.",
"title": "Minecraft 1.20.4 Java",
"category": "Minecraft",
"runtime": "java",
"size": "50MB",
"hardware": "Low",
"remark": "Low hardware configuration machine use",
"targetLink": "https://example.com/Paper-1.20.4.zip",
"author": "MCSManager",
"setupInfo": InstanceConfig,
"gameType": "Minecraft",
"image": "",
"platform": ""
}
]
},
"time": 1718594177859
}TIP
If the preset pack address is unavailable or the request fails, an empty array [] is returned.
Forward Request
Proxy an HTTP request to an arbitrary target URL. The method and body of the incoming request are forwarded as-is. Intended for internal/advanced usage.
ALL /api/instance/forwardQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
target: string // The full target URL to forward the request to
}Request Body
Any body — forwarded to the target URL as-is.
Response
{
"status": 200,
"data": {}, // Response from the forwarded target; empty array [] on error
"time": 1718594177859
}Exchange (Business Mode)
These routes are for the business/exchange mode of MCSManager. They are internal routes for SSO, instance purchasing, and renewal.
Exchange Request
General exchange endpoint. The request_action field determines the action to perform.
POST /api/exchangeRequest Body
{
request_action: string, // "ping" | "buy" | "renew" | "query_instance" | "sso_token"
data?: any // Action-specific parameters
}request_action | data | Description |
|---|---|---|
"ping" | node info | Returns daemon node status |
"buy" | instance params | Buy a new instance |
"renew" | instance params | Renew an existing instance |
"query_instance" | { username } | Query instances by user ID |
"sso_token" | { username } | Generate an SSO token for the user |
Response
The response depends on the request_action. On error, data is the error object.
Exchange SSO
SSO login redirect. No authentication required.
GET /api/exchange/ssoQuery Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
username: string,
token: string,
instanceId: string,
daemonId: string,
origin: string // The panel base URL for redirect
}Response
On success, the server issues an HTTP redirect (302) to:
{origin}/#/instances/terminal?daemonId={daemonId}&instanceId={instanceId}&from=ssoOn failure, an error is thrown.
Exchange Buy Instance
Buy or renew an instance using a redeem code. No authentication required (the redeem code serves as the credential).
POST /api/exchange/request_buy_instanceRequest Body
{
"productId": 1,
"daemonId": "dc3a3f............",
"code": "redeem-code",
"instanceId": "", // Optional. If provided, renews the existing instance; otherwise buys a new one.
"username": "" // Optional. The username to assign the instance to.
}Response
{
"status": 200,
"data": {}, // Result of the buy/renew operation
"time": 1718594177859
}Type of InstanceConfig
{
"nickname": "New Name",
"startCommand": "cmd.exe",
"stopCommand": "^C",
"stopTimeout": 0,
"cwd": "/workspaces/my_server/",
"ie": "gbk", // input encode
"oe": "gbk", // output encode
"createDatetime": 1709631756708,
"lastDatetime": 1709631756708,
"type": "universal", // instance type
"tag": [],
"endTime": 1729631756708,
"fileCode": "gbk",
"processType": "docker", // "general" | "docker"
"updateCommand": "shutdown -s",
"runAs": "",
"actionCommandList": [],
"crlf": 2,
"category": 0,
"basePort": 0,
// Steam RCON
"enableRcon": true,
"rconPassword": "123456",
"rconPort": 2557,
"rconIp": "192.168.1.233",
// Java
"java": {
"id": "java-17"
},
// Terminal options
"terminalOption": {
"haveColor": false,
"pty": true,
"ptyWindowCol": 164,
"ptyWindowRow": 40
},
// Event task
"eventTask": {
"autoStart": false,
"autoRestart": true,
"autoRestartMaxTimes": -1,
"ignore": false
},
// Docker config
"docker": DockerConfig,
// Ping protocol config (all fields optional)
"pingConfig": {
"ip": "",
"port": 25565,
"type": 1
},
// Extra service config
"extraServiceConfig": {
"openFrpTunnelId": "",
"openFrpToken": ""
}
}Type of InstanceDetail
{
"config": InstanceConfig,
"info": {
"mcPingOnline": false,
"currentPlayers": -1,
"fileLock": 0,
"maxPlayers": -1,
"openFrpStatus": false,
"playersChart": [{ "value": "0" }],
"version": "",
"latency": 0,
"allocatedPorts": [
{ "host": "25565", "container": 25565, "protocol": "tcp" }
]
},
"instanceUuid": "50c73059001b436fa85c0d8221c157cf",
"started": 6, // start count
"autoRestarted": 0, // auto-restart count
"status": 3, // -1 = busy,
// 0 = stopped,
// 1 = stopping,
// 2 = starting,
// 3 = running
"space": 0, // disk space used (bytes)
"processInfo": {
"cpu": 0, // percentage (0 ~ 100*vcore)
"memory": 0, // bytes
"ppid": 0, // parent PID
"pid": 0, // PID
"ctime": 0, // ms (user + system time)
"elapsed": 0, // ms since process start
"timestamp": 0 // ms since epoch
}
}TIP
When returned from the Instance List endpoint, items do not include processInfo or space — only instanceUuid, started, autoRestarted, status, config, and info.
Type of Instance DockerConfig
{
"updateCommandImage": "HOST", // Docker image used for the update command; empty = not used
"containerName": "", // container name
"image": "mcsm-ubuntu:22.04", // Docker image
"memory": 1024, // MB
"memorySwap": null, // swap limit (MB)
"memorySwappiness": null, // swappiness (0-100)
"ports": ["25565:25565/tcp"], // port mappings
"extraVolumes": [], // extra volume mounts
"maxSpace": null, // max disk space (not fully implemented)
"network": null, // Docker network (not fully implemented)
"io": null, // IO limit (not implemented)
"networkMode": "bridge", // network mode
"networkAliases": [], // network aliases
"cpusetCpus": "", // CPU set preference
"cpuUsage": 100, // CPU limit (percentage)
"workingDir": "", // working directory inside container
"changeWorkdir": false, // force change working directory
"env": [], // environment variables
"labels": [], // Docker labels
"capAdd": [], // Linux capabilities to add
"capDrop": [], // Linux capabilities to drop
"devices": [], // device mappings, e.g. ["/dev/sda:/dev/sda"]
"privileged": false, // run in privileged mode
"uploadSpeedLimit": 0, // upload speed limit (KB/s)
"downloadSpeedLimit": 0, // download speed limit (KB/s)
"gpuEnabled": false, // enable GPU passthrough
"gpuCount": -1, // GPU count: -1 = all, 0 = none, N = specific count
"gpuDeviceIds": [], // specific GPU device IDs (mutually exclusive with gpuCount)
"gpuDriver": "nvidia", // GPU driver name
"deviceReadBps": [], // device read BPS, format: ["/dev/sda:10MB"]
"deviceWriteBps": [] // device write BPS, format: ["/dev/sda:10MB"]
}TIP
You can use {mcsm_port} to assign a random port in the ports field.
IUserHaveInstance[]
{
"instanceUuid": "********************************",
"daemonId": "********************************"
}
MCSManager