Gravatar C# API

By: Nicklas Møller Jepsen

Each time I write a new app that involves users (which is pretty often) I think it would be nice to be able to display their own profile image, without the need of authenticating them against facebook, Linkedin or by using their Microsoft account.

Therefore I decided to use Gravatar, which basically allows you to request a user image (avatar) when you only know their email address. This is pretty simply and you can just make a plain HTTP GET and get their image url in response. Try this:


If you don't want to read any more and just want the Nuget package:

Install-Package GravatarSharp.Core

Now, there is now email address in this request, and that is because Gravatar uses a hash of the users email. So you would need some way of generating the hash from the users email and then making the request. Further more you can retrieve lots of other information about the users presented in JSON format:


Because I write many applications that could use this, and because I love small APIs/libraries I decided to make a Gravatar C# API and put the code on Github and make the API distributable using Nuget.

You can find the project here on Github

And on Nuget: GravatarSharp.Core

If you just need to install the Nuget package for a project, simply open the package manager and enter:

Install-Package GravatarSharp.Core