LeetCode APIleetcode.com ↗
Search LeetCode problems by difficulty and tag, list contests, and fetch public user profiles and contest history via a clean REST API.
What is the LeetCode API?
This API exposes four endpoints covering LeetCode's core public data: problem search, contest listings, user profiles, and contest participation history. Use search_problems to query the full problem set with filters for difficulty, topic tags, and category, then pull per-user stats like accepted submission counts broken down by difficulty or a full contest rating timeline from get_user_contest_history.
curl -X GET 'https://api.parse.bot/scraper/e4e91877-8a33-4462-b5ed-1a5cd60da1f0/search_problems?skip=0&tags=array&limit=5&keyword=two+sum&category=algorithms&difficulty=EASY' \ -H 'X-API-Key: $PARSE_API_KEY'
Search and filter LeetCode problems. Supports keyword search, difficulty filtering, topic tag filtering, category filtering, and offset-based pagination. Returns problems sorted by question number. Each problem includes acceptance rate, difficulty, question ID, paid-only status, title, slug, and topic tags.
| Param | Type | Description |
|---|---|---|
| skip | integer | Number of problems to skip for pagination (offset). |
| tags | string | Comma-separated topic tag slugs to filter by (e.g. 'array,hash-table,dynamic-programming'). |
| limit | integer | Maximum number of problems to return per page. |
| keyword | string | Search keyword to filter problems by title (e.g. 'two sum', 'binary tree'). |
| category | string | Category slug filter. Accepts: algorithms, database, shell, concurrency. Empty string returns all categories. |
| difficulty | string | Difficulty filter. Accepts exactly one of: EASY, MEDIUM, HARD. Case-insensitive input is uppercased internally. |
{
"type": "object",
"fields": {
"total": "integer - total number of problems matching the filters",
"questions": "array of Problem objects with acRate, difficulty, frontendQuestionId, paidOnly, title, titleSlug, topicTags"
},
"sample": {
"data": {
"total": 410,
"questions": [
{
"title": "Two Sum",
"acRate": 57.6,
"paidOnly": false,
"titleSlug": "two-sum",
"topicTags": [
{
"name": "Array",
"slug": "array"
},
{
"name": "Hash Table",
"slug": "hash-table"
}
],
"difficulty": "Easy",
"frontendQuestionId": "1"
}
]
},
"status": "success"
}
}About the LeetCode API
Problem Search
The search_problems endpoint accepts up to six filter parameters: keyword (title substring), difficulty (EASY, MEDIUM, or HARD), tags (comma-separated slugs such as array,hash-table,dynamic-programming), category (algorithms, database, shell, or concurrency), and skip/limit for offset-based pagination. Each item in the questions array carries acRate, difficulty, frontendQuestionId, paidOnly, title, titleSlug, and a topicTags list. The total field reflects the full count matching your filters, so you can page through results reliably.
Contests
list_contests returns every weekly and biweekly contest in a single response ordered by most recent first — no pagination required. Each contest object includes title, titleSlug, startTime (Unix timestamp), duration in seconds, originStartTime, and containsPremium. The total field gives the overall contest count.
User Profiles and Contest History
get_user_profile accepts a username and returns a profile object (realName, aboutMe, userAvatar, reputation, ranking, company, school, websites, countryName, skillTag) alongside submitStatsGlobal, which breaks accepted submission counts down by difficulty level. If the username does not exist the endpoint returns stale_input with kind input_not_found rather than a 404, so callers should check the response structure.
get_user_contest_history returns a contestRanking summary (attendedContestsCount, rating, globalRanking, totalParticipants, topPercentage, badge) that is null when the user has never participated in a rated contest. The contests array contains per-contest records including problemsSolved, totalProblems, finishTimeInSeconds, current rating, and trendDirection for rating change direction.
The LeetCode API is a managed, monitored endpoint for leetcode.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when leetcode.com 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 leetcode.com 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 study planner that pulls MEDIUM dynamic-programming problems via
search_problemsand tracks which ones a user has solved - Monitor contest schedules by polling
list_contestsand alerting when a new weekly or biweekly contest is added - Display a competitor's rating trajectory by charting the per-contest
ratingvalues fromget_user_contest_history - Identify premium-only problems in a topic area by filtering
paidOnlyfromsearch_problemsresults - Compare two users' global rankings and accepted submission counts using
get_user_profilefor each - Populate a leaderboard for an internal coding challenge using
contestRanking.globalRankingandtopPercentagefields - Filter shell or database category problems for non-algorithm interview prep using the
categoryparameter insearch_problems
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 200 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
| Team | $300/mo | 20,000 | 300 req/min |
| Company | $1,000/mo | 100,000 | 500 req/min |
Each endpoint has a fixed posted price per successful call — most fall between 1 and 10 credits — shown on this API's page before you run it. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does LeetCode have an official developer API?+
How does problem pagination work in `search_problems`?+
skip to set the starting offset and limit to control page size. The total field in the response reflects the full count matching your current filters, so you can calculate how many pages remain by dividing total by your limit.What happens when `get_user_contest_history` is called for a user who has never entered a contest?+
contestRanking field returns null and attendedContestsCount will be zero. The contests array will be empty. The endpoint still returns a valid response rather than an error.Does the API return the full problem description or test cases?+
search_problems returns metadata only: title, slug, difficulty, acceptance rate, topic tags, and paid-only status. Full problem statements and test cases are not included. You can fork this API on Parse and revise it to add an endpoint that fetches the full problem content by titleSlug.Does the API expose a user's submission history or individual solution code?+
submitStatsGlobal in get_user_profile, but individual submission records and solution code are not exposed. You can fork this API on Parse and revise it to add a submissions endpoint if that data is publicly accessible on LeetCode.