Is there a way to count someone's badges?

So I’m trying to make an overhead where it says how many badges you have, but i can’t find any API that counts all of a player’s badges,
I found this API but its inaccurate

Some images

There is games that counts all of the badges you have so I’m kind’ve confused on how they do it
and also i have over 8000+ badges so i don’t really know.

any help would be appreciated!


Hello Blaroo,

Wow… 8000+ badges sure is a lot!

What you could do is when a Player is Added, go through each badge detecting if they have it or not. Every time the code detects they do own a badge you increment a specific value +1. When the code is complete you can simply display that value where ever you please.

May not be the most efficient way, especially having 8000 badges as you said. If no API exist for this specific scenario then this could be your only route.

Wishing you the best of luck on your project!


Try using the v2 API instead of v1:!/Inventory/get_v2_users_userId_inventory_assetTypeId

The endpoint you’re using is deprecated.


When i use the badge asset type it returns an error?, my inventory is on, and when i tried with shirts it worked.

1 Like

Thank you for the idea, if i don’t find any api i will try your idea.


I don’t believe there is a direct API to get the count for a user’s badges.

I think you will have to loop through the one that returns all of a user’s badge ID’s and count the badges in each collection.


The badge count api is broken and no longer continued.


I made a way of counting badges but its far too slow. You would require a proxy, likely to fetch data from roblox. It takes me 15 minutes to get all my 16k badges… I don’t know how this game made it so fast. I tried sending 2 requests at a time…

The fastest I created the badge count was in 5 minutes… Still too long and that was because I was using spawn(function() which is terrible.


I was looking at that game, i tried to find a way like they did, still trying to find a way so it counts it, can you tell me how?

1 Like

Weird, I guess that endpoint doesn’t work with badges. You can try the inventory API, which I just tested (and it does work with badges):

I can’t find the docs for it, but here’s what all the query strings mean:

assetTypeId: the asset type’s id, 21 for badges
cursor: current cursor, don’t put anything at first and change it to the nextPageCursor of previous query
itemsPerPage: maximum of 100, how many badges it loads per page
userId: the UserId of whoever you’re getting the badges of (duh)

You can’t get a direct total, so you would have to iterate through a bunch of pages and total it up. The maximum page size is 100 as well, so it’ll be a bit annoying to do. You can’t even queue up web requests using coroutines, since you need the cursor from the previous page.


Basically there is a “cursor” when you send a get request to the endpoint. The cursor allows you to go to the next page… I think they must have got all the data from the last page and the first page then moved to the next page and the previous page making it much faster, aka x2 speed badge collection algorithm. I haven’t tried this method but it should be super fast.

The cursor is used to get the next page of badges. Add each badge to the count.


Very well, i will try to make one, thank you.

1 Like

Thank you, the API works, I will make the script now.

1 Like

Please dm the script if you make it, I want to take a look at it.

1 Like

Sticky, the project was cancelled so i didn’t get a chance to fully make it but, i just made a proxy then made it access the target’s badges – end of what i’ve done
what i was gonna do:
it reads the cursor so it goes to the next page
counts the ids then add the ids as a number


Here’s an implementation I just wrote which achieves this.

local http = game:GetService("HttpService")
local get = http.GetAsync
local jsonDecode = http.JSONDecode

local proxyUrl = ""
local baseUrl = "https://badges."..proxyUrl.."/v1/users/%d/badges?limit=100&sortOrder=Asc&cursor=%s"
local maxTries = 5

local function getUsersBadgeCountRecursive(userId, badgeCount, cursor, cache)
	badgeCount = badgeCount or 0
	cursor = cursor or ""
	cache = cache or {}
	if cache[cursor] then cache[cursor] += 1 else cache[cursor] = 1 end
	if cache[cursor] >= maxTries then return end
	local requestUrl = string.format(baseUrl, userId, cursor)
	local success, result = pcall(get, http, requestUrl)
	if success then
		if result then
			local success2, result2 = pcall(jsonDecode, http, result)
			if success2 then
				if result2 then
					cursor = result2.nextPageCursor
					if cursor then
						badgeCount += 100
						return getUsersBadgeCountRecursive(userId, badgeCount, cursor, cache)
						badgeCount +=
						return badgeCount
	return getUsersBadgeCountRecursive(userId, badgeCount, cursor, cache)

local badgeCount = getUsersBadgeCountRecursive(261) --Shedletsky's ID.
print(badgeCount) --867