Crawling API / LeetCode

LeetCode Scraper.
Problems and solutions, fully rendered.

Send any LeetCode URL and get the fully rendered HTML back, through residential proxies with anti-bot handling built in.
Or pull structured JSON with the leetcode-serp, leetcode-problem, leetcode-solutions and leetcode-solution scrapers.

99% success rate140M residential IPs30 geographies
LeetCode URLHTML or JSONleetcode.com/problems/two-sum/CrawlbaseRouteRenderExtractRendered HTMLProblem setProblemSolutionsSolutioncrawling-apileetcode-serpleetcode-problemleetcode-solutionsleetcode-solutionleetcode.com · rendered + parsed · 200
Live crawl feed · LeetCode1.24M req/minStreaming
200leetcode.com/problems/valid-parentheses/solutions/IN182ms
301leetcode.com/problems/two-sum/NL143ms
200leetcode.com/problems/two-sum/solutions/BR52ms
200leetcode.com/problems/longest-substring-without-repeating-characters/IN99ms
200leetcode.com/problemset/?page=2BR139ms
200leetcode.com/problemset/?status=NOT_STARTEDIN103ms
200leetcode.com/problems/valid-parentheses/solutions/JP139ms
200leetcode.com/problems/climbing-stairs/solutions/DE63ms
200leetcode.com/problemset/?topicSlugs=arrayIN138ms
200leetcode.com/problemset/SG205ms
200leetcode.com/problems/climbing-stairs/solutions/GB187ms
200leetcode.com/problemset/?topicSlugs=arrayAU61ms
200leetcode.com/problems/two-sum/solutions/3619262/3-methods-c-java-python-beginner-friendl-x595JP95ms
200leetcode.com/problemset/AU108ms
200leetcode.com/problems/two-sum/solutions/GB168ms
200leetcode.com/problems/climbing-stairs/solutions/US164ms
200leetcode.com/problems/two-sum/solutions/3619262/3-methods-c-java-python-beginner-friendl-x595CA199ms
200leetcode.com/problemset/?status=NOT_STARTEDAU119ms
200leetcode.com/problems/3sum/SG134ms
200leetcode.com/problems/median-of-two-sorted-arrays/NL194ms
200leetcode.com/problems/best-time-to-buy-and-sell-stock/GB172ms
200leetcode.com/problems/add-two-numbers/JP131ms
200leetcode.com/problemset/?topicSlugs=arrayES172ms
200leetcode.com/problems/add-two-numbers/NL57ms
301leetcode.com/problems/add-two-numbers/GB195ms
200leetcode.com/problems/3sum/BR155ms
200leetcode.com/problems/valid-parentheses/solutions/IN182ms
301leetcode.com/problems/two-sum/NL143ms
200leetcode.com/problems/two-sum/solutions/BR52ms
200leetcode.com/problems/longest-substring-without-repeating-characters/IN99ms
200leetcode.com/problemset/?page=2BR139ms
200leetcode.com/problemset/?status=NOT_STARTEDIN103ms
200leetcode.com/problems/valid-parentheses/solutions/JP139ms
200leetcode.com/problems/climbing-stairs/solutions/DE63ms
200leetcode.com/problemset/?topicSlugs=arrayIN138ms
200leetcode.com/problemset/SG205ms
200leetcode.com/problems/climbing-stairs/solutions/GB187ms
200leetcode.com/problemset/?topicSlugs=arrayAU61ms
200leetcode.com/problems/two-sum/solutions/3619262/3-methods-c-java-python-beginner-friendl-x595JP95ms
200leetcode.com/problemset/AU108ms
200leetcode.com/problems/two-sum/solutions/GB168ms
200leetcode.com/problems/climbing-stairs/solutions/US164ms
200leetcode.com/problems/two-sum/solutions/3619262/3-methods-c-java-python-beginner-friendl-x595CA199ms
200leetcode.com/problemset/?status=NOT_STARTEDAU119ms
200leetcode.com/problems/3sum/SG134ms
200leetcode.com/problems/median-of-two-sorted-arrays/NL194ms
200leetcode.com/problems/best-time-to-buy-and-sell-stock/GB172ms
200leetcode.com/problems/add-two-numbers/JP131ms
200leetcode.com/problemset/?topicSlugs=arrayES172ms
200leetcode.com/problems/add-two-numbers/NL57ms
301leetcode.com/problems/add-two-numbers/GB195ms
200leetcode.com/problems/3sum/BR155ms
01 Live demo

