Need Help with Catalog v2 API

Hello!

I am trying to use the Catalog V2 API, specifically searching for items so I can grab a user’s created gamepasses (and in the future shirts, pants etc).

The documentation shows quite a lot of required parameters, so I attempted to accomodate for that.

local HttpService = game:GetService("HttpService")

local function getUserCreatedGamepasses(userId: number): {} | nil
	local passes = {}
	local cursor = ""
	local limit = 120

	repeat
		local url = "https://{PRIVATE WORKING PROXY}/catalog/v2/search/items/details"
		url ..= "?AssetTypeIds=34"                 -- AssetID Type for Gamepasses
		url ..= "&BundleTypeIds="
		url ..= "&CategoryFilter=0"
		url ..= "&SortAggregation=0"
		url ..= "&SortType=0"
		url ..= "&CreatorType=0"
		url ..= "&CreatorTargetId=" .. userId
		url ..= "&CreatorName="
		url ..= "&MaxPrice="
		url ..= "&MinPrice="
		url ..= "&Keyword="
		url ..= "&IncludeNotForSale=false"
		url ..= "&TriggeredByTopicDiscovery=false"
		url ..= "&SalesTypeFilter=0"
		url ..= "&Topics="
		url ..= "&limit=" .. limit
		url ..= "&sortOrder=Desc"

		if cursor ~= "" then
			url ..= "&cursor=" .. HttpService:UrlEncode(cursor)
		end

		local success, result = pcall(function()
			return HttpService:GetAsync(url)
		end)

		if not success then
			warn("Failed to fetch catalog items:", result)
			return nil
		end

		local data = HttpService:JSONDecode(result)

		if data.data then
			for _, item in ipairs(data.data) do
				table.insert(passes, item)
			end
		end

		cursor = data.nextPageCursor
	until not cursor

	return passes
end

game.Players.PlayerAdded:Connect(function(plr)
	local passes = getUserCreatedGamepasses(plr.UserId)
	if passes then
		for _, pass in ipairs(passes) do
			local priceText = pass.price or "(no price info)"
			print("Gamepass:", pass.name, "Price:", priceText)
		end
	end
end)

Omitted Proxy Url in the code snippet. Also broke down the disgustingly long URL so it’s somewhat readable.

Anyone familiar with the API and can see any issues with my logic/code? I keep getting HTTP Error Code 400.

Much appreciated!

I’m not experienced with this, but I do wonder if the trailing equal sign on the non-string parameters (e.g. &MaxPrice=) is passing an empty string to the API, which may result in the 400.

Passes are not supported for this endpoint. You will need to search their created experiences and iterate over the passes in each experience instead.

All parameters are actually optional, it is just a documentation error.

To fix your error, replace CreatorType=0 with CreatorType=1 (All creator types to User creator type), All creator type is intended only for using with creatorName. Minimal URL with all the garbage removed: https://catalog.roblox.com/v2/search/items/details?AssetTypeIds=34&CreatorTargetId=1&CreatorType=1

Thanks a lot! This is what I originally thought I had to do. Is there any API for getting gamepasses from games in bulk? I already have the code ready for getting games from a user’s creations, however iterating through each of these universes to check if there is a gamepass leads to ratelimits.

Unfortunately there are no endpoints for bulk fetching passes.