Codeforces API

Beginner's Pick Programming / API Key Intermediate HTTPS
71 B
Measured Score 0 50 100 Speed 8/30 Consistency 20/20 Security 20/20 Browser access 15/15 Transparency 8/15 TESTED 2026-09-21

Overview

Codeforces is a competitive programming platform, and its API lets you retrieve contest data, user statistics, problem sets, and submission results programmatically. Most read endpoints are public and require no authentication, making it easy to start exploring contest history and rankings immediately. It is commonly used to build leaderboards, personal coding trackers, and competitive programming analytics tools.

Beginner Tip

Most read-only methods like user.info and contest.list work without any API key — start with these to get familiar with the response format before setting up HMAC-SHA512 signed requests.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://codeforces.com/api/user.info?handles=tourist
Result
HTTP 200 · application/json · 508 bytes · compressed
Response time
395 ms (median of 3) · fastest 388 ms
Transport
TLSv1.3 · TLS_AES_256_GCM_SHA384 · certificate issued by Google Trust Services
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Served by
cloudflare
Answered
8 of 8 weekly checks (100%, since 2026-07-31)
Recorded
2026-09-21

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
lastName string Korotkevich
country string Belarus
lastOnlineTimeSeconds integer 1789969036
city string Gomel
rating integer 3307
friendOfCount integer 90882
titlePhoto string (url) https://userpic.codeforces.org/422/title/50a2…
handle string tourist
avatar string (url) https://userpic.codeforces.org/422/avatar/2b5…
firstName string Gennady
contribution integer 112
organization string ITMO University
rank string legendary grandmaster
maxRating integer 4009

Captured Response

Captured from a real request to https://codeforces.com/api/user.info?handles=tourist on 2026-09-21. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "status": "OK",
  "result": [
    {
      "lastName": "Korotkevich",
      "country": "Belarus",
      "lastOnlineTimeSeconds": 1789969036,
      "city": "Gomel",
      "rating": 3307,
      "friendOfCount": 90882,
      "titlePhoto": "https://userpic.codeforces.org/422/title/50a270ed4a722867.jpg",
      "handle": "tourist",
      "avatar": "https://userpic.codeforces.org/422/avatar/2b5dbe87f0d859a2.jpg",
      "firstName": "Gennady",
      "contribution": 112,
      "organization": "ITMO University",
      "rank": "legendary grandmaster",
      "maxRating": 4009,
      "…": "(2 more fields)"
    }
  ]
}

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://codeforces.com/api/user.info?handles=tourist";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

How This API Fails

We deliberately sent this API a broken request and recorded exactly what came back on 2026-09-21. Knowing the shape of an error before you hit it makes error handling much easier to write.

HTTP 404 Requesting a path that does not exist text/html

Returned an HTML error page rather than JSON — worth knowing if your client assumes every response can be parsed as JSON.

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

FAILED: handles: User with handle X not found The username provided does not exist on Codeforces.
✓ Double-check the handle spelling on the Codeforces website, as handles are case-sensitive.
FAILED: Call failed with error: Unauthorized A method that requires authentication was called without a valid apiKey and hashed signature.
✓ Generate your API key on the Codeforces settings page and sign requests using HMAC-SHA512 as described in the API docs.
HTTP 503 or FAILED: Call failed The Codeforces API is temporarily unavailable or under maintenance, which happens during active contests.
✓ Retry after a short delay — the API is typically restored within minutes after a contest ends.

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 8/30
Consistency 20/20
Security 20/20
Browser access 15/15
Transparency 8/15
Endpoint Response Time 395ms

Fully tested on Sep 21, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Programming
Difficulty Intermediate
Endpoint last called: 2026-09-21

Related Tags

Similar APIs

View All →