leetcode.com APIleetcode.com ↗
Search LeetCode problems by difficulty, tags, and category. List all programming contests and fetch public user profiles with submission stats via 3 endpoints.
curl -X GET 'https://api.parse.bot/scraper/e4e91877-8a33-4462-b5ed-1a5cd60da1f0/search_problems?skip=0&limit=5&keyword=two+sum&difficulty=HARD' \ -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.
| 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'). Tag slugs match the slug field in topicTags from problem results. |
| 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": 405,
"questions": [
{
"title": "Two Sum",
"acRate": 57.47,
"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.com API
This API exposes 3 endpoints covering LeetCode's problem bank, contest schedule, and public user profiles. Use search_problems to filter the full problem set by difficulty, topic tags like dynamic-programming or hash-table, and category slugs such as algorithms or database. The response includes each problem's acceptance rate, paidOnly flag, topic tags, and frontend question ID — enough to build a problem-picker, study tracker, or contest-prep tool.
Problem Search
The search_problems endpoint accepts up to six filter parameters: keyword (title substring match), difficulty (EASY, MEDIUM, or HARD), tags (comma-separated tag slugs, e.g. array,binary-search), category (one of algorithms, database, shell, concurrency), and skip/limit for offset-based pagination. The response includes a total count of matching problems alongside a questions array. Each question object carries frontendQuestionId, title, titleSlug, difficulty, acRate (acceptance rate as a float), paidOnly (boolean), and a topicTags array with tag names and slugs.
Contests
list_contests returns the complete history of LeetCode weekly and biweekly contests — no filters, no pagination. Every contest object includes title, titleSlug, startTime (Unix timestamp), duration in seconds, originStartTime, and a containsPremium flag. The full list is returned in a single response sorted most-recent first, making it straightforward to identify upcoming or recently completed rounds.
User Profiles
get_user_profile takes a single required username parameter and returns public profile data. The profile object contains realName, aboutMe, userAvatar, reputation, ranking, company, school, websites, countryName, and skillTags. Submission statistics live in submitStatsGlobal, which holds an acSubmissionNum array broken out by difficulty level. If the username does not exist, the endpoint returns a stale_input response with kind input_not_found rather than an HTTP error.
- Build a spaced-repetition study tool that surfaces unsolved MEDIUM and HARD problems filtered by a specific topic tag like
graphortree. - Generate a contest calendar by pulling
startTimeanddurationfromlist_contestsand syncing entries to a personal calendar. - Rank candidates in a hiring pipeline by comparing
rankingand per-difficultyacSubmissionNumvalues from their LeetCode profiles. - Track a user's global ranking over time by periodically polling
get_user_profileand storing therankingfield. - Filter premium-only problems using the
paidOnlyfield fromsearch_problemsto show only freely accessible content. - Identify problems with low acceptance rates by sorting results from
search_problemson theacRatefield for advanced challenge sets. - Display a contributor's
skillTags,company, andschoolon a developer portfolio page using data fromget_user_profile.
| 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 | 250 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 LeetCode have an official developer API?+
What does the `search_problems` endpoint return for problems that require a paid subscription?+
paidOnly boolean. When paidOnly is true, the problem is only accessible to LeetCode Premium subscribers. The endpoint returns the metadata — title, difficulty, tags, acceptance rate — for both free and premium problems, so you can filter or label them as needed.Does `list_contests` support filtering by contest type (weekly vs. biweekly) or by date range?+
title or titleSlug fields client-side. If you need server-side filtering or date-range slicing, you can fork the API on Parse and revise it to add those parameters.Does the API return a user's full submission history or individual solution code?+
get_user_profile returns aggregate accepted submission counts broken down by difficulty via submitStatsGlobal.acSubmissionNum. Individual submission records, solution code, and problem-by-problem solve history are not exposed. You can fork the API on Parse and revise it to add an endpoint covering submission details if that data becomes accessible.How should I handle a username that doesn't exist when calling `get_user_profile`?+
stale_input response with kind: input_not_found rather than an HTTP 404. Your client code should check for this response shape rather than relying solely on HTTP status codes to detect missing usernames.