I have already seen the flairâ„¢ image I can embed on my website. However, I think it's small and I don't really like the design.

I would like to retrieve my overall reputation and badges as seen in the flairâ„¢ and display it with a style I make on my own.

I already found http://api.stackexchange.com/, but I couldn't find anything related to an amount of rep.

Is there an free API for that? If yes, what query do I have to call?


You can use the API for this. The documentation is good.

In your case you'd use /users/{id}/associated (or /me/associated), this will return badge counts and reputation for all sites you are on. You can reconstruct the flair info this way.

The items array in the returned object will have an item for each site that looks like:

      "badge_counts": {
        "bronze": 96,
        "silver": 52,
        "gold": 5
      "question_count": 53,
      "answer_count": 868,
      "last_access_date": 1494089678,
      "creation_date": 1297699014,
      "account_id": 305991,
      "reputation": 25130,
      "user_id": 616460,
      "site_url": "http://stackoverflow.com",
      "site_name": "Stack Overflow"

For your usage you'll probably want to set the pagesize to its max of 100 and don't forget to honor the has_more parameter to support > 100 accounts. See paging.

For the profile image it's site specific, so you'll have to use /users/{id} (or /me) with the desired site parameter to get the URL of the avatar.

For details on specific sites you can use a lot of different things, just look under the Users section of http://api.stackexchange.com/docs. Each function is described there and the returned objects are described in every doc page, you'll be able to find whatever you need.

Note that there is a quota on the API. If possible you probably want to do API queries server-side on periodic intervals (or on page loads but cache the data with an expiration time), and serve cached results to clients instead of doing client-side API queries in JavaScript on every page load. Also, it's a polite thing to do!

|improve this answer|||||
  • Thanks a lot! This will definitely improve my website. – Noah Krasser May 6 '17 at 17:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .