GitHub Stats API Documentation

This API provides access to GitHub user statistics and contribution data. Click on each endpoint to see details.

Interactive API documentation (Swagger UI) is available at /docs. Alternative API documentation (ReDoc) is available at /redoc.

General

GET/ Custom API Documentation

+

Provides this custom HTML documentation page for the API.

For interactive API exploration and testing, you can use:

Example Request

GET /

Response

<!DOCTYPE html>
<html>
    <head>...</head>
    <body>... API Documentation ...</body>
</html>

GET/docs Swagger UI API Documentation

+

Provides interactive API documentation using Swagger UI. This interface allows you to explore endpoints, view models, and test API calls directly in your browser.

Example Request

GET /docs

Response

Returns the Swagger UI interface.

<!DOCTYPE html>
<html>
    <head>... Swagger UI ...</head>
    <body>... Interactive Documentation ...</body>
</html>

GET/redoc ReDoc API Documentation

+

Provides alternative API documentation using ReDoc. This interface offers a clean, three-panel view of your API specification, ideal for reading and understanding the API structure.

Example Request

GET /redoc

Response

Returns the ReDoc UI interface.

<!DOCTYPE html>
<html>
    <head>... ReDoc ...</head>
    <body>... API Documentation ...</body>
</html>

User Analytics

GET/{username}/languages Get User's Programming Languages

+

Get the programming languages used in a GitHub user's repositories.

Parameters

exclude Optional comma-separated list of languages to exclude (default: Markdown, JSON, YAML, XML)

Example Request

GET /tashifkhan/languages?exclude=HTML,CSS

Response

[
    {
        "name": "Python", 
        "percentage": 45.0
    },
    {
        "name": "JavaScript", 
        "percentage": 30.0
    }
]

Error Responses

404 - User not found or API error

500 - GitHub token configuration error

GET/{username}/contributions Get User's Contribution History

+

Retrieve a user's GitHub contribution history and statistics, including contribution calendar data, total commits, and longest streak.

starting_year Optional starting year for contribution history (defaults to account creation year)

Example Request

GET /tashifkhan/contributions?starting_year=2022

Response

{
    "contributions": {
        "2023": {
            "data": {
                "user": {
                    "contributionsCollection": {
                        "weeks": []
                    }
                }
            }
        }
    },
    "totalCommits": 1234,
    "longestStreak": 30
}

Error Responses

404 - User not found or API error

500 - GitHub token configuration error

GET/{username}/stats Get User's Complete Statistics

+

Get comprehensive GitHub statistics for a user, combining top programming languages, total contribution count, and longest contribution streak.

exclude Optional comma-separated list of languages to exclude

Example Request

GET /tashifkhan/stats?exclude=HTML,CSS,Markdown

Response

{
    "topLanguages": [
        {"name": "Python", "percentage": 45}
    ],
    "totalCommits": 1234,
    "longestStreak": 30
}

Error Responses

404 - User not found or API error

500 - GitHub token configuration error

Dashboard Details

GET/{username}/repos Get User's Repository Details

+

Retrieves detailed information for each of the user's public repositories, including README (Base64 encoded), languages, and commit count.

Example Request

GET /tashifkhan/repos

Response

[
    {
        "title": "RepoName",
        "description": "A cool project.",
        "live_website_url": "https://example.com",
        "languages": ["Python", "JavaScript"],
        "num_commits": 42,
        "readme": "BASE64_ENCODED_README_CONTENT"
    }
]

Error Responses

404 - User not found (may return empty list if service handles this way)

500 - GitHub token configuration error or API error

GET/{username}/commits Get User's Commit History Across All Repositories

+

Retrieves a list of all commits made by the user across all their owned repositories, sorted by timestamp.

Example Request

GET /tashifkhan/commits

Response

[
    {
        "repo": "RepoName",
        "message": "Fix: A critical bug",
        "timestamp": "2023-01-01T12:00:00Z",
        "sha": "commit_sha_hash",
        "url": "https://github.com/user/repo/commit/sha"
    }
]

Error Responses

404 - User not found (may return empty list if service handles this way)

500 - GitHub token configuration error or API error

Error Responses

User not found

+
{
    "status": "error",
    "message": "User not found or API error",
    "topLanguages": [],
    "totalCommits": 0,
    "longestStreak": 0
}

Server error

+
{
    "status": "error",
    "message": "GitHub token not configured",
    "topLanguages": [],
    "totalCommits": 0,
    "longestStreak": 0
}