Skip to Content
MineDuels

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
    }
  ]
}
FieldMeaning
serverThe server running the match. local on a single server
idThe match id on that server. Unique per server until restart
typeHow the match started: DUEL, QUEUE, PARTY_SPLIT, PARTY_FFA, PARTY_TEAMS, PARTY_DUEL, RED_ROVER or TOURNAMENT
arenaThe arena template
playersUUIDs of everyone in the match. Resolve names with /players/{uuid}/stats
elapsedSecondsTime 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.

QueryDefaultMeaning
kitanyOnly this kit. Letters, digits, _, -
rankedanytrue or false
since0Only matches that ended at or after this time, in epoch milliseconds
playeranyOnly this player's matches (UUID or name)
limit201 to 100
offset00 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:

FieldMeaning
idMatch id in the history. Unique across the network
endedAtEnd time, epoch milliseconds
durationSecondsLength of the match
reasonHow it ended: SCORE, FORFEIT, QUIT, TIME_LIMIT, ABORTED or SHUTDOWN
winnerSideThe winning side index, or -1 for a draw
scoresRounds (or points) won per side
players[].sideThe side index, starting at 0
players[].outcomeWIN, LOSS, DRAW or NONE (left without it counting as a loss)
players[].eloAfterELO in the kit after the match
players[].eloChangeSigned 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.

On this page