-
Notifications
You must be signed in to change notification settings - Fork 393
API Reference
DevTrack provides REST API endpoints for user settings, goals, metrics, notifications, public profiles, badges, integrations, and developer productivity insights.
This document serves as a human-readable guide to the available APIs. For the complete machine-readable specification, refer to the OpenAPI document included in the repository.
DevTrack includes Swagger UI for exploring and testing API endpoints.
After starting the development server, open:
http://localhost:3000/api-docs
The complete OpenAPI 3.1 specification is available at:
public/openapi.yaml
Most user-specific endpoints require authentication through NextAuth session cookies.
Unauthenticated requests typically return:
{
"error": "Unauthorized"
}with HTTP status 401.
/api/auth/link-github/api/auth/link-github/callback
/api/goals/api/goals/{id}/api/goals/sync
/api/metrics/activity/api/metrics/streak/api/metrics/languages/api/metrics/issues/api/metrics/prs/api/metrics/repo-health/api/metrics/weekly-summary- Additional
/api/metrics/*endpoints
/api/notifications/api/notifications/{id}/api/notifications/weekly
/api/user/settings/api/user/github-accounts/api/user/data-export
/api/public/{username}
/api/leaderboard/api/leaderboard/refresh
/api/badge/commits/api/badge/streak-shield
Returns settings for the authenticated user.
| Property | Value |
|---|---|
| Method | GET |
| Authentication | Required |
| Description | Returns current user settings |
{
"timezone": "UTC",
"publicProfile": true,
"discordNotifications": false
}Updates settings for the authenticated user.
| Property | Value |
|---|---|
| Method | PATCH |
| Authentication | Required |
| Description | Updates user settings |
{
"timezone": "Asia/Kolkata"
}{
"success": true
}Returns recent notifications for the authenticated user.
| Property | Value |
|---|---|
| Method | GET |
| Authentication | Required |
[
{
"id": "123",
"title": "Weekly Digest",
"read": false
}
]Marks notifications as read.
| Property | Value |
|---|---|
| Method | PATCH |
| Authentication | Required |
{
"success": true
}Returns goals belonging to the authenticated user.
| Property | Value |
|---|---|
| Method | GET |
| Authentication | Required |
Creates a new goal.
| Property | Value |
|---|---|
| Method | POST |
| Authentication | Required |
{
"title": "Weekly Commits",
"target": 20
}{
"id": "goal_123",
"title": "Weekly Commits",
"target": 20
}Returns leaderboard rankings.
| Property | Value |
|---|---|
| Method | GET |
| Authentication | Not Required |
| Parameter | Description |
|---|---|
| lang | Filter rankings by language |
| period | Filter by time period |
/api/leaderboard?lang=typescript&period=month
Metrics endpoints provide contributor activity, repository insights, language usage, pull request analytics, streak information, and productivity statistics.
Common metrics routes include:
/api/metrics/activity/api/metrics/streak/api/metrics/languages/api/metrics/issues/api/metrics/prs/api/metrics/repo-health/api/metrics/weekly-summary
Refer to public/openapi.yaml or /api-docs for complete endpoint definitions and response schemas.
DevTrack maintains a machine-readable OpenAPI 3.1 specification:
public/openapi.yaml
The OpenAPI specification powers the interactive Swagger UI and should remain synchronized with route implementations.
When adding or modifying API routes:
- Update the route implementation.
- Update
public/openapi.yaml. - Verify the endpoint appears correctly in
/api-docs. - Update this document if a new API category or major endpoint group is introduced.
Keeping these resources synchronized ensures contributors, self-hosters, and integrators always have accurate API documentation.