Four LeetCode scrapers. One clean JSON each.

The four LeetCode scrapers, typed live. leetcode-solution pulls one community write-up with its code blocks, leetcode-serp reads the problem set, leetcode-problem returns a single problem with its statement and starter code, and leetcode-solutions reads a solutions tab. Switch tabs, or hover to pause and read.

ready
keys 1-4 switch · click to pauserun your own URL
Run your first request in minutes. Up to 20,000 free requests, no credit card.Start free
02 Capabilities

One API, every corner of LeetCode.

Four dedicated scrapers cover the pages that matter: the problem set, single problems, solutions tabs and single write-ups. The Crawling API renders each page in a real browser, reaches it through residential IPs, and hands you clean HTML or JSON.

problem set

The whole catalogue

leetcode-serp turns a problem set page into JSON: totalProblems and problemCount, plus every row with its id, title, titleSlug, url, difficulty, acceptance rate, premium flag and daily-challenge flag.

problems

Statements and starter code

leetcode-problem returns one problem with its statement as HTML and plain text, difficulty, category, topic tags, hints, example testcases, a starter snippet for every language LeetCode ships, similar questions and its like, dislike and submission counters.

solutions

The solutions tab

leetcode-solutions returns a solutions tab as JSON, each post with its id, title, url, author name and username, posted date, tags, upvotes, views and comment count.

write-ups

Single solutions

Add scraper=leetcode-solution to return one write-up with its author, posted date, tags, engagement counters, the body as HTML and plain text, and every rendered code block with its language.

proxies

140M residential IPs

Every request rotates a residential IP across 30 geographies and clears bot checks automatically. Nothing to solve, nothing to maintain.

one token

One API for every page

The Crawling API works on any URL, so the same token covers every LeetCode problem and solution and everything else you crawl. See the live demo.

03 Output

Every problem field, as clean JSON.

Send a problem URL with scraper=leetcode-problem and the problem comes back as typed JSON, topic tags and starter code included. Swap in leetcode-serp, leetcode-solutions or leetcode-solution for the problem set and community write-ups.

{ "url": "https://leetcode.com/problems/two-sum/", "id": "1", "title": "Two Sum", "titleSlug": "two-sum", "difficulty": "Easy", "category": "Algorithms", "isPremium": false, "description": "You are given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", "descriptionHtml": "<p>You are given an array of integers <code>nums</code>&nbsp;and an integer <code>target</code>...", "hints": [ "A really brute force way would be to search for all possible pairs of numbers...", "..." ], "topicTags": [ { "name": "Array", "slug": "array" }, { "name": "Hash Table", "slug": "hash-table" } ], "exampleTestcases": [ "[2,7,11,15]\n9", "[3,2,4]\n6", "[3,3]\n6" ], "codeSnippets": [ { "language": "Python3", "languageSlug": "python3", "code": "class Solution:\n def twoSum(self, nums: List[int], target: int) -> List[int]:" } ], "likes": 69478, "dislikes": 2592, "commentCount": 3490, "acceptedCount": 22929319, "submissionCount": 39569455, "acceptanceRate": "57.9%", "similarQuestions": [ { "title": "3Sum", "titleSlug": "3sum", "difficulty": "Medium" } ], "officialSolution": { "available": true, "isFree": true, "hasVideo": true }, "solutionsUrl": "https://leetcode.com/problems/two-sum/solutions/" }

Problem

url · string  id · string  title · string  titleSlug · string

Statement

description · string  descriptionHtml · string  hints · array  exampleTestcases · array

Topics & code

topicTags[].name · string  topicTags[].slug · string  codeSnippets[].languageSlug · string  codeSnippets[].code · string

Engagement

likes · number  dislikes · number  submissionCount · number  acceptanceRate · string

Related

similarQuestions[] · array  officialSolution.available · boolean  officialSolution.hasVideo · boolean  solutionsUrl · string

04 How it works

From URL to data in one call.

Every LeetCode request moves through the same path. You send a URL, we operate everything in between.

01

Send the URL

Pass any public LeetCode URL with your token: the problem set, a problem, a solutions tab or a single write-up.

02

Rotate a proxy

A residential IP and geography that reach the site cleanly, drawn from 140M IPs across 30 regions.

03

Render the page

