LeetCode Stats API Documentation

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

GET User Statistics

+

/{username}

Parameters

username (path parameter): LeetCode username

Response Format


{
    "status": "success",
    "message": "retrieved",
    "totalSolved": 100,
    "totalQuestions": 2000,
    "easySolved": 40,
    "totalEasy": 500,
    "mediumSolved": 40,
    "totalMedium": 1000,
    "hardSolved": 20,
    "totalHard": 500,
    "acceptanceRate": 65.5,
    "ranking": 100000,
    "contributionPoints": 50,
    "reputation": 100,
    "submissionCalendar": {"timestamp": "count"}
}

                    

Example

GET /khan-tashif

GET Contest Rankings

+

/{username}/contests

Parameters

username (path parameter): LeetCode username

Response Format


{
    "status": "success",
    "message": "retrieved",
    "attendedContestsCount": 10,
    "rating": 1500,
    "globalRanking": 5000,
    "totalParticipants": 100000,
    "topPercentage": 5.00,
    "badge": {
        "name": "Guardian"
    },
    "contestHistory": [
        {
            "attended": true,
            "rating": 1500,
            "ranking": 1000,
            "trendDirection": "UP",
            "problemsSolved": 3,
            "totalProblems": 4,
            "finishTimeInSeconds": 3600,
            "contest": {
                "title": "Weekly Contest 123",
                "startTime": 1615694400
            }
        }
    ]
}

                    

Example

GET /khan-tashif/contests

GET User Profile

+

/{username}/profile

Parameters

username (path parameter): LeetCode username

Response Format


{
    "status": "success",
    "message": "retrieved",
    "username": "example_user",
    "githubUrl": "https://github.com/example",
    "twitterUrl": "https://twitter.com/example",
    "linkedinUrl": "https://linkedin.com/in/example",
    "contributions": {
        "points": 100,
        "questionCount": 5,
        "testcaseCount": 10
    },
    "profile": {
        "realName": "Example User",
        "userAvatar": "https://assets.leetcode.com/avatar.jpg",
        "birthday": "2000-01-01",
        "ranking": 10000,
        "reputation": 100,
        "websites": ["https://example.com"],
        "countryName": "United States",
        "company": "Example Corp",
        "school": "Example University",
        "skillTags": ["Python", "Algorithms"],
        "aboutMe": "LeetCode enthusiast",
        "starRating": 4.5
    },
    "badges": [...],
    "upcomingBadges": [...],
    "activeBadge": {...},
    "submitStats": {...},
    "submissionCalendar": {"timestamp": "count"},
    "recentSubmissions": [...]
}

                    

Example

GET /khan-tashif/profile

GET User Badges

+

/{username}/badges

Parameters

username (path parameter): LeetCode username

Response Format


{
    "status": "success",
    "message": "retrieved",
    "badges": [
        {
            "id": "1",
            "displayName": "Problem Solver",
            "icon": "badge-icon-url",
            "creationDate": 1609459200
        }
    ],
    "upcomingBadges": [
        {
            "name": "Fast Coder",
            "icon": "upcoming-badge-icon-url"
        }
    ],
    "activeBadge": {
        "id": "1",
        "displayName": "Problem Solver",
        "icon": "badge-icon-url",
        "creationDate": 1609459200
    }
}

                    

Example

GET /khan-tashif/badges

Error Responses

User not found

+
{
    "status": "error",
    "message": "user does not exist",
    ...
}
                        

Server error

+

{
    "status": "error",
    "message": "error message",
    ...
}

                        

Rate Limiting

Please be mindful of LeetCode's rate limiting policies when using this API.