API Series: Facts


On this series, we would like to talk about some endpoints that are already available to developers on Codealike.

Let’s start with Facts. You can access any user highlights through codealike.com/facts/soke or you can have access to some of that data through our API.

How to request a user’s Facts profile via Codealike API?

1) You should create a GET request to https://codealike.com/api/v2/facts/[USERNAME]

2) Include 2 header fields:

  • X-Api-Identity
  • X-Api-Token

Each API Token has this structure and you can get yours here:


Sample of a real API Token:


It’s expected that the field X-Api-Identity is filled with the [IDENTITY] component and the field X-Api-Token is filled with the [TOKEN] component.

IMPORTANT: You can only get a valid response from this endpoint if:

  • The X-Api-Token is valid.
  • The X-Api-Token belongs to the user filled in the Identity field.
  • [USERNAME] at the URL and X-Api-Identity field are the same.

That means you cannot get the Facts from another user.

If the request is properly built, you’ll get something like this:

 "Name":"MVC with Razor (C#)",

This is what each field represent:

  • SinceUtc: A timestamp representing when the user tracked for the first time their activity at Codealike.
  • ToUtc: A timestamp representing the last time the user tracked their activity at Codealike.
  • DaysOnFire: A timestamps array representing all the days for what the user had outstanding performance.
  • ActivityTimeInMs: A long field representing the sum of all the activity of the user in Milliseconds.
  • ActivityPercentage: An object representing the proportion of time spent among the main three activities (Building, Coding and Debugging).
  • ByTechnologies: An array of objects including the stats for each language used:
    • Each object in this array, contains the following structure:
      • Name: Friendly name of the technology.
      • Percentage: Proportion of time spent over ActivityTimeInMs for each technology.
      • Extension: File extension of the technology.
      • Categories: An array of strings containing categories for each technology. For instance: Web, Html, Desktop, etc.

Well, if you’ve received this beautiful JSON, you can start doing whatever you want, for instance:

  • Your own visualization for Codealike’s Facts.
  • A mobile client just like the one that Bogdan Bujdea did a few months ago for WindowsPhone devices.
  • An alerts and messaging mechanism to warn the users when certain levels of activity are reached.
  • A Widget for embedding stats on you online portfolio or CV.

In further posts, we’ll reveal how to extract other data from the API and play around with some serious stuff.

Enjoy and happy coding!


BONUS TRACK: If you want to get the DisplayName and AvatarUri of the user, you can get any users’ profile basic details by using the GET endpoint https://codealike.com/api/v2/account/[USERNAME]/profile. Remember to set the X-Api-Identity and X-Api-Token fields. 😉

Leave a Reply