A real browser loads the page so the problem table, statement panel and solution body render before capture.

04

Clear anti-bot

The site's bot checks and rate limits are handled automatically. Nothing to solve, nothing to maintain.

05

Return HTML or JSON

The fully rendered HTML comes back, or typed JSON when you add leetcode-serp, leetcode-problem, leetcode-solutions or leetcode-solution.

05 Use cases

What teams build on LeetCode data.

USE / 01Catalog

Problem set indexing

Walk the problem set page by page to build a searchable index of every problem with its id, slug, difficulty, acceptance rate and premium flag.

USE / 02Training

Interview prep tooling

Pull statements, hints, example testcases and starter snippets to power practice apps, spaced-repetition decks and internal prep tracks.

USE / 03Benchmarks

Model and agent evaluation

Assemble problem statements with their example testcases and reference write-ups as a graded benchmark set for code-generation models.

USE / 04Research

Solution and pattern mining

Collect solutions tabs and single write-ups to see which approaches, languages and data structures the community actually converges on.

USE / 05Ranking

Difficulty and popularity tracking

Track acceptance rates, likes, dislikes, submission counts, upvotes and views over time to see which problems and write-ups gain traction.

USE / 06Coverage

Any URL, one API

Crawl the problem set, problems, solutions tabs and single write-ups, plus any other site you need.

06 Notes

Good to know when scraping LeetCode.

HTML by default, JSON on request

You get the full rendered HTML. Add scraper=leetcode-serp, leetcode-problem, leetcode-solutions or leetcode-solution for parsed JSON, or parse the HTML yourself.

The daily challenge is an extra row

LeetCode pins the daily challenge above the table, so a full page comes back with one row more than the page size. It is the only row with isDailyQuestion set to true, so filter on that flag rather than on position.

Premium problems return metadata only

A premium problem keeps its identity fields, isPremium and its topic tags, but the statement and counters are behind the paywall and come back empty. Check isPremium before you treat an empty description as a parse failure.

Counters come as displayed

LeetCode abbreviates anything above a thousand on the page, so 11.9K is expanded back to 11900. The value carries the precision of the page, not the exact figure.

07 Why Crawlbase

Built to crawl LeetCode at scale.

The Crawling API runs on the same network that serves 46,000+ paying customers and 70,000+ developers. No proxies to buy, no browsers to run, nothing to patch when the site changes.

99%
Average request success rate
140M
Residential IPs, plus 98M datacenter
30
Geographies for accurate local results
20/s
Requests per second by default, more on request

One token, official SDKs for Python, Node and Ruby, and a 99.99% uptime network underneath.

08 FAQ

LeetCode scraping questions.

Send any LeetCode URL to the Crawlbase Crawling API with your token. Crawlbase rotates a residential proxy, renders the page in a real browser, clears bot checks, and returns the fully rendered HTML. Add a dedicated scraper (scraper=leetcode-serp, leetcode-problem, leetcode-solutions or leetcode-solution) to get structured JSON instead.
Yes. By default the Crawling API returns rendered HTML; add a dedicated scraper to receive structured JSON: leetcode-serp for the problem set, leetcode-problem for a single problem, leetcode-solutions for a solutions tab, and leetcode-solution for a single write-up.
Problem set and problem list pages, single problem pages, the solutions tab of a problem, and single solution pages on leetcode.com. The same API works on any other site too.
Crawlbase routes each request through rotating residential IPs across 30 geographies and clears bot checks automatically, so access stays consistent and there is nothing to maintain when the site changes its setup.
leetcode-serp returns a problem set page with totalProblems, problemCount and a row per problem. leetcode-problem returns one problem with its statement, topic tags, hints, example testcases, starter snippets and counters. leetcode-solutions returns a solutions tab with author, tags and engagement counts per post. leetcode-solution returns a single write-up with its body and every rendered code block.
The leetcode-solution scraper returns codeBlocks, each with its language and full source, alongside the write-up body as HTML and plain text. Only the blocks rendered in the served markup are returned; a post that mounts extra language tabs on click exposes just the block that shipped with the page.
Start free with up to 20,000 requests and no credit card. Paid plans scale with usage, and the same token works across the Crawling API and every Crawlbase scraper.

Start scraping LeetCode.
Skip the proxies and rate limits.

Free to begin with up to 20,000 requests. One token for the Crawling API and every scraper.