Friends API Rate Limits

I’m using the API endpoint https://friends.roblox.com/v1/users/${userId}/followings to get a list of a user’s following. I really only care about the first page (of 100 results) but even when requesting this through a proxy I’m getting 429 (Too Many Requests) errors after only one request (or even on the first request).

Does anyone know the rate limit for this endpoint and why I might be exceeding it after only one request, or a better endpoint to use which does not have such a strict limit?

This should do it for you:

local function iterPageItems(pages)
	return coroutine.wrap(function()
		local pagenum = 1
		while true do
			for _, item in ipairs(pages:GetCurrentPage()) do
				coroutine.yield(item, pagenum)
			end
			if pages.IsFinished then
				break
			end
			pages:AdvanceToNextPageAsync()
			pagenum = pagenum + 1
		end
	end)
end
local success, friendPages = pcall(function() return Players:GetFriendsAsync(userID) end)
	if success then
		for item, pageNo in iterPageItems(friendPages) do
			table.insert(usernames, item.Id)
		end
	end

It uses the built-in API calls, but allows you to call the friend list a page at a time.

Hi Owen! Where are you requesting from? Just your browser? I have a feeling it’s your IP causing this issue, as I can’t reproduce.

I can’t reproduce this either. Are you sure you aren’t using a proxy that might interfere with this or any VPNs when running your code? Also are you sure your script doesn’t accidently make multiple requests?

1 Like

@bvetterdays @NyrionDev I’m using DigitalOcean’s App Platform to host my API which is requesting this friends API, though I realize this doesn’t give any controls over the IP used to send these requests. I think redeploying using a Droplet where all requests are sent from a dedicated IP might be better in this scenario, I’ll try it out and see. I also note that this issue only happens when my requesting the Roblox API through my hosted app, when I run my app locally and access it using the localhost domain instead of the hosted domain, this issue is not reproduced.

1 Like

After some digging around I discovered that several other endpoints are also completely blocked when being requested by DigitalOcean servers. I’ll file a bug report to get some clarification from engineers on whether this is intentional or not, I assume it is though.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.