# LeetCode Unified Scraper & Submitter (`subham_shah/leetcode-unified-scraper`) Actor

One actor for every legal LeetCode action — public profile/contest/problem/discussion scraping, authenticated submissions, run/poll results, and a raw GraphQL passthrough. All operations accept configurable random delays and an optional `simulateHuman` mode for anti-rate-limit politeness.

- **URL**: https://apify.com/subham\_shah/leetcode-unified-scraper.md
- **Developed by:** [Subham Shah](https://apify.com/subham_shah) (community)
- **Categories:** Automation, Jobs, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.00 / 1,000 completed leetcode operations

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## LeetCode Scraper, Code Runner & Submitter API

Scrape LeetCode profiles, problems, contests, discussions, and daily challenges from one Apify Actor. With a user's own authenticated LeetCode session, run code against test cases, submit solutions, and retrieve personal submissions, favorites, and progress.

Built for developer tools, study dashboards, coding-workflow automations, and research. It returns normalized dataset records, supports advanced GraphQL queries, and includes configurable pacing, optional Apify Proxy support, and a per-run spending-cap guard.

### Why use this Actor?

| Capability | What it provides |
| --- | --- |
| Public LeetCode data | Profiles, statistics, problems, official solutions, contests, rankings, discussions, and daily challenges |
| Authenticated account data | Personal submissions, accepted submissions, favorites, and progress using the caller's own session |
| Code runner | Runs a solution against test input and polls the LeetCode result |
| Code submitter | Submits a solution and returns the final LeetCode submission result |
| Advanced GraphQL | Sends an explicit query only to LeetCode's official GraphQL endpoint |
| Production controls | Pacing, jitter, stable per-run proxy support, structured outputs, and a spending-cap guard |

### Start with a public use case

Run the public Daily Challenge directly:

```bash
apify call subham_shah/leetcode-unified-scraper \
  --input='{ "operation": "dailyProblem", "simulateHuman": false }' \
  --output-dataset
````

| Use case | Example input |
| --- | --- |
| Today's Daily Challenge | [`examples/daily_challenge.json`](examples/daily_challenge.json) |
| Public profile and statistics | [`examples/profile_summary.json`](examples/profile_summary.json) |
| Problem details and tags | [`examples/problem_details.json`](examples/problem_details.json) |

### Key operations

#### Public reads - no LeetCode login required

- **Profiles and stats:** `userSummary`, `userProfile`, `userContest`, `userContestHistory`, `userBadges`, `userSkillStats`, `userLanguageStats`, `userCalendar`, `userHeatmap`, `userSubmissions`, `userAcSubmissions`
- **Problems:** `dailyProblem`, `dailyStreak`, `selectProblem`, `problemList`, `officialSolution`
- **Contests:** `allContests`, `upcomingContests`, `contestDetail`, `contestRanking`
- **Discussions:** `trendingDiscussions`, `discussTopic`, `discussComments`
- **Advanced queries:** `rawGraphql`, restricted to LeetCode's official GraphQL host

#### Authenticated reads and writes - caller provides their own session

- **Personal data:** `mySubmissions`, `myAcSubmissions`, `myFavorites`, `myProgress`
- **Run code:** `runCode` sends code to LeetCode's test runner and polls the result
- **Submit code:** `submitCode` submits code to LeetCode and polls the final verdict

Authenticated operations require `LEETCODE_SESSION` and `csrftoken` secret inputs from the user's own logged-in LeetCode browser session. Do not put credentials in public tasks, datasets, README examples, or source control.

```text
User's LeetCode session
        |
        v
Apify secret input (encrypted) ---> HTTPS request to LeetCode only
        |
        +-- never written to this Actor's dataset or logs
```

### Example inputs

#### Get today's Daily Challenge

```json
{
  "operation": "dailyProblem"
}
```

#### Get a public profile summary

```json
{
  "operation": "userSummary",
  "username": "uwi"
}
```

#### Browse medium array problems

```json
{
  "operation": "problemList",
  "difficulty": "MEDIUM",
  "tags": "array",
  "limit": 20,
  "offset": 0
}
```

#### Run code against a problem - authentication required

```json
{
  "operation": "runCode",
  "titleSlug": "two-sum",
  "lang": "python3",
  "typedCode": "class Solution:\n    def twoSum(self, nums, target):\n        return []",
  "dataInput": "[2,7,11,15]\n9",
  "LEETCODE_SESSION": "<secret session cookie>",
  "csrftoken": "<secret csrf token>"
}
```

#### Submit code - authentication required

```json
{
  "operation": "submitCode",
  "titleSlug": "two-sum",
  "lang": "python3",
  "typedCode": "class Solution:\n    def twoSum(self, nums, target):\n        return []",
  "LEETCODE_SESSION": "<secret session cookie>",
  "csrftoken": "<secret csrf token>",
  "pollTimeoutMs": 30000
}
```

#### Raw GraphQL - advanced use

```json
{
  "operation": "rawGraphql",
  "rawOperationName": "QuestionTitle",
  "rawQuery": "query QuestionTitle($titleSlug: String!) { question(titleSlug: $titleSlug) { questionId title titleSlug } }",
  "customVariables": { "titleSlug": "two-sum" }
}
```

### Normalized output

Every run writes one normalized record to the default dataset. This makes result handling consistent even though different LeetCode operations return different data.

#### Daily Challenge result

```json
{
  "operation": "dailyProblem",
  "success": true,
  "timestamp": "2026-07-13T00:00:00.000+00:00",
  "data": {
    "date": "2026-07-13",
    "link": "/problems/sequential-digits/",
    "question": {
      "frontendQuestionId": "1291",
      "title": "Sequential Digits",
      "titleSlug": "sequential-digits",
      "difficulty": "Medium"
    }
  }
}
```

#### Code-run result

```json
{
  "operation": "runCode",
  "success": true,
  "data": {
    "submission_id": "<redacted>",
    "state": "SUCCESS",
    "status_msg": "Accepted",
    "lang": "python3",
    "slug": "two-sum",
    "result_url": "https://leetcode.com/submissions/detail/<redacted>/"
  }
}
```

When an operation cannot complete, the record has `success: false` and an actionable `error`. Read-only public operations may attempt one safe frontend-data fallback after a GraphQL failure. Write operations and missing authentication are never masked by that fallback.

### Input controls

| Operation group | Useful controls |
| --- | --- |
| `user*` | `username`, `year`, `limit` |
| `dailyProblem` / `dailyStreak` | `username`, `year`, `timezone`, `includeDailyDetails` |
| `selectProblem` / `officialSolution` | `titleSlug` |
| `problemList` | `problemCategorySlug`, `difficulty`, `tags`, `searchQuery`, `skipPaidOnly`, `limit`, `offset` |
| Contest operations | `categorySlug`, `page`, `limit` |
| Discussion operations | `discussionCategories`, `first`, `topicId`, `page`, `limit`, `commentOrderBy` |
| Personal submission operations | `limit`, `offset`, `lastKey` |
| `runCode` | `titleSlug`, `lang`, `typedCode`, `dataInput`, `pollTimeoutMs` |
| `submitCode` | `titleSlug`, `lang`, `typedCode`, `pollTimeoutMs` |
| `rawGraphql` | `rawQuery`, `rawOperationName`, `customVariables` |

The Actor accepts one operation per run. Inputs unrelated to the selected operation are ignored, allowing integrations to reuse a single input object safely.

### Calling from an AI agent

Agents connected to Apify MCP can discover this Actor by its LeetCode intent, inspect the input and output schemas, and call it with one `operation` at a time. Begin with a public operation such as `dailyProblem`, `userSummary`, or `selectProblem`; use authenticated operations only when the caller can supply its own secret session inputs.

For a direct integration, invoke `subham_shah/leetcode-unified-scraper` through the Apify API or client SDK with the same JSON used in the examples above. Read the normalized dataset record's `success`, `error`, `requiresAuth`, and `warnings` fields before chaining the result into another workflow.

### Pricing

This Actor uses Apify's pay-per-event model plus the platform usage generated by a run. A completed operation that writes a result to the default dataset triggers the result event; starting a run triggers the Actor-start event. The Store Pricing tab is the authoritative source for the current prices and any run-cost limit.

### What this doesn't do

- It does not solve LeetCode problems or generate an algorithm for you; provide your own code for `runCode` and `submitCode`.
- It does not bypass paid content, browser challenges, account controls, or rate limits.
- It does not collect other users' private account data or store caller session cookies in datasets or logs.
- It does not turn raw GraphQL into arbitrary web requests; the request target is restricted to LeetCode's GraphQL endpoint.

For automated solution generation, use a coding model alongside this Actor. For general web-page crawling, use a web crawler; this Actor is focused on LeetCode data and LeetCode code-execution workflows.

### Pacing, proxy, and reliability

- `simulateHuman: true` is the default and applies operation-aware delays.
- Set `simulateHuman: false` to control `minDelayMs`, `maxDelayMs`, `thinkBeforeSubmitMs`, and `thinkAfterWrongMs` yourself.
- `jitter: true` adds random variance to configured delays.
- For larger public reads, enable `proxyConfiguration.useApifyProxy`. The Actor uses one stable proxy URL for the run, which avoids changing the IP of an authenticated session mid-operation.
- The default configuration makes direct requests. A proxy can reduce IP-based rate-limit risk but cannot solve browser challenges or guarantee access.
- The Actor respects Apify's maximum run-charge limit before starting a request that cannot return a billable result.

### Limitations and responsible use

- LeetCode can change its frontend, GraphQL schema, or rate limits without notice.
- A valid LeetCode session is required for personal data, code execution, and code submission.
- The Actor does not bypass paywalls, browser challenges, or access controls.
- Only submit code you are authorized to submit, and respect LeetCode's terms and rate limits.
- `rawGraphql` accepts only the official LeetCode GraphQL endpoint, so user cookies cannot be forwarded to arbitrary hosts.

### Local development and deployment

```bash
## Install dependencies and test
pip install -e ".[dev]"
python -m pytest
apify validate-schema

## Run the Daily Challenge locally
apify run --input='{"operation":"dailyProblem"}'

## Build and deploy
docker build -t leetcode-unified-scraper .
apify push --wait-for-finish 600
```

Apify runs this project as a Dockerized Actor, so a separate VPS is not required. The included GitHub Actions workflows run tests and validate/build the Actor; the manual deployment workflow requires an `APIFY_TOKEN` repository secret.

### Support

When reporting an issue, include the selected `operation`, non-secret input values, timestamp, and returned error. Never include `LEETCODE_SESSION`, `csrftoken`, API tokens, or request captures containing cookies.

# Actor input Schema

## `operation` (type: `string`):

Which LeetCode action to perform. Auth-gated operations (run/submit/mySubmissions/...) return a `requiresAuth` record when session is missing.

## `username` (type: `string`):

Required for `user*` operations. e.g. 'uwi'.

## `titleSlug` (type: `string`):

Required for `selectProblem`, `officialSolution`, `runCode`, `submitCode`. e.g. 'two-sum'.

## `limit` (type: `integer`):

Items to fetch for paginated lists. Default 20, max 100.

## `offset` (type: `integer`):

Items to skip for pagination (problemsetQuestionList, mySubmissions).

## `lastKey` (type: `string`):

For `mySubmissions`. Pass the previous response's `lastKey` to continue keyset pagination (for example, `1714298012000`).

## `difficulty` (type: `string`):

Used by `problemList`. Leave empty for no filter.

## `tags` (type: `string`):

Comma-separated LeetCode tag slugs for `problemList`. e.g. 'array,dynamic-programming'.

## `searchQuery` (type: `string`):

Free-text problem title search for `problemList`, for example `two sum` or `dynamic programming`.

## `skipPaidOnly` (type: `boolean`):

For `problemList`. Exclude LeetCode Premium-only problems.

## `problemCategorySlug` (type: `string`):

Optional category slug for `problemList`; leave empty for the main problem set, e.g. `algorithms`, `database`, or `shell`.

## `year` (type: `integer`):

For `userCalendar` / `userHeatmap`. Defaults to the current year; for example, `2026`.

## `timezone` (type: `string`):

For `dailyStreak`, an IANA timezone such as 'Asia/Kolkata'. Defaults to UTC.

## `includeDailyDetails` (type: `boolean`):

For `dailyStreak`, also fetch full daily question details and language snippets.

## `page` (type: `integer`):

For `contestRanking`. Page number (1-indexed).

## `first` (type: `integer`):

For `trendingDiscussions`. Default 20.

## `discussionCategories` (type: `string`):

For `trendingDiscussions`. Comma-separated current Discuss category slugs; defaults to `interview-experience`. Example: `interview-experience,career`.

## `topicId` (type: `integer`):

For `discussTopic` and `discussComments`; for example, `328491`.

## `commentOrderBy` (type: `string`):

For `discussComments`.

## `categorySlug` (type: `string`):

For `contestDetail`. e.g. 'weekly-contest-350'.

## `LEETCODE_SESSION` (type: `string`):

Required for `runCode`, `submitCode`, `mySubmissions`, `myAcSubmissions`, `myFavorites`, `myProgress`. Get it from your browser's DevTools while logged into leetcode.com. Treated as a secret — write-only.

## `csrftoken` (type: `string`):

Required for `runCode`, `submitCode`. Get it from your browser's DevTools alongside LEETCODE\_SESSION. Treated as a secret — write-only.

## `lang` (type: `string`):

For `runCode`, `submitCode`. Common values: python3, cpp, java, javascript, typescript, go, rust, ruby, swift, kotlin, php, csharp, scala, python, mysql, mssql, oraclesql, bash.

## `typedCode` (type: `string`):

Source code to run or submit. Use \n for line breaks in JSON. Required for `runCode`, `submitCode`; for example, a `class Solution` implementation for the selected problem.

## `dataInput` (type: `string`):

Optional for `runCode`. Uses the problem's sample test case when omitted, e.g. for Two Sum: `[2,7,11,15]\n9`.

## `pollTimeoutMs` (type: `integer`):

For `runCode` / `submitCode`. How long to poll for the result before giving up.

## `rawOperationName` (type: `string`):

For `rawGraphql`. Optional operation name inside `rawQuery` (also sent as X-Operation-Name), for example `QuestionTitle`.

## `rawQuery` (type: `string`):

Required for `rawGraphql`. The complete GraphQL query or mutation to send, for example `query QuestionTitle($titleSlug: String!) { question(titleSlug: $titleSlug) { title } }`.

## `customVariables` (type: `object`):

For `rawGraphql`. JSON object passed as `variables` to the GraphQL endpoint, for example `{"titleSlug": "two-sum"}`.

## `simulateHuman` (type: `boolean`):

When true, use built-in ranges (read 1.5–4s, run 3–7s, submit 8–15s, after-wrong 8–15s). Overrides the per-op delay knobs.

## `minDelayMs` (type: `integer`):

Lower bound of per-request delay when `simulateHuman` is false.

## `maxDelayMs` (type: `integer`):

Upper bound of per-request delay when `simulateHuman` is false.

## `thinkBeforeSubmitMs` (type: `array`):

Random sleep range before submitting. Default \[5000, 12000].

## `thinkAfterWrongMs` (type: `array`):

Random sleep range after a wrong attempt. Default \[8000, 15000].

## `jitter` (type: `boolean`):

Add ±20% random jitter to every sleep to look more human.

## `proxyConfiguration` (type: `object`):

Optional Apify proxy. Recommended for large scrapes.

## Actor input object example

```json
{
  "operation": "dailyProblem",
  "limit": 20,
  "offset": 0,
  "difficulty": "",
  "skipPaidOnly": true,
  "timezone": "UTC",
  "includeDailyDetails": true,
  "page": 1,
  "first": 20,
  "commentOrderBy": "newest_to_oldest",
  "lang": "python3",
  "pollTimeoutMs": 30000,
  "simulateHuman": true,
  "minDelayMs": 1500,
  "maxDelayMs": 4000,
  "thinkBeforeSubmitMs": [
    5000,
    12000
  ],
  "thinkAfterWrongMs": [
    8000,
    15000
  ],
  "jitter": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Normalized operation records in the run's default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("subham_shah/leetcode-unified-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("subham_shah/leetcode-unified-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call subham_shah/leetcode-unified-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=subham_shah/leetcode-unified-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "LeetCode Unified Scraper & Submitter",
        "description": "One actor for every legal LeetCode action — public profile/contest/problem/discussion scraping, authenticated submissions, run/poll results, and a raw GraphQL passthrough. All operations accept configurable random delays and an optional `simulateHuman` mode for anti-rate-limit politeness.",
        "version": "0.6",
        "x-build-id": "ZsnxtqZzh11cF2t1W"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/subham_shah~leetcode-unified-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-subham_shah-leetcode-unified-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/subham_shah~leetcode-unified-scraper/runs": {
            "post": {
                "operationId": "runs-sync-subham_shah-leetcode-unified-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/subham_shah~leetcode-unified-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-subham_shah-leetcode-unified-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "operation"
                ],
                "properties": {
                    "operation": {
                        "title": "Operation",
                        "enum": [
                            "userSummary",
                            "userProfile",
                            "userContest",
                            "userContestHistory",
                            "userBadges",
                            "userSkillStats",
                            "userLanguageStats",
                            "userCalendar",
                            "userHeatmap",
                            "userAcSubmissions",
                            "userSubmissions",
                            "dailyProblem",
                            "dailyStreak",
                            "selectProblem",
                            "problemList",
                            "officialSolution",
                            "allContests",
                            "upcomingContests",
                            "contestDetail",
                            "contestRanking",
                            "trendingDiscussions",
                            "discussTopic",
                            "discussComments",
                            "mySubmissions",
                            "myAcSubmissions",
                            "myFavorites",
                            "myProgress",
                            "runCode",
                            "submitCode",
                            "rawGraphql"
                        ],
                        "type": "string",
                        "description": "Which LeetCode action to perform. Auth-gated operations (run/submit/mySubmissions/...) return a `requiresAuth` record when session is missing.",
                        "default": "dailyProblem"
                    },
                    "username": {
                        "title": "LeetCode username",
                        "type": "string",
                        "description": "Required for `user*` operations. e.g. 'uwi'."
                    },
                    "titleSlug": {
                        "title": "Problem slug",
                        "type": "string",
                        "description": "Required for `selectProblem`, `officialSolution`, `runCode`, `submitCode`. e.g. 'two-sum'."
                    },
                    "limit": {
                        "title": "Result limit",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Items to fetch for paginated lists. Default 20, max 100.",
                        "default": 20
                    },
                    "offset": {
                        "title": "Offset",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Items to skip for pagination (problemsetQuestionList, mySubmissions).",
                        "default": 0
                    },
                    "lastKey": {
                        "title": "Submission cursor",
                        "type": "string",
                        "description": "For `mySubmissions`. Pass the previous response's `lastKey` to continue keyset pagination (for example, `1714298012000`)."
                    },
                    "difficulty": {
                        "title": "Difficulty filter",
                        "enum": [
                            "",
                            "EASY",
                            "MEDIUM",
                            "HARD"
                        ],
                        "type": "string",
                        "description": "Used by `problemList`. Leave empty for no filter.",
                        "default": ""
                    },
                    "tags": {
                        "title": "Topic tags",
                        "type": "string",
                        "description": "Comma-separated LeetCode tag slugs for `problemList`. e.g. 'array,dynamic-programming'."
                    },
                    "searchQuery": {
                        "title": "Search query",
                        "type": "string",
                        "description": "Free-text problem title search for `problemList`, for example `two sum` or `dynamic programming`."
                    },
                    "skipPaidOnly": {
                        "title": "Skip paid-only problems",
                        "type": "boolean",
                        "description": "For `problemList`. Exclude LeetCode Premium-only problems.",
                        "default": true
                    },
                    "problemCategorySlug": {
                        "title": "Problem category",
                        "type": "string",
                        "description": "Optional category slug for `problemList`; leave empty for the main problem set, e.g. `algorithms`, `database`, or `shell`."
                    },
                    "year": {
                        "title": "Year",
                        "minimum": 2015,
                        "maximum": 2100,
                        "type": "integer",
                        "description": "For `userCalendar` / `userHeatmap`. Defaults to the current year; for example, `2026`."
                    },
                    "timezone": {
                        "title": "Streak timezone",
                        "type": "string",
                        "description": "For `dailyStreak`, an IANA timezone such as 'Asia/Kolkata'. Defaults to UTC.",
                        "default": "UTC"
                    },
                    "includeDailyDetails": {
                        "title": "Include daily details",
                        "type": "boolean",
                        "description": "For `dailyStreak`, also fetch full daily question details and language snippets.",
                        "default": true
                    },
                    "page": {
                        "title": "Contest ranking page",
                        "minimum": 1,
                        "type": "integer",
                        "description": "For `contestRanking`. Page number (1-indexed).",
                        "default": 1
                    },
                    "first": {
                        "title": "Trending discussions count",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "For `trendingDiscussions`. Default 20.",
                        "default": 20
                    },
                    "discussionCategories": {
                        "title": "Discussion categories",
                        "type": "string",
                        "description": "For `trendingDiscussions`. Comma-separated current Discuss category slugs; defaults to `interview-experience`. Example: `interview-experience,career`."
                    },
                    "topicId": {
                        "title": "Discussion topic id",
                        "minimum": 1,
                        "type": "integer",
                        "description": "For `discussTopic` and `discussComments`; for example, `328491`."
                    },
                    "commentOrderBy": {
                        "title": "Comment ordering",
                        "enum": [
                            "newest_to_oldest",
                            "oldest_to_newest",
                            "most_votes",
                            "best",
                            "hot"
                        ],
                        "type": "string",
                        "description": "For `discussComments`.",
                        "default": "newest_to_oldest"
                    },
                    "categorySlug": {
                        "title": "Contest category slug",
                        "type": "string",
                        "description": "For `contestDetail`. e.g. 'weekly-contest-350'."
                    },
                    "LEETCODE_SESSION": {
                        "title": "LEETCODE_SESSION cookie",
                        "type": "string",
                        "description": "Required for `runCode`, `submitCode`, `mySubmissions`, `myAcSubmissions`, `myFavorites`, `myProgress`. Get it from your browser's DevTools while logged into leetcode.com. Treated as a secret — write-only."
                    },
                    "csrftoken": {
                        "title": "csrftoken cookie",
                        "type": "string",
                        "description": "Required for `runCode`, `submitCode`. Get it from your browser's DevTools alongside LEETCODE_SESSION. Treated as a secret — write-only."
                    },
                    "lang": {
                        "title": "Programming language",
                        "type": "string",
                        "description": "For `runCode`, `submitCode`. Common values: python3, cpp, java, javascript, typescript, go, rust, ruby, swift, kotlin, php, csharp, scala, python, mysql, mssql, oraclesql, bash.",
                        "default": "python3"
                    },
                    "typedCode": {
                        "title": "Typed code",
                        "type": "string",
                        "description": "Source code to run or submit. Use \\n for line breaks in JSON. Required for `runCode`, `submitCode`; for example, a `class Solution` implementation for the selected problem."
                    },
                    "dataInput": {
                        "title": "Custom test input",
                        "type": "string",
                        "description": "Optional for `runCode`. Uses the problem's sample test case when omitted, e.g. for Two Sum: `[2,7,11,15]\\n9`."
                    },
                    "pollTimeoutMs": {
                        "title": "Poll timeout (ms)",
                        "minimum": 1000,
                        "maximum": 120000,
                        "type": "integer",
                        "description": "For `runCode` / `submitCode`. How long to poll for the result before giving up.",
                        "default": 30000
                    },
                    "rawOperationName": {
                        "title": "Raw GraphQL operation name",
                        "type": "string",
                        "description": "For `rawGraphql`. Optional operation name inside `rawQuery` (also sent as X-Operation-Name), for example `QuestionTitle`."
                    },
                    "rawQuery": {
                        "title": "Raw GraphQL query",
                        "type": "string",
                        "description": "Required for `rawGraphql`. The complete GraphQL query or mutation to send, for example `query QuestionTitle($titleSlug: String!) { question(titleSlug: $titleSlug) { title } }`."
                    },
                    "customVariables": {
                        "title": "Custom GraphQL variables",
                        "type": "object",
                        "description": "For `rawGraphql`. JSON object passed as `variables` to the GraphQL endpoint, for example `{\"titleSlug\": \"two-sum\"}`."
                    },
                    "simulateHuman": {
                        "title": "Simulate human pacing",
                        "type": "boolean",
                        "description": "When true, use built-in ranges (read 1.5–4s, run 3–7s, submit 8–15s, after-wrong 8–15s). Overrides the per-op delay knobs.",
                        "default": true
                    },
                    "minDelayMs": {
                        "title": "Min delay (ms)",
                        "minimum": 0,
                        "maximum": 60000,
                        "type": "integer",
                        "description": "Lower bound of per-request delay when `simulateHuman` is false.",
                        "default": 1500
                    },
                    "maxDelayMs": {
                        "title": "Max delay (ms)",
                        "minimum": 0,
                        "maximum": 60000,
                        "type": "integer",
                        "description": "Upper bound of per-request delay when `simulateHuman` is false.",
                        "default": 4000
                    },
                    "thinkBeforeSubmitMs": {
                        "title": "Think before submit (ms)",
                        "type": "array",
                        "description": "Random sleep range before submitting. Default [5000, 12000].",
                        "default": [
                            5000,
                            12000
                        ]
                    },
                    "thinkAfterWrongMs": {
                        "title": "Think after wrong attempt (ms)",
                        "type": "array",
                        "description": "Random sleep range after a wrong attempt. Default [8000, 15000].",
                        "default": [
                            8000,
                            15000
                        ]
                    },
                    "jitter": {
                        "title": "Extra jitter",
                        "type": "boolean",
                        "description": "Add ±20% random jitter to every sleep to look more human.",
                        "default": true
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Optional Apify proxy. Recommended for large scrapes.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
