How would I get the UserID by Name using API?

  1. What do you want to achieve? I am making a extension which automatically updates everyone’s profile picture in the devforums to improve my javascript skills

  2. What is the issue? I don’t seem to find the API for that

  3. What solutions have you tried so far? I searched it up in google the devforums but nothing came

-- this is something I want for javascript, not lua

Ok so basically, I am making a extension to automatically change everyone’s profile picture, but I don’t know the API for that

1 Like
game.Players:GetUserIdFromNameAsync("name not case sensitive")
1 Like

sorry but it’s outside of roblox

1 Like

maybe this can help?

if it isn’t js you can probably still use the same api link

1 Like

Docs: Swagger UI
Endpoint: https://users.roblox.com/v1/usernames/users
Code example:

const axios = require('axios');
async function getId(name){
    try {
    const response = await axios.post(`https://users.roblox.com/v1/usernames/users`, {
        "usernames": [name],
        "excludeBannedUsers": true
    })
    const data = response.data.data[0];
    return data.id
    }
    catch(err){return}
}
async function main(){
    console.log(await getId("3YbuKtOp"))
}
main()

Output: 1116383079
Response body

{
  "data": [
    {
      "requestedUsername": "3YbuKtOp",
      "hasVerifiedBadge": false,
      "id": 1116383079,
      "name": "3YbuKtOp",
      "displayName": "Alex_Kornilov"
    }
  ]
}
2 Likes

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