Leetcode API
Pricing
from $0.02 / 1,000 results
Go to Apify Store

Leetcode API
Scrape LeetCode user profiles, problems, contests, and discussions. Get user stats, solved problems, contest ratings, submission history, activity heatmaps, daily challenges, and more - all without authentication.
Pricing
from $0.02 / 1,000 results
Rating
5.0
(1)
Developer

Raghav Taneja
Maintained by Community
Actor stats
0
Bookmarked
7
Total users
2
Monthly active users
a month ago
Last modified
Categories
Share
LeetCode API Scraper
Scrape LeetCode user profiles, problems, contests, and discussions data without authentication.
Features
- User Data: Profiles, badges, solved problems, contest rankings, submission history, activity heatmaps
- Problem Data: Daily challenges, specific problems, problem lists with filters, official solutions
- Contest Data: All contests, upcoming contests, contest details, leaderboards
- Discussion Data: Trending discussions, topic details, comments
Input
| Field | Type | Description |
|---|---|---|
operation | String | Required. The type of data to fetch |
username | String | LeetCode username (for user operations) |
titleSlug | String | Problem/contest slug (e.g., "two-sum") |
limit | Integer | Number of items to fetch (default: 20) |
skip | Integer | Items to skip for pagination |
year | Integer | Year for calendar/heatmap data |
difficulty | String | Filter: EASY, MEDIUM, HARD |
tags | String | Comma-separated topic tags |
topicId | Integer | Discussion topic ID |
page | Integer | Page number for rankings |
Operations
User Operations
userProfile- Basic user profileuserSummary- Complete user data in one call (recommended)userBadges- User badgesuserSolved- Solved problems with percentagesuserContest- Contest rating and statsuserContestHistory- Contest participation historyuserSubmissions- Recent submissions (max 20)userAcSubmissions- Recent accepted submissions (max 20)userCalendar- Submission calendaruserHeatmap- Activity heatmap (year/month/day breakdown)userSkillStats- Skill tags by categoryuserLanguageStats- Programming language stats
Problem Operations
dailyProblem- Today's daily challengeselectProblem- Get specific problem by titleSlugproblemList- List problems with filtersofficialSolution- Get official solution for a problem
Contest Operations
allContests- All LeetCode contestsupcomingContests- Upcoming contests with countdowncontestDetail- Specific contest detailscontestRanking- Contest leaderboard
Discussion Operations
trendingDiscussions- Trending discussion topicsdiscussTopic- Get discussion topic detailsdiscussComments- Get discussion comments
Example Usage
Get User Summary
{"operation": "userSummary","username": "uwi"}
Get Daily Problem
{"operation": "dailyProblem"}
Get Problem List with Filters
{"operation": "problemList","difficulty": "MEDIUM","tags": "array,dynamic-programming","limit": 50}
Get Contest Ranking
{"operation": "contestRanking","titleSlug": "weekly-contest-350","page": 1}
Output
Results are saved to the default dataset with this structure:
{"operation": "userSummary","success": true,"data": { /* LeetCode data */ },"timestamp": "2024-01-15T10:30:00.000Z"}
Limitations
- Submission limit: LeetCode's public API limits
userSubmissionsanduserAcSubmissionsto 20 items. UseuserSummaryfor aggregate stats. - Rate limiting: Implemented to avoid overloading LeetCode's servers
- Premium content: Some content may require LeetCode Premium subscription
Notes
- Problem content is cleaned and formatted from HTML to readable text
- HTML entities (
\u003C,<, etc.) are properly decoded - Solutions include video and code playground links
- Heatmaps include daily submission counts organized by year/month/day
Cost
This Actor uses minimal compute resources as it only makes HTTP requests to LeetCode's GraphQL API.
Support
For issues and feature requests, please open an issue in the repository.