Matches
Running matches on every server, finished matches with filters, and one match by id.
Running matches come from the shared database, so one server sees the whole network. Finished matches are the stored history.
GET /matches/running
Every match running on every server.
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/matches/running"{
"ok": true,
"data": [
{
"server": "game-1", "id": 18, "type": "QUEUE", "kit": "nodebuff", "arena": "desert",
"ranked": true,
"players": ["069a79f4-44e9-4726-a5be-fca90e38aaf5", "853c80ef-3c37-49fd-aa49-938b674adae6"],
"startedAt": 1767225600000, "elapsedSeconds": 74
},
{
"server": "game-2", "id": 4, "type": "PARTY_FFA", "kit": "sumo", "arena": "ring",
"ranked": false,
"players": ["...", "...", "..."],
"startedAt": 1767225500000, "elapsedSeconds": 174
}
]
}| Field | Meaning |
|---|---|
server | The server running the match. local on a single server |
id | The match id on that server. Unique per server until restart |
type | How the match started: DUEL, QUEUE, PARTY_SPLIT, PARTY_FFA, PARTY_TEAMS, PARTY_DUEL, RED_ROVER or TOURNAMENT |
arena | The arena template |
players | UUIDs of everyone in the match. Resolve names with /players/{uuid}/stats |
elapsedSeconds | Time since the match started |
Count by server:
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/matches/running" \
| jq '.data | group_by(.server) | map({server: .[0].server, matches: length})'The list is cached for cache-seconds.
For rich live detail (sides, phase, type) about a player on the server that runs the API, use GET /players/{id} and read live.match.
GET /matches
Finished matches, newest first.
| Query | Default | Meaning |
|---|---|---|
kit | any | Only this kit. Letters, digits, _, - |
ranked | any | true or false |
since | 0 | Only matches that ended at or after this time, in epoch milliseconds |
player | any | Only this player's matches (UUID or name) |
limit | 20 | 1 to 100 |
offset | 0 | 0 to 100000 |
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/matches?kit=nodebuff&ranked=true&limit=2"{
"ok": true,
"data": [
{
"id": 40212, "endedAt": 1767225700000, "kit": "nodebuff", "ranked": true, "durationSeconds": 98,
"reason": "FORFEIT", "winnerSide": 1, "scores": [0, 3],
"players": [
{ "uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5", "name": "Steve", "side": 0, "outcome": "LOSS", "eloAfter": 1268, "eloChange": -16 },
{ "uuid": "853c80ef-3c37-49fd-aa49-938b674adae6", "name": "Alex", "side": 1, "outcome": "WIN", "eloAfter": 1317, "eloChange": 16 }
]
}
]
}Fields:
| Field | Meaning |
|---|---|
id | Match id in the history. Unique across the network |
endedAt | End time, epoch milliseconds |
durationSeconds | Length of the match |
reason | How it ended: SCORE, FORFEIT, QUIT, TIME_LIMIT, ABORTED or SHUTDOWN |
winnerSide | The winning side index, or -1 for a draw |
scores | Rounds (or points) won per side |
players[].side | The side index, starting at 0 |
players[].outcome | WIN, LOSS, DRAW or NONE (left without it counting as a loss) |
players[].eloAfter | ELO in the kit after the match |
players[].eloChange | Signed change. 0 in unranked games |
Examples:
# the last hour
since=$(( ($(date +%s) - 3600) * 1000 ))
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/matches?since=$since&limit=100"
# page through everything, 100 at a time
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/matches?limit=100&offset=100"
# one player, ranked sumo only
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/matches?player=Steve&kit=sumo&ranked=true"When you combine player with kit, ranked or since, the filters apply to that player's 100 most recent matches. Without those filters player pages through their whole history.
The history keeps matches according to history in matchmaking.yml: keep-days (default 30) and max-matches (default 100000). Matches that were pruned are gone. With history.enabled: false no new matches are stored.
GET /matches/:id
One finished match by its history id.
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/matches/40212"The body is one match object as above. An id that does not exist gives 404:
{"ok":false,"error":{"code":"not_found","message":"no finished match with id 99999999"}}A running match has no history id yet. Use GET /matches/running.
Example: a live match feed
Poll for matches that ended since the last check:
let since = Date.now();
setInterval(async () => {
const r = await fetch(`${MD_URL}/matches?since=${since}&limit=100`, { headers });
const { data } = await r.json();
for (const m of data.reverse()) {
const winner = m.players.filter((p) => p.side === m.winnerSide).map((p) => p.name).join(', ') || 'draw';
console.log(`#${m.id} ${m.kit}${m.ranked ? ' (ranked)' : ''}: ${winner} won in ${m.durationSeconds}s`);
since = Math.max(since, m.endedAt + 1);
}
}, 10_000);Poll every 10 seconds or more. The cache makes faster polling pointless.