How can I get user image's url

I am trying to get user image url using API. I tried using “Get a user by id” but not getting the image url. Any suggestions?

So you not see what you want in

I can’t quite tell on my phone, but I think that should be there.


I tried finding it but don’t see any url ending in image file. I have seen the api documentation but can’t figure out which parameter will have this value.

You don’t see avatar_template in there? Also the docs ade not complete. Have you looked at How to reverse engineer the Discourse API.

1 Like

It’s at data.user.avatar_template in that JSON. You can replace {size} with the size you want.

// something like this
const size = 240;
const avatarTemplate = data.user.avatar_template;
const avatarURL = avatarTemplate.replace(/\{size\}/, size);

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