Listing Game passes from a Universe

  1. What do you want to achieve?
    I’m trying to list public game passes from any universe, if they have any.

  2. What is the issue?
    I keep getting the 403 error.

  3. What solutions have you tried so far?
    I tried this post and it kept giving me the 403 error. Listing a player’s public games works fine but listing the game’s passes errors(403). I know its still possible since games like pls donate but idk what im doing wrong :sob: Is there another way I don’t know about?

I figured out a way to use Node.js and Puppeteer to return game passes, where I am basically scrapping the game’s page, but pls tell me there is a more efficient way :folded_hands:

I’m convinced there is a better way to do this, ive seen too many games where they list people’s game passes like its a print function, you cant tell me they all have an aws server scraping game pages at the speed of light :expressionless_face: How do you work around the 403 error with this code?? pls donate ur advice

local HttpService = game:GetService("HttpService")


local function getUserGamepasses(userId)
	local url = "https://games.roproxy.com/v2/users/"..userId.."/games?accessFilter=2&limit=50&sortOrder=Asc"
	local suc, res = pcall(function()
		return HttpService:GetAsync(url)
	end)
	print(res) -- Printing for any errors

	local placeIDs = {}
	if suc then
		if res then
			res = string.split(res,"},")

			for i, place in pairs(res) do
				place = string.split(place,",")

				for _, thing in pairs(place) do
					if string.find(thing,"id") and not string.find(thing,"rootPlace") then
						place = thing
						place = string.gsub(place,"%a","")
						place = string.gsub(place,"%p","")
						table.insert(placeIDs,place)
					end
				end
			end
		end
	end

	local gamepasses = {}
	local gamepassPrices = {}
	local increment = 1

	if #placeIDs > 0 then
		for i, place in pairs(placeIDs) do
			local url = "https://games.roproxy.com/v1/games/"..place.."/game-passes?limit=100&sortOrder=Asc"
			local suc, res = pcall(function()
				return HttpService:GetAsync(url)
			end)
			print(res) -- Checking if there's any error and putting it in the console

			res = string.split(res,"}")
			for x, gamepass in pairs(res) do
				if string.find(gamepass,"id") then
					local newPass = string.split(gamepass,",")
					local productId = nil
					local price = nil

					for _, info in pairs(newPass) do
						if string.find(info,"id") then
							productId = info
							productId = string.gsub(productId,"%a","")
							productId = string.gsub(productId,"%p","")
						end

						if string.find(info,"price") then
							price = info
							price = string.gsub(price,"%a","")
							price = string.gsub(price,"%p","")
						end
					end

					if productId and price then
						if not table.find(gamepassPrices,price) then
							gamepasses[increment] = {
								Item = {
									AssetId = tonumber(productId)
								};

								Product = {
									PriceInRobux = tonumber(price)
								};
							}

							table.insert(gamepassPrices,price)
							increment += 1
						end
					end
				end
			end
		end
	end

	return gamepasses
end

game.Players.PlayerAdded:Connect(function(plr)
	local gamepasses = getUserGamepasses(plr.UserId)
end)

Hi, I believe Roblox recently deprecated this API. An alternative would be:

https://apis.roblox.com/game-passes/v1/universes/{universeid}/game-passes?passView=Full&pageSize=100

Am I using this wrong cause if I put it in my browser it never returns anything, for example, this is how you get the passes from bloxfruit right?:

https://apis.roblox.com/game-passes/v1/universes/2753915549/game-passes?passView=Full&pageSize=100

and then I just get

{"gamePasses":[],"nextPageToken":null}

some other games I get

{"errorCode":"UniverseNotFound","errorMessage":"The universeId with ID: 18687417158 was not found.","field":"universeId: 18687417158","hint":null}

Make sure it’s the game/universe ID, not the place ID.

Universe ID and place ID are not equivalent. You’ll have to use a separate API endpoint to convert a place ID into a universe ID. If you’re trying to get the game-passes linked to a user’s games, I developed a prototype endpoint for that and more: GetPublicAssets/main.mjs at main · Ziffixture/GetPublicAssets · GitHub