API

Control MuteCloud from outside over HTTP and WebSocket, and from plugins through the bridge API.

MuteCloud speaks HTTP and WebSocket on the same address, by default 127.0.0.1:8770. Both live in mutecloud.toml:

mutecloud.toml
[api]
bind = "127.0.0.1:8770"
token = "..."

If the API binds to the outside without a token, the cloud warns on start. Without a token only callers from the same machine are allowed.

HTTP

A="Authorization: Bearer $TOKEN"
H="http://127.0.0.1:8770"
curl -H "$A" $H/api/services
RouteWhat it doesRight
GET /api/healthliveness, no token needednone
GET /api/openapi.jsondescription of this APInone
GET /api/statusnode, version, countsany valid token
GET /api/nodesall nodes in the clustergroups.view
GET /api/groupsall groupsgroups.view
GET /api/groups/{name}one group with its serversgroups.view
POST /api/groups/{name}/{action}start, stop, restart, rollout, disable, backupdepends
GET /api/servicesrunning serversservice.view
GET /api/services/{id}one serverservice.view
GET /api/services/{id}/logsrecent log linesservice.view
GET /api/services/{id}/propertiesproperties the server has setservice.view
POST /api/services/{id}/{action}stop, drain, restartdepends
POST /api/services/{id}/execa command to that server's consoleservice.console
GET /api/playerswho is onlineplayers.view
GET /api/players/{name}a single playerplayers.view
GET /api/ranksranksranks.view
GET /api/ranks/{player}a player's rightsranks.view
GET /api/data/{namespace}shared storagedata.view
GET PUT DELETE /api/data/{namespace}/{key}one entry, PUT takes the value as plain text bodydata.view / data.edit
POST /api/announcebroadcast to all playersannounce
POST /api/channels/{channel}message to plugins, optionally with targetchannels.publish
POST /api/maintenancetoggle maintenancemaintenance
GET /api/layerstemplates with their revisionlayers.read
GET /api/layers/{name}a template as tar.gzlayers.read
GET /api/updateversion and whether a newer one waitsgroups.view
POST /api/commandany command, answer as linesdepends
GET /metricsPrometheus text, see metricsgroups.view

Missing a right gives 403 and names the right that was missing. After eight wrong tokens an address is locked out for a minute.

curl -H "$A" -X POST $H/api/groups/Lobby/start
curl -H "$A" -X POST -H 'Content-Type: application/json' \
     -d '{"line":"say Restart in 5 minutes"}' $H/api/services/Lobby-1/exec
curl -H "$A" -X POST -H 'Content-Type: application/json' \
     -d '{"message":"&bBack in a moment","title":true}' $H/api/announce

The complete description is served at /api/openapi.json, which allows clients to be generated or the routes to be imported into tools such as Postman or Insomnia.

Tokens

token create website groups.view players.view
token list
token delete website

A token receives only the rights it requires. * grants full access and should not be handed to a web frontend.

WebSocket

ws://127.0.0.1:8770/ws carries the same protocol the bridges use. After connecting you send:

{"t":"hello","d":{"version":1,"role":"operator","token":"..."}}

From then on events arrive as they happen: snapshot, service_update, service_gone, log, network, permissions, node_info. To control things you send command and the answer comes back as output with the same request id. Channel messages arrive as message once you have registered with listen, and with publish you send your own.

This is the appropriate interface for a web frontend or a bot that should receive events instead of polling.

For plugins

The bridge is deployed to every server and exposes an API, plus properties, channels between servers and events for Paper and Velocity. All of it is described under plugins.

MuteCloud.best("Lobby");                          // the emptiest one accepting players
MuteCloud.send(player, "Lobby");                  // move a player
MuteCloud.setState("INGAME");                     // property of this server
MuteCloud.channel("party").publish(invite);       // message to other servers
MuteCloud.data("myplugin").set(k, v);             // shared storage

Plus placeholders such as %mutecloud_service%, %mutecloud_network_players% and %mutecloud_players_lobby% once PlaceholderAPI is installed.

On this page