Get GitHub avatar from email or name

Fez Vrasta picture Fez Vrasta · Apr 8, 2014 · Viewed 26.6k times · Source

I'm trying to get the GitHub user picture (avatar) from users of GitHub.

I've found these API:

https://avatars.githubusercontent.com/<username>
https://avatars.githubusercontent.com/u/<userid>

But I can't find a way to get the avatar from the user email or the user display name. I can't find documentation about that.

Is there some similar URL API to get what I'm looking for?

Answer

Paul picture Paul · Apr 3, 2016

You can append .png to the URL for the User's profile to get redirected to their avatar. You can add the query param size to specify a size smaller than the default of 460px wide (i.e. it won't allow larger than 460).

Examples:

https://github.com/twbs.png

https://github.com/npm.png?size=200

https://github.com/github.png?size=40