CSES APIcses.fi ↗
Access CSES problem lists, full problem statements, category filters, courses, and contests via a structured JSON API with 5 endpoints.
What is the CSES API?
The CSES API gives programmatic access to the cses.fi competitive programming platform across 5 endpoints, returning problem lists grouped by category, full problem statements with time and memory limits, and catalogs of courses and contests. The get_problem_detail endpoint alone returns 10 structured fields per problem, including description text, input/output format, constraints, and example cases.
No input parameters required.
curl -X GET 'https://api.parse.bot/scraper/1b9e55e4-6851-41ea-ba8a-1383ad8800c0/get_problem_set_list' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace cses-fi-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""CSES Problem Set API — browse categories, drill into problems, explore resources."""
from parse_apis.cses_problem_set_api import CSES, ProblemCategory, NotFoundError_
client = CSES()
# List all categories and print their names + problem counts.
for cat in client.categories.list(limit=5):
print(cat.name, len(cat.problems))
# Get a specific category by enum, then inspect its first problem summary.
dp = client.categories.get(name=ProblemCategory.DYNAMIC_PROGRAMMING)
first_problem = dp.problems[0]
print(first_problem.name, first_problem.task_id, first_problem.stats)
# Drill from a summary into the full problem detail.
detail = first_problem.details()
print(detail.title, detail.time_limit, detail.memory_limit)
for ex in detail.examples:
print(ex.input, "->", ex.output)
# Fetch a problem directly by task_id.
try:
problem = client.problems.get(task_id="1068")
print(problem.title, problem.technique)
except NotFoundError_ as exc:
print(f"problem not found: {exc}")
# List courses and contests.
for course in client.courses.list(limit=3):
print(course.name, course.url)
for contest in client.contests.list(limit=3):
print(contest.name, contest.description)
print("exercised: categories.list / categories.get / problems.get / ProblemSummary.details / courses.list / contests.list")
Returns all problems in the CSES Problem Set grouped by category. Each category contains its name and a list of problem summaries with task IDs, acceptance stats, technique hints, and URLs. Single-page response; no pagination parameters.
No input parameters required.
{
"type": "object",
"fields": {
"categories": "array of category objects, each containing category name and problems array"
},
"sample": {
"data": {
"categories": [
{
"category": "Introductory Problems",
"problems": [
{
"url": "https://cses.fi/problemset/task/1068",
"name": "Weird Algorithm",
"stats": "167888 / 175510",
"task_id": "1068",
"technique": "Simulation (Collatz conjecture)"
}
]
}
]
},
"status": "success"
}
}About the CSES API
Problem Set Browsing
The get_problem_set_list endpoint returns every problem on the CSES Problem Set organized into category objects. Each category contains an array of problems with their names, numeric task_id values, acceptance statistics, suggested technique labels, and direct URLs. This gives a full structural snapshot of the problem set in one call — no parameters required.
To drill down to a specific topic, get_problems_by_category accepts a category string (e.g. 'Dynamic Programming', 'Graph Algorithms', 'Sorting and Searching') and returns matching problems with the same per-problem fields: name, task_id, stats, technique, and url.
Problem Detail
get_problem_detail takes a single required parameter — task_id — and returns the complete problem statement. Response fields include title, description, input_format, output_format, constraints, time_limit (e.g. '1.00 s'), memory_limit (e.g. '512 MB'), a technique hint, and an examples array with input / output pairs. This is enough to render a full problem view or feed it into automated analysis.
Courses and Contests
get_courses_list and get_contests_list each return flat arrays of objects with name, description, and url. These cover the educational courses hosted on CSES alongside any active or past contests, making it straightforward to enumerate the full learning and competition offering alongside the problem data.
The CSES API is a managed, monitored endpoint for cses.fi — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when cses.fi changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official cses.fi API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a personal study tracker that maps CSES problems by category using
get_problems_by_categoryand tracks which technique labels appear most often. - Render full problem statements in a custom offline reader using the
description,input_format,output_format, andexamplesfields fromget_problem_detail. - Generate flashcard decks for competitive programming techniques by extracting the
techniquefield across all problems returned byget_problem_set_list. - Create a difficulty or acceptance-rate leaderboard by aggregating the stats field from problems across all categories.
- Enumerate CSES courses and contests for a competitive programming resource directory using
get_courses_listandget_contests_list. - Automate problem recommendation by filtering categories and cross-referencing technique hints against a user's solved-problem history.
- Index the full CSES problem corpus into a search engine using title, description, and constraints from bulk
get_problem_detailcalls.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does cses.fi have an official developer API?+
What does `get_problem_detail` return beyond the problem text?+
get_problem_detail returns 10 fields: title, task_id, description, input_format, output_format, constraints, time_limit, memory_limit, technique, and an examples array. Each object in examples contains an input string and an output string matching the sample cases shown on the problem page.Does the API return user submission history or solution code?+
Are editorial or solution hints included in the problem detail response?+
get_problem_detail response includes a technique field with a short label for the suggested approach, but full editorial text and solution explanations are not part of the response. You can fork this API on Parse and revise it to add an editorial endpoint if that content is accessible on cses.fi.How specific are the category names accepted by `get_problems_by_category`?+
category parameter must match a category name as it appears in the CSES Problem Set — for example, 'Introductory Problems', 'Sorting and Searching', or 'Dynamic Programming'. You can retrieve the full list of valid category names by calling get_problem_set_list first and extracting the category name field from each returned category object.