How to use Roblox API toolbox service to get audios from creator store?

I’ll start off by saying that I am extremely new to all this API stuff and using HttpService to make requests so bear with me. I have done tons of research on the Open Cloud features and implementing my own API key and secrets, but I cannot get it to work and I am stuck on what to do next.

Here is the code I am trying to implement:

local HttpService = game:GetService("HttpService")

local function request()
	local response = HttpService:RequestAsync({
		Url = `https://apis.roblox.com/toolbox-service/v2/assets:search`,
		Method = "GET",
		Headers = {
			["Content-Type"] = "application/json", 
			["x-api-key"] = HttpService:GetSecret(secret), -- secret is replacing secret name string I have set
		},
	})
	if response.Success then
		print("Status code:", response.StatusCode, response.StatusMessage)
		print("Response body:\n", response.Body)
		print("Response headers:\n", HttpService:JSONEncode(response.Headers))
	else
		print("The request failed:", response.StatusCode, response.StatusMessage)
	end
end

-- Remember to wrap the function in a 'pcall' to prevent the script from breaking if the request fails
local success, message = pcall(request)
if not success then
	print("Http Request failed:", message)
end

My main goal in all of this is to create a UI search that allows players to search for any audio on Roblox and queue it for the server. Of course, I could just go with allowing players to input their own audio asset ID, but I wanted to make it more intuitive for players.

I saw that I should be using https://apis.roblox.com/toolbox-service/v2/assets:search from the documentation.

It seems like these are newer features, as I have not seen tutorial videos or much that can help a newbie like me figure out this topic.

Any help is appreciated! :slight_smile:

I can’t dedicate much time atm, but just to give you a quick response to go off:

Except for the few APIs listed in this post, you are unable to access Roblox endpoints from within a Roblox Server. Attempting to will always result in the request erroring (which is what I believe is happening for you right now).
To get around this, you need to find a proxy which supports the endpoint you want. There should be a few listed on the devforum that you can try.

I am getting an error, but I think what I am trying to access is marked in that post under Creator Store.

I have heard about using a proxy, but I was trying to avoid this because it sounds complicated (at least for me since I haven’t used them), and I was hoping this would be a simpler way.


CreatorStoreProduct is a seperate heading to Toolbox Service (the one you used), so I don’t think it can be used

I suspect that the use of a proxy is unavoidable. They shouldn’t be too complicated though, and there should be a few tutorials on the devforum and on Youtube showing how to utilise them

1 Like

Ah I see now, that makes more sense. Hopefully that could be possible in the future, but for now I will look into proxys.

Thanks for the help and for preventing hours of confusion :laughing:

The endpoint in your post is accessible via HttpService (updated the link in the original announcement to a better page with just that endpoint).

For future reference, I would recommend changing this to

    else
		print("The request failed:", response.StatusCode, response.StatusMessage)
        print("Response body:\n", response.Body)
	end

to help with debugging (updated the code example on https://create.roblox.com/docs/reference/engine/classes/HttpService with this). You should see an error of The searchCategoryType field is required. This indicates that you need to provide that query parameter like so: https://apis.roblox.com/toolbox-service/v2/assets:search?searchCategoryType=Audio

1 Like

That is WONDERFUL, I was missing that parameter and now it works no error!

Thank you so much!

1 Like