Codeforces API

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

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
330 ms (median of 3) · fastest 327 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
Recorded
2026-08-10

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 1786359842
city string Gomel
rating integer 3530
friendOfCount integer 90220
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 109
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-08-10. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "status": "OK",
  "result": [
    {
      "lastName": "Korotkevich",
      "country": "Belarus",
      "lastOnlineTimeSeconds": 1786359842,
      "city": "Gomel",
      "rating": 3530,
      "friendOfCount": 90220,
      "titlePhoto": "https://userpic.codeforces.org/422/title/50a270ed4a722867.jpg",
      "handle": "tourist",
      "avatar": "https://userpic.codeforces.org/422/avatar/2b5dbe87f0d859a2.jpg",
      "firstName": "Gennady",
      "contribution": 109,
      "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-08-10. 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 10/30
Consistency 20/20
Security 20/20
Browser access 15/15
Transparency 8/15
Endpoint Response Time 330ms

Fully tested on Aug 10, 2026

Technical Specifications

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

Related Tags

Similar APIs

View All →