Skip to Content
MineDuels

Players and stats

Look up a player by name or UUID: stored stats, live state and match history.

A player is identified by UUID or by name. Both work for online and offline players, as long as the player has joined the network once.

FormExample
UUID with dashes069a79f4-44e9-4726-a5be-fca90e38aaf5
UUID without dashes069a79f444e94726a5befca90e38aaf5
Name (1 to 16 letters, digits, _)Notch

A name is looked up case-insensitively and resolves to the player who used it most recently. An unknown player gives 404. These endpoints use the heavy limit.

GET /players/:id/stats

The stored stats, read from the database.

curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/players/Steve/stats"
{
  "ok": true,
  "data": {
    "uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5",
    "name": "Steve",
    "streak": 3,
    "bestStreak": 11,
    "kits": [
      { "kit": "nodebuff", "elo": 1284, "wins": 41, "losses": 22, "streak": 3, "bestStreak": 9,
        "unrankedWins": 12, "unrankedLosses": 4 },
      { "kit": "sumo", "elo": 1050, "wins": 3, "losses": 5, "streak": 0, "bestStreak": 2,
        "unrankedWins": 0, "unrankedLosses": 1 }
    ]
  }
}
FieldMeaning
streak, bestStreakCurrent and best win streak over all kits, ranked and unranked games
kits[].eloELO in the kit. Ranked games only
kits[].wins, lossesRanked results
kits[].unrankedWins, unrankedLossesUnranked results, counted apart
kits[].streak, bestStreakWin streak in this kit

Only kits the player has played appear. A kit never played is absent, and its ELO is the starting ELO, elo.default in ranks/_default.yml.

GET /players/:id

Stored stats plus the player's live state on the server that runs the API.

curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/players/Steve"
{
  "ok": true,
  "data": {
    "stats": { "uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5", "name": "Steve", "streak": 3, "bestStreak": 11, "kits": [] },
    "live": {
      "online": true,
      "inMatch": true,
      "match": {
        "id": 18, "kit": "nodebuff", "ranked": true,
        "sides": [["069a79f4-44e9-4726-a5be-fca90e38aaf5"], ["853c80ef-3c37-49fd-aa49-938b674adae6"]],
        "phase": "FIGHTING", "type": "QUEUE"
      }
    }
  }
}

live describes this server only. match, queue and party are left out when the player is in none. A player in a queue shows "queue": { "kit": "nodebuff", "ranked": true, "teamSize": 1 }. A player in a party shows "party": { "leader": "...", "members": ["..."], "open": false }.

To find a player on another server, call GET /matches/running and search the players lists, or GET /servers.

GET /players/:id/matches

The player's finished matches, newest first.

QueryDefaultRangeMeaning
limit201 to 100How many matches
offset00 to 100000Matches to skip
curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/players/Steve/matches?limit=2"
{
  "ok": true,
  "data": [
    {
      "id": 40211, "endedAt": 1767225600000, "kit": "nodebuff", "ranked": true, "durationSeconds": 143,
      "reason": "SCORE", "winnerSide": 0, "scores": [3, 1],
      "players": [
        { "uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5", "name": "Steve", "side": 0, "outcome": "WIN", "eloAfter": 1284, "eloChange": 16 },
        { "uuid": "853c80ef-3c37-49fd-aa49-938b674adae6", "name": "Alex", "side": 1, "outcome": "LOSS", "eloAfter": 1301, "eloChange": -16 }
      ]
    }
  ]
}

The match format is described on Matches.

Examples

A stats line for a Discord command:

const r = await fetch(`${MD_URL}/players/${encodeURIComponent(name)}/stats`, { headers });
if (r.status === 404) return 'I do not know that player.';
const { data } = await r.json();
const best = [...data.kits].sort((a, b) => b.elo - a.elo)[0];
return `${data.name}: best kit ${best.kit} at ${best.elo} ELO, win streak ${data.streak}.`;

Win rate across all ranked games, in Python:

data = requests.get(f"{BASE}/players/Steve/stats", headers=HEADERS).json()["data"]
wins = sum(k["wins"] for k in data["kits"])
games = wins + sum(k["losses"] for k in data["kits"])
print(f"{data['name']}: {wins}/{games} ranked wins ({100 * wins / games:.1f}%)" if games else "no ranked games")

Is a player online and fighting right now:

curl -s -H "Authorization: Bearer $MD_KEY" "$MD_URL/players/Steve" | jq '.data.live | {online, inMatch}'
{ "online": true, "inMatch": true }

Errors:

{"ok":false,"error":{"code":"not_found","message":"no player Nobody is known"}}
{"ok":false,"error":{"code":"bad_request","message":"id must be a UUID or a player name"}}

Cached for a few seconds

Stats are cached for cache-seconds. The plugin also writes the profiles of online players to the database in batches (storage.autosave-minutes in database.yml), so the stored stats of an online player can lag behind the game for a few minutes. Use the in-game values from GET /players/{id} (live) for the current match, and the stored values for history.

On this page