Getting a Place's Server List

This is super basic, but this is just a super quick explanation as to how you could get the full list of servers of a game.

Roblox has a very open (and well documented) games api that you can use with HttpService. There’s a lot of stuff in that API, however the endpoint we’re looking for is the /v1/games/{placeId}/servers/{serverType}. The documentation will essentially help you build a URL you can GET from, however a minor issue is that you’re limited to only 100 servers at a time. This could easily be mitigated with a while loop. I made a quick example of a function that would get all the servers of a specified placeId below:

local HttpService = game:GetService("HttpService")

function getServerList(placeId)
    local cursor
    local servers = {}
    repeat
        local response = HttpService:JSONDecode(HttpService:GetAsync("https://games.roblox.com/v1/games/" .. placeId .. "/servers/Public?sortOrder=Asc&limit=100" .. (cursor and "&cursor=" .. cursor or "")))
        for _, v in pairs(response.data) do
            table.insert(servers, v)
        end
        cursor = response.nextPageCursor
    until not cursor
    return servers
end

As shown in the games API documentation, the array this function returns should be filled with objects formatted like so:

{
    "id": "00000000-0000-0000-0000-000000000000",
    "maxPlayers": 0,
    "playing": 0,
    "playerIds": [
        0
    ],
    "fps": 0,
    "ping": 0,
    "name": "string",
    "vipServerId": 0,
    "accessCode": "00000000-0000-0000-0000-000000000000"
}

(yes id is the job id)

Hope you found this helpful, cheers!

EDIT: You may want to add a delay in-between requests to avoid being rate-limited.
LATE EDIT: Sorry if I didn’t mention this, but you probably will have to use a proxy or something for this to work

35 Likes

Very interesting, thanks for sharing

Have you actually tested this? You can’t access Roblox endpoints from inside Roblox?

5 Likes

Roblox servers cant send requests to roblox.com domains outside the internal service HttpRbxApiService, where it’s methods are all behind RobloxScriptSecurity, meaning you cant use it.

afaik, this is done to prevent roblox servers from ddosing their own site.

4 Likes

Can you get place servers (by that I mean how Experiences have places) using this from the main Experience? Also how would I put these servers into gui form? Sorry a bit new to this stuff.

The Roblox web API is general purpose, so yes. Just keep in mind that you have to use a proxy (there are a few available) in order to access the API since Roblox understandably doesn’t want to DDOS their own servers.

Where can I get a more in depth explanation of each parameter and how to use them?