Swagger UI

CodeForces Stats API Documentation

This API provides access to CodeForces user statistics and contest data. Explore the endpoints below.

GET User All Stats

+

/{userid}

Parameters

userid (path parameter): CodeForces handle

Response Format


{
"handle": "example_user",
"rating": 1500,
"maxRating": 1700,
"rank": "specialist",
"maxRank": "expert",
"contests_count": 25,
"solved_problems_count": 150,
"rating_history": [
    {
        "contestId": 1234,
        "contestName": "Codeforces Round #123",
        "handle": "example_user",
        "rank": 100,
        "ratingUpdateTimeSeconds": 1632145200,
        "oldRating": 1400,
        "newRating": 1500
    }
]
}

            

Example

GET /tourist
Try it in Swagger UI

GET User Basic Info

+

/{userid}/basic

Parameters

userid (path parameter): CodeForces handle

Response Format


{
"handle": "example_user",
"rating": 1500,
"maxRating": 1700,
"rank": "specialist",
"maxRank": "expert",
"country": "Russia",
"organization": "ITMO University"
}

            

Example

GET /tourist/basic
Try it in Swagger UI

GET Multi-User Info

+

/multi/{userids}

Parameters

userids (path parameter): Semicolon-separated list of CodeForces handles

Response Format


[
{
    "handle": "tourist",
    "rating": 3800,
    "rank": "legendary grandmaster"
},
{
    "handle": "SecondBest",
    "rating": 3500,
    "rank": "international grandmaster"
}
]

            

Example

GET /multi/tourist;SecondBest
Try it in Swagger UI

GET Upcoming Contests

+

/contests/upcoming

Parameters

gym (query parameter, optional): Boolean to include gym contests

Response Format


[
{
    "id": 1234,
    "name": "Codeforces Round #123",
    "type": "CF",
    "phase": "BEFORE",
    "frozen": false,
    "durationSeconds": 7200,
    "startTimeSeconds": 1632145200
}
]

            

Example

GET /contests/upcoming?gym=false
Try it in Swagger UI

GET User Rating History

+

/{userid}/rating

Parameters

userid (path parameter): CodeForces handle

Response Format


[
{
    "contestId": 1234,
    "contestName": "Codeforces Round #123",
    "handle": "tourist",
    "rank": 1,
    "ratingUpdateTimeSeconds": 1632145200,
    "oldRating": 3795,
    "newRating": 3800
}
]

            

Example

GET /tourist/rating
Try it in Swagger UI

GET Solved Problems Count

+

/{userid}/solved

Parameters

userid (path parameter): CodeForces handle

Response Format


{
"handle": "tourist",
"count": 1500
}

            

Example

GET /tourist/solved
Try it in Swagger UI

GET User Contests

+

/{userid}/contests

Parameters

userid (path parameter): CodeForces handle

Response Format


{
"handle": "tourist",
"contests": [1234, 1235, 1236]
}

            

Example

GET /tourist/contests
Try it in Swagger UI

GET Common Contests

+

/users/common-contests/{userids}

Parameters

userids (path parameter): Semicolon-separated list of CodeForces handles

Response Format


{
"handles": ["tourist", "SecondBest"],
"common_contests": [1234, 1235, 1236]
}

            

Example

GET /users/common-contests/tourist;SecondBest
Try it in Swagger UI

Error Responses

User not found

+
{
"detail": "User information not found for {handle}"
}
                

Invalid request

+
{
"detail": "No valid handles provided"
}
                

Usage Notes

Please use this API responsibly and consider CodeForces' rate limits when making requests.

The API respects CodeForces' rate limiting of 1 request per 2 seconds.