Code::Stats API

⭐ Beginner's Pick Documents & Productivity / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

Code::Stats is a free API that tracks programming activity by language, recording XP points earned through coding. You can retrieve a user's total stats, XP per language, and recent activity history. It is a fun way to add developer activity statistics to portfolios or personal dashboards.

💡

Beginner Tip

Code::Stats profiles are public by default, so you can query any username without authentication — perfect for adding your coding stats to a personal website with zero setup.

Available Data

track name and artist
album metadata
audio preview URLs
popularity score
genre classification
vehicle make and model

Example Response

JSON Response
{
  "name": "Bohemian Rhapsody",
  "artist": "Queen",
  "album": "A Night at the Opera",
  "duration_ms": 354000,
  "popularity": 92,
  "preview_url": "https://p.scdn.co/mp3-preview/..."
}

Field Reference

username The Code::Stats username whose data is returned.
total_xp Total XP accumulated by the user across all languages.
new_xp XP earned in the current 24-hour period (resets daily).
languages Map of language names to their XP stats objects.
languages[name].xps Total XP earned for that programming language.
languages[name].new_xps XP earned for that language in the current 24-hour window.

Implementation Example

const url = "https://codestats.net/api-docs";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

404 Not Found The username in the URL does not exist on Code::Stats.
Check that the username is spelled correctly and matches the exact profile URL at codestats.net.
Empty languages object The user has not synced any coding activity yet.
The user needs to install the Code::Stats plugin for their editor and complete some coding sessions.
CORS error in browser Code::Stats does not support CORS, so direct browser requests fail.
Make API requests from a server-side script or a backend proxy rather than directly from frontend JavaScript.

Matrix Score Breakdown

🌐 Reachability 0/30
⚡ Speed 15/20
🔒 Security 15/15
🛠 Developer XP 9/20
✓ Reliability 0/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS NO
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →