Building with the API

Comparing FiveM Servers Programmatically

Building your own server-comparison view on top of the CFXR API instead of the built-in /compare page.

The short answer

CFXR's /compare page covers side-by-side comparison of a handful of servers in the browser, but if you want to embed comparison in your own dashboard, compare more servers than it supports, or apply your own scoring logic, you can build the same thing yourself on top of the resolve and bulk endpoints.

Why build your own comparison view

The built-in /compare page is deliberately simple — a quick, no-code way to line up a small number of servers side by side. There are a few reasons to outgrow it: you want the comparison embedded directly in your own community dashboard or Discord bot rather than linking players out to CFXR; you want to compare more servers at once than the built-in page is designed for; or you want a custom ranking — sorted by player count, by uptime percentage, by number of shared resources with your own server — that the generic comparison view doesn't offer.

Fetching multiple servers and assembling your own table

The building block is the same one used for bulk monitoring: POST /api/resolve/bulk with an inputs array of join codes returns a result per server in one call, up to 25 at a time. From there, assembling a comparison table is just a matter of picking which fields from each result you want as columns — name, player count, status, hosting provider — and rendering them however suits your dashboard. The full field reference is at the API reference.

Custom scoring is just arithmetic on top of that same response — for example ranking servers by player count as a share of whatever cap you care about, or by how many of the fields you're tracking (uptime, hosting quality, resource overlap) come out favorably compared to the others. Because the comparison logic runs entirely on data you already fetched, there's no constraint on how many criteria you weigh or how you combine them — that's exactly the flexibility the built-in page doesn't offer.

Computing shared resources between servers

One useful comparison the built-in page doesn't surface on its own is which resources two servers actually share. Since each resolved server's result includes its resource list, computing an overlap is a straightforward set intersection: turn each server's resource list into a set, and intersect them to get the resources both servers are running. This is a common thing to check when evaluating whether a competing or copycat server is running a similar framework or the same leaked scripts as yours.

Going beyond what /compare does out of the box

A couple of comparisons are worth building once you're already fetching data yourself rather than relying on a live snapshot. Historical uptime comparison — how consistently has each server actually stayed online over the last week or month, not just its status right now — is available for monitored servers via GET /api/servers/{code}/history, letting you compare reliability rather than a single point-in-time read. You can also track a ranking over time — say, which server in a group has the highest average player count each day — simply by running your comparison on a schedule and storing the results, turning a one-time comparison into a trend.

None of this requires anything beyond the resolve, bulk and history endpoints already documented at /api — the comparison logic itself lives entirely on your side once you have the data.

Related guides