Status and network
Server status, the server list, kits, arenas, queues, parties and tournaments.
These endpoints use the read scope and the cheap read limit (20 per second per key). Results are cached for cache-seconds.
GET /status
The state of the server that runs the API.
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/status"{
"ok": true,
"data": {
"version": "0.10.0",
"server": "lobby-1",
"crossServer": true,
"role": "lobby",
"online": 31,
"runningMatches": 0,
"draining": false,
"uptimeSeconds": 93211,
"databaseQueue": 0,
"web": { "served": 5120, "refused": 14 }
}
}| Field | Meaning |
|---|---|
server | The cross-server.server-name, or local without cross-server |
role | lobby, game or standalone |
online | Players on this server |
runningMatches | Matches running on this server |
draining | Whether this server is draining |
uptimeSeconds | Seconds since MineDuels started |
databaseQueue | Database reads waiting in the API's own pool. Should be 0 |
web.served, web.refused | Requests answered, and requests refused by a limit, a key check or an error, since start |
Use it as a health check:
curl -fsS -H "Authorization: Bearer $MD_KEY" "$MD_URL/status" > /dev/null && echo up || echo downGET /servers
Every server and proxy of the network that sent a heartbeat. Needs cross-server on the server that runs the API. Without cross-server you get one entry named local.
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/servers"{
"ok": true,
"data": [
{ "name": "game-1", "role": "game", "players": 8, "maxPlayers": 100, "fresh": true, "ageSeconds": 1,
"draining": false, "matchmaker": false,
"freeArenas": { "nodebuff": 3, "sumo": 5 }, "playing": { "nodebuff": 4 }, "queued": {}, "region": "eu" },
{ "name": "game-2", "role": "game", "players": 0, "maxPlayers": 100, "fresh": false, "ageSeconds": 412,
"draining": false, "matchmaker": false, "freeArenas": {}, "playing": {}, "queued": {} },
{ "name": "lobby-1", "role": "lobby", "players": 31, "maxPlayers": 100, "fresh": true, "ageSeconds": 0,
"draining": false, "matchmaker": true, "freeArenas": {}, "playing": {}, "queued": { "nodebuff|r1": 2 } },
{ "name": "proxy", "role": "proxy", "players": 39, "maxPlayers": 500, "fresh": true, "ageSeconds": 1,
"draining": false, "matchmaker": false, "freeArenas": {}, "playing": {}, "queued": {} }
]
}| Field | Meaning |
|---|---|
role | lobby, game or proxy |
fresh | true when a heartbeat arrived in the last 10 seconds. false means the server is down or cut off. Stale servers are kept in the list for an hour |
ageSeconds | Seconds since the last heartbeat |
matchmaker | The lobby that holds the matchmaker lock |
freeArenas | Ready arena copies per kit (game servers) |
playing | Running matches per kit |
queued | Players this server forwarded to the matchmaker. The key is `kit |
region | The region label, when regions are in use |
Players online across the network:
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/servers" \
| jq '[.data[] | select(.role != "proxy" and .fresh) | .players] | add'Servers that went silent:
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/servers" | jq -r '.data[] | select(.fresh | not) | .name'GET /kits
The loaded kit names, sorted.
{ "ok": true, "data": ["boxing", "nodebuff", "sumo"] }These are the names GET /leaderboards/{kit} and the kit filter of GET /matches accept.
GET /arenas
The arena template names on this server, sorted.
{ "ok": true, "data": ["desert", "ring", "skyline"] }GET /queues
Players waiting in queues.
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/queues"{
"ok": true,
"data": {
"local": [
{ "kit": "nodebuff", "ranked": true, "teamSize": 1, "waiting": 3 },
{ "kit": "sumo", "ranked": false, "teamSize": 2, "waiting": 4 }
],
"network": {
"lobby-1": { "nodebuff|r1": 3 },
"lobby-2": { "nodebuff|r1": 1, "sumo|u2": 2 }
}
}
}local lists queues of this server that have players. network appears with cross-server and shows what every fresh server forwarded to the matchmaker. Team size is 1 for 1v1 and 2 for 2v2.
GET /parties
Parties on this server.
{
"ok": true,
"data": [
{ "leader": "069a79f4-44e9-4726-a5be-fca90e38aaf5",
"members": ["069a79f4-44e9-4726-a5be-fca90e38aaf5", "853c80ef-3c37-49fd-aa49-938b674adae6"],
"open": false }
]
}open is true when anyone may join without an invite.
GET /tournaments
The tournament that is waiting for players or running on this server. data is null when there is none.
{
"ok": true,
"data": {
"running": true,
"kit": "nodebuff",
"kitDisplay": "NoDebuff",
"host": "Steve",
"teamSize": 1,
"players": 8,
"maxPlayers": 16,
"round": 2,
"totalRounds": 4,
"secondsToStart": 0,
"pairings": [
{ "a": "Steve", "b": "Alex", "status": "FIGHTING" },
{ "a": "Jeb", "b": "Notch", "status": "WON", "winner": "Jeb" }
],
"joined": false
}
}status is one of WAITING, FIGHTING, WON, BYE, NOBODY. secondsToStart counts down while the tournament waits and is 0 once it runs. joined is always false here, since the API has no player.
Example: a status page
const [status, servers] = await Promise.all([
fetch(`${MD_URL}/status`, { headers }).then((r) => r.json()),
fetch(`${MD_URL}/servers`, { headers }).then((r) => r.json()),
]);
for (const s of servers.data) {
console.log(`${s.fresh ? 'UP ' : 'DOWN'} ${s.name.padEnd(10)} ${s.role.padEnd(6)} ${s.players}/${s.maxPlayers}${s.draining ? ' draining' : ''}`);
}UP game-1 game 8/100
DOWN game-2 game 0/100
UP lobby-1 lobby 31/100
UP proxy proxy 39/500