{
  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}