Skip to content

Public API

Everything on these pages as JSON. Free, read only, no key. CORS is open, so a browser can call it too. Please cache what you fetch: the numbers only change every 10 minutes.

Base URL

text
https://metrics.fivemad.com/api/metrics/v1

Every endpoint takes game = fivem (default),redm or enhanced. GET /api/metrics/v1 lists them all.

Endpoints

  • GET/stats

    Totals for one game right now: servers, servers with players, players, slots, the 24 hour peak, frameworks, script makers, countries, artifacts.

    Parameters: game

  • GET/history

    Players on the whole game over time. Points are [time, average, highest] per bucket; a null is a bucket we did not measure.

    Parameters: game, range = 24h | 7d | 30d | 90d

  • GET/servers

    The server ranking, 100 rows at most per call.

    Parameters: game, q, country (two letters), framework, tag, sort = players | avg | peak | resources | climbing | slots, all=1 for empty servers too, limit, offset

  • GET/servers/{id}

    One server by its join code (the part after cfx.re/join/), with its weekday by hour heatmap.

  • GET/servers/{id}/history

    Players on one server over time.

    Parameters: range

  • GET/servers/{id}/resources

    What the server runs, how many servers run each of those, and what it added or removed.

  • GET/resources

    The resource ranking. Stock FXServer resources are left out unless stock=1.

    Parameters: game, q, sort = servers | players | share | climbing, stock, limit, offset

  • GET/resources/{name}

    One resource: servers, share, ranks, the 7 day change, frameworks and countries of its servers, and what it is often installed with.

    Parameters: game

  • GET/resources/{name}/history

    Servers and players per day.

    Parameters: game, days (up to 365)

  • GET/resources/{name}/servers

    The servers running it, busiest first.

    Parameters: game, limit, offset

  • GET/changes

    The latest resource installs and removals on servers with 5 players or more.

    Parameters: game

  • GET/search

    Servers and resources matching a word, six of each.

    Parameters: game, q

Examples

From a FiveM or RedM resource, with the native HTTP call:

lua
-- server.lua: how many servers run your script, once at start
PerformHttpRequest("https://metrics.fivemad.com/api/metrics/v1/resources/" .. GetCurrentResourceName(), function(status, body)
    if status ~= 200 then return end
    local r = json.decode(body).resource
    print(("%s runs on %d servers (%s)"):format(r.name, r.servers, r.rank and ("#" .. r.rank) or "unranked"))
end, "GET")

From JavaScript:

js
const res = await fetch("https://metrics.fivemad.com/api/metrics/v1/resources?game=fivem&limit=10");
const { resources } = await res.json();
for (const r of resources) console.log(r.rank, r.name, r.servers);

From a shell:

bash
curl "https://metrics.fivemad.com/api/metrics/v1/servers/j4rmqol"

What comes back

These two are the live answers, rendered when this page loaded.

GET /stats?game=fivem

json
{
  "game": "fivem",
  "servers": 31660,
  "online": 7211,
  "players": 163061,
  "slots": 3237226,
  "peak24": 203183,
  "frameworks": [
    {
      "framework": "vrp",
      "servers": 2784,
      "online": 713,
      "players": 47096
    },
    {
      "framework": "esx",
      "servers": 14286,
      "online": 2376,
      "players": 43194
    }
  ],
  "...": "..."
}

GET /resources?limit=2

json
{
  "game": "fivem",
  "total": 479193,
  "limit": 2,
  "offset": 0,
  "resources": [
    {
      "name": "oxmysql",
      "servers": 38134,
      "live": 6862,
      "players": 148312,
      "share": 0.8587965048193856,
      "playerShare": 0.9080178282803546,
      "rank": 3,
      "rankPlayers": 2,
      "servers7d": null,
      "rank7d": 3,
      "stock": false
    },
    {
      "name": "pma-voice",
      "servers": 35116,
      "live": 6419,
      "players": 137386,
      "share": 0.7908296549860373,
      "playerShare": 0.8411250428564432,
      "rank": 4,
      "rankPlayers": 4,
      "servers7d": null,
      "rank7d": 4,
      "stock": false
    }
  ]
}

Errors

An error is a JSON body with error (a short code), message anddocs. 400 for a bad parameter, 404 for a server or resource we do not know, 429 when you go over your limit (with retry-after), 503 while the collector has no data or the whole API is at its ceiling.