LeetCode+API.SH

LeetCode API

LeetCode problems, daily challenges, contests and public profiles as clean JSON, with no GraphQL to reverse engineer.

The API.SH LeetCode API turns public LeetCode data into structured JSON. List problems with the problem-set filters, read one problem's metadata, fetch today's daily challenge, browse contests and pull a user's public profile, contest history and recent accepted submissions. Problem data includes difficulty, acceptance rate, topic tags, similar problems and likes. Profiles include solved counts, ranking, badges, streak and a submission calendar.

  • 8 endpoints
  • from $1 / 1,000 calls
  • 1,000 free credits / month
  • failed calls free
LeetCode user profile
GET https://api.api.sh/leetcode/v1/user
{ "success": true }
1 credit · $1 per 1,000 calls

What you can build with the LeetCode API

Problem finders and study planners

Filter the problem set by difficulty, topic tags, category and acceptance rate, then sort by frequency to build practice lists by pattern.

Daily challenge bots

Post today's LeetCode daily problem with its difficulty and topic tags to a Discord, Slack or email list.

Leaderboards and cohort tracking

Compare students, a bootcamp class or a friend group by solved counts, ranking, streak and active days.

Contest tracking

Keep a calendar of upcoming contests, read a contest's problems and points, and chart a user's rating after each contest.

Portfolio and profile widgets

Show solved counts by difficulty, badges, languages and the submission calendar on a personal site or resume page.

AI study agents

Give an assistant problem lookups and a user's progress so it can suggest what to practice next.

LeetCode data you get

Field names from real responses. Numbers come parsed, URLs absolute, dates in ISO 8601.

LeetCode API endpoints and prices

Every LeetCode endpoint costs 1 credit per call: credits are $1 per 1,000 on a monthly plan, $2 pay-as-you-go. Pricing

Profiles and accounts3
LeetCode user profile
/leetcode/v1/user
$1 · $2 PAYG
1 credit
LeetCode user contest history
/leetcode/v1/user/contests
$1 · $2 PAYG
1 credit
LeetCode user recent accepted submissions
/leetcode/v1/user/submissions
$1 · $2 PAYG
1 credit
More data5
LeetCode contest
/leetcode/v1/contest
$1 · $2 PAYG
1 credit
LeetCode contests
/leetcode/v1/contests
$1 · $2 PAYG
1 credit
LeetCode daily challenge
/leetcode/v1/daily
$1 · $2 PAYG
1 credit
LeetCode problem
/leetcode/v1/problem
$1 · $2 PAYG
1 credit
LeetCode problem list
/leetcode/v1/problems
$1 · $2 PAYG
1 credit

Call the LeetCode API

LeetCode user profile: GET https://api.api.sh/leetcode/v1/user

curl "https://api.api.sh/leetcode/v1/user?username=lee215" \
  -H "x-api-key: $APISH_KEY"
  1. Create a free accountConfirm your email and get 1,000 free credits every month. No card needed.
  2. Create an API keyOne key works for all 483 platforms.
  3. Send the requestJSON back in one call. Add output=csv or output=ndjson for files.

Why API.SH for LeetCode data

  • Public data only: no LeetCode login, cookies or account needed
  • One key and one response shape for LeetCode and 482 other platforms
  • Built and maintained by API.SH, not third-party publishers
  • Pay per call; errors on our side cost nothing
  • Live status for every endpoint

API.SH vs the official LeetCode API

We found no documented public LeetCode API in the search results. Developers usually wrap LeetCode's internal GraphQL queries in community projects on GitHub, which can break when the site changes. API.SH gives you fixed REST routes and one JSON shape, and it does not return problem statements.

Instead of maintaining a GitHub wrapper or your own scraper, use one API.SH key with a fixed price per call and routes that are kept working for you.

LeetCode API questions

What LeetCode data can I get?+

Problem lists with filters (/leetcode/v1/problems), one problem's metadata (/leetcode/v1/problem), the daily challenge (/leetcode/v1/daily), contests (/leetcode/v1/contests and /leetcode/v1/contest), a user's public profile (/leetcode/v1/user), contest history (/leetcode/v1/user/contests) and recent accepted submissions (/leetcode/v1/user/submissions).

How much does the LeetCode API cost?+

Every LeetCode endpoint costs 1 credit per call. On a monthly plan 1,000 credits cost $1 (Starter is $50/month for 50,000 credits). Pay-as-you-go is $2 per 1,000 credits, with top-ups from $15 that never expire.

Is there a free trial?+

Yes. Every account gets 1,000 free credits every month. That is 1,000 calls to /leetcode/v1/contest at 1 credit each.

Is there an official LeetCode API?+

LeetCode does not document a public API that we could find. Most tools wrap its internal GraphQL queries. API.SH offers a stable alternative with REST routes, and it reads public pages only.

Do I need a LeetCode account or login?+

No. API.SH reads public LeetCode pages only. No endpoint uses a login, cookies or anyone's account. Premium-only content is not returned, though problems carry a premium flag.

Can I get the problem statement or solutions?+

No. The problem route returns metadata such as difficulty, tags, acceptance rate, hints count and function signature, but not the statement text or solution code.

Can I use the LeetCode API from Python?+

Yes. Use the Python SDK, or call the HTTPS endpoints from any language with your API key. JavaScript has an SDK too, and Google Sheets, Zapier, Make and n8n work without code.

How do I get started?+

1. Sign up at api.sh. 2. Copy your API key from the dashboard. 3. Call /leetcode/v1/problem with a slug such as two-sum, or /leetcode/v1/daily for today's challenge. Request examples and every parameter are in the docs at https://api.sh/docs. You can also use the JS or Python SDK, Google Sheets, Zapier, Make, n8n or the MCP server at https://api.sh/mcp.

More reference APIs all developer & reference APIs →

Start with 1,000 free credits
Every month, on every account. One key works for all 483 platforms.
Get a free API key