Getting a players profile picture URL

Hello,

I am trying to get the URL for the player’s profile picture for a discord webhook.

I saw another thread on this involving API’s but no mention on how to do it.

Can someone please help me out here?

Thanks!

1 Like

Avatar Thumbnmails API:

https://thumbnails.roblox.com/docs/index.html

I understand I need that API, but how do I use it?

local Players = game:GetService("Players")

local player = Players.LocalPlayer

-- Fetch the thumbnail
local userId = player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

-- Set the ImageLabel's content to the user thumbnail
local imageLabel = script.Parent
imageLabel.Image = content
imageLabel.Size = UDim2.new(0, 420, 0, 420)

OK, so down the page, there is the Users section, click GET to see the Parameters required. Click “Try It Out” to enter some test parameters such as the payer Ids, then click Execute and it will show you the curl request, an example GET and then the response.

My example:
curl:

curl -X 'GET' \
  'https://thumbnails.roblox.com/v1/users/avatar-headshot?userIds=576373112&size=100x100&format=Png&isCircular=true' \
  -H 'accept: application/json'

Test URL:
https://thumbnails.roblox.com/v1/users/avatar-headshot?userIds=576373112&size=100x100&format=Png&isCircular=true
JSON Response:

{
  "data": [
    {
      "targetId": 576373112,
      "state": "Completed",
      "imageUrl": "https://tr.rbxcdn.com/30DAY-AvatarHeadshot-59EB43603C55BE03D35B433BE55686F0-Png/100/100/AvatarHeadshot/Png/isCircular",
      "version": "TN3"
    }
  ]
}

It is this JSON response that you will need to parse and extract the imageUrl from in Disco.