Skip to main content
Use the API to Make Flairs

How to use the Stack Overflow for Teams Enterprise API to manage flairs.

Joel Bradley avatar
Written by Joel Bradley
Updated over a week ago

Tags | API | Flairs |

Applies to: Enterprise

ADMIN PRIVILEGES REQUIRED

This documentation is for Stack Overflow for Teams Enterprise. Free, Basic, and Business users can access their documentation here. Find your plan.


Overview

"Flair" is a visual indication of a user's achievements on a site, usually in the form of an icon, badge, or color. On Stack Overflow, we use badges and reputation scores as flair to encourage and reward user engagement.

You can access your users' Stack Overflow Enterprise (SOE) data with the API to add flair to your own site. SOE has two APIs; API v2 offers access to more user data, while the newer API v3 has a modern interface and other improvements. The table below gives more information about these APIs.

API

User data returned

API v2.3

Badges
Reputation

API v3

Reputation

API v3

You can use Stack Overflow for Teams API v3 to get reputation data for your users. Reputation is a good indicator of a user's overall engagement on your site. To access user data, including reputation, use the following API requests.

/users/me
Retrieve data for the logged-in user.

/users
Retrieve data for all users on the site.

/users/[userId]
Retrieve data on an individual user (specified by user ID).

The SOE interactive API documentation makes it easy to test out API v3 requests. You can access this API "sandbox" by going to https://[your_site]/api/v3. Learn more in the Stack Overflow for Teams API v3 article. Below is an example of an API v3 interactive documentation user data request.

The interactive documentation system shows the raw API request URL and any returned user data.

You can copy the request URL to jump-start the development of your own custom API integrations.

API v2

In addition to reputation data, the older API v2 offers access to badge data. Badge data shows information about any bronze, silver, or gold badges each user has earned. Depending on the request, API v2 will return overall badge counts or details about specific badges (for example: user has earned the "Scholar" bronze badge).

NOTE: API v2 does not return custom awards data.

API v2 supports the following request URLs.

/users/[ids]
Retrieve data for one or more users identified by ID, including reputation and overall badge counts.

/api/me
Retrieve data for the logged-in user, including reputation and overall badge counts.

/users/[ids]/badges
Retrieve reputation and detailed badge data for one or more users identified by ID.

/api/me/badges
Retrieve reputation and detailed badge data for the logged-in user.

/users/[ids]/reputation
Retrieve a list of reputation changes for one or more users identified by ID.

/api/me/reputation
Retrieve a list of reputation changes for the logged-in user.

You can try these requests—and learn more about API v2—by going to https://[your_site]/api/docs. Scroll down the page to the "Users" area, then click on the request you'd like to test. Enter the relevant data into the "Try It" box. Below is an example of an API v2 user data request.

Security and Privacy

As with any API application, SOE API requests may return information you don't want made available on your site (for example: user ID or profile link). To avoid any breach of security or privacy, practice caution when deciding what data to include with your flair integration.

Did this answer your question?