Need help retrieving information on games using the public API

I’m creating a Discord Bot for myself as a programming project. This discord bot is written and is helping me track information about my favorite roblox games. This is my first programming project.

The problem I’m having is that I tried using v1 game api and the information that I get from it about games is either outdated or doesn’t exist for new games that I know is public and played by many people. The thing i realized is that I can’t use the v1 api as it’s outdated and unreliable.

I tried using the v2 api, but I don’t get any data back from it even if the request response gives me the status of 200. The documentation for the v2 api is really bad and I don’t know what to do.

The information that I want on each game is:

  • Name
  • Description
  • Current players
  • Total visits
  • Last updated
  • Game thumbnail

I ran: curl -X 'GET' 'https://games.roblox.com/v1/games?universeIds=920587237' -H 'accept: application/json'

I got this response: { "data": [ { "id": 920587237, "rootPlaceId": 2574207693, "name": "morning", "description": "cool", "sourceName": "morning", "sourceDescription": "cool", "creator": { "id": 732675382, "name": "wormschicken", "type": "User", "isRNVAccount": false, "hasVerifiedBadge": false }, "price": null, "allowedGearGenres": [ "All" ], "allowedGearCategories": [], "isGenreEnforced": true, "copyingAllowed": false, "playing": 0, "visits": 719, "maxPlayers": 10, "created": "2018-11-16T19:29:39.017Z", "updated": "2018-11-17T19:14:24.513Z", "studioAccessToApisAllowed": false, "createVipServersAllowed": false, "universeAvatarType": "MorphToR15", "genre": "All", "isAllGenre": true, "isFavoritedByUser": false, "favoritedCount": 24 } ] }

But this is inaccurate for some of the most popular game ids.

I ran: curl -X 'GET' 'https://games.roblox.com/v2/games/920587237' -H 'accept: application/json'

I got this response: {"errors":[{"code":0,"message":"NotFound"}]}

I ran: curl -X 'GET' 'https://games.roblox.com/v2/games/920587237/media' -H 'accept: application/json'

This is the response: {"data":[]}

I would appreciate any help, thanks!

Have you tried only retrieving just 1 of the information blocks inside the data table?

For which url?

The problem with v1 is that the data is outdated. I get the data back but it’s useless because it’s incorrect.

I’m lost on which url/which part of the api I should be using to get accurate and up to date information on games.

You’ve accidentally fallen into the trap that game ID equals universe ID when it doesn’t

The solution for this is pretty simple, you’ll use https://games.roblox.com/v1/games/multiget-place-details?placeIds=920587237 which will return the JSON array

[ { "placeId": 920587237, "name": "Adopt Me! ", "description": "Adopt and raise 🐶🦄👶, trade and collect legendary pets, build your dream home, and roleplay with friends!\n\n[...]", "sourceName": "Adopt Me! ", "sourceDescription": "Adopt and raise 🐶🦄👶, trade and collect legendary pets, build your dream home, and roleplay with friends!\n\n[...]", "url": "https://www.roblox.com/games/920587237/Adopt-Me", "builder": "Uplift Games", "builderId": 295182, "hasVerifiedBadge": true, "isPlayable": true, "reasonProhibited": "None", "universeId": 383310974, "universeRootPlaceId": 920587237, "price": 0, "imageToken": "X_XXXXXXXXX_XXXX" } ]

which will get you the name and description, but most importantly the universeId

Using the universeId you can re-enter all the other endpoints you identified to get the data you want

Redoing what you said you tried with the new data

https://games.roblox.com/v1/games?universeIds=383310974 will return

{ "data": [ { "id": 383310974, "rootPlaceId": 920587237, "name": "Adopt Me! ", "description": "Adopt and raise 🐶🦄👶, trade and collect legendary pets, build your dream home, and roleplay with friends!\n\n[...]", "sourceName": "Adopt Me! ", "sourceDescription": "Adopt and raise 🐶🦄👶, trade and collect legendary pets, build your dream home, and roleplay with friends!\n\n[...]", "creator": { "id": 295182, "name": "Uplift Games", "type": "Group", "isRNVAccount": false, "hasVerifiedBadge": true }, "price": null, "allowedGearGenres": [ "RPG" ], "allowedGearCategories": [], "isGenreEnforced": true, "copyingAllowed": false, "playing": 121592, "visits": 37142265094, "maxPlayers": 48, "created": "2017-07-14T19:26:21.347Z", "updated": "2024-08-16T21:42:56.263Z", "studioAccessToApisAllowed": false, "createVipServersAllowed": false, "universeAvatarType": "MorphToR15", "genre": "RPG", "isAllGenre": false, "isFavoritedByUser": false, "favoritedCount": 26889142 } ] }

which will give you the name, description, current player count, total visits, last updated timestamp.

For the game thumbnail, we’ll use the same API you identified, https://games.roblox.com/v2/games/383310974/media which will return

{ "data": [ { "assetTypeId": 1, "assetType": "Image", "imageId": 18970744604, "videoHash": null, "videoTitle": null, "approved": true, "altText": null }, { "assetTypeId": 1, "assetType": "Image", "imageId": 17597408506, "videoHash": null, "videoTitle": null, "approved": true, "altText": null }, [...] ] }

1 Like

There’s a slightly better API endpoint for fetching the universe id:

https://apis.roblox.com/universes/v1/places/{place_id}/universe

This is because this one doesn’t require authentication, like the games API one does.

Also entirely valid way of getting the universe ID, prefer to keep everything into a single subdomain where possible

Nice find