How to get player rank id in group using api?

I need it to use in discord because im making a discord bot that check what rank id is the player just tell me what is the api link and how to use it.

2 Likes

I personally use the roblox group api, and loop through the users groups until it matches the specified group id, then get their rank which is the rank ID,

def get_rank(user):
    userid = get_id_by_user(user)
    if userid != "NOT_FOUND":    
        request = requests.get(f"https://groups.roblox.com/v1/users/{userid}/groups/roles")
        response = json.loads(request.text)
        for i in response["data"]:
            if i["group"]["id"] == int(group):
                return i["role"]["rank"]

e.g:


https://groups.roblox.com/v1/users/(insert userid here)/groups/roles

2 Likes

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