API Reference
All available endpoints for the Time in Code API.
Base URL:
https://time-in-code.vercel.appPOST /api/track
Submit tracking data from the VS Code extension.
Request
POST /api/track
POST /api/track
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"date": "2026-02-28",
"totalSeconds": 600,
"languages": {
"typescript": 600
}
}🔄 Changed from v0.1.x
No longer requires userId in the request body. The backend derives your GitHub ID from the token automatically.
Response (200)
Success
{
"success": true,
"githubId": "12345678",
"date": "2026-02-28",
"totalSeconds": 600,
"languages": {
"typescript": 600
},
"formattedDuration": "10m"
}Error Codes
| Status | Description |
|---|---|
400 | Invalid request body |
401 | Invalid or missing token |
GET /api/stats/:githubId
Retrieve tracking stats for a user. Public endpoint — no authentication required.
Request
GET /api/stats/:githubId
GET /api/stats/12345678?startDate=2026-02-01&endDate=2026-02-28&limit=30Parameters
| Param | Type | Description |
|---|---|---|
githubId | string | GitHub ID (path param) |
startDate | string | YYYY-MM-DD filter start (optional) |
endDate | string | YYYY-MM-DD filter end (optional) |
limit | number | Days to return (default: 30, max: 365) |
Response (200)
Success
{
"githubId": "12345678",
"userName": "octocat",
"avatarUrl": "https://avatars.githubusercontent.com/u/12345678",
"data": [
{
"date": "2026-02-28",
"totalSeconds": 3600,
"languages": { "typescript": 2400, "python": 1200 },
"formattedDuration": "1h"
}
],
"totalSeconds": 86400,
"totalDays": 30,
"averageSecondsPerDay": 2880,
"formattedAverage": "48m"
}GET /api/dashboard/:githubId
Returns full dashboard analytics for charts and insights.
Request
GET /api/dashboard/:githubId
GET /api/dashboard/12345678?days=30Parameters
| Param | Type | Description |
|---|---|---|
days | number | Range to analyze (default 30, max 365) |
Response (200)
Success
{
"githubId": "12345678",
"userName": "octocat",
"avatarUrl": "https://avatars.githubusercontent.com/u/12345678",
"hasData": true,
"overview": {
"totalHours": 42,
"totalMinutes": 15,
"totalSeconds": 152100,
"totalDays": 18,
"averageHoursPerDay": 2.3,
"formattedTotal": "42h 15m"
},
"charts": {
"dailyTrend": [],
"languageBreakdown": [],
"dayOfWeekPattern": []
},
"achievements": {
"currentStreak": 5,
"longestStreak": 12,
"peakDay": {
"date": "2026-02-10",
"hours": 6.2
}
}
}