{
  "openapi": "3.0.1",
  "info": {
    "title": "Stack Exchange Scraper — Questions, Answers & Search API",
    "description": "Scrape Stack Overflow & the Stack Exchange network into clean structured data — questions, answers, scores, views, tags, authors. Search by keyword, tag, or paste a URL; pull full Q&A threads by id. JSON/CSV/Excel. No login or API key needed.",
    "version": "1.0",
    "x-build-id": "IJHmLuQsIChRpaw4x"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sian.agency~stack-exchange-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sian.agency-stack-exchange-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/sian.agency~stack-exchange-scraper/runs": {
      "post": {
        "operationId": "runs-sync-sian.agency-stack-exchange-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/sian.agency~stack-exchange-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-sian.agency-stack-exchange-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",
        "properties": {
          "scrapeMode": {
            "title": "🧭 Scrape Mode",
            "enum": [
              "overview",
              "detail"
            ],
            "type": "string",
            "description": "**OVERVIEW** = cheap list mode. Pull many questions from a site by tag/sort, search by keyword, or paste a listing/tag/search URL — fast, paginated, rich question records.\n\n**DETAIL** = full mode. Give specific question ids (or question URLs) and get the complete record plus, optionally, each question's full answer list with scores and authors.",
            "default": "overview"
          },
          "site": {
            "title": "🌐 Stack Exchange Site",
            "type": "string",
            "description": "Which network site to scrape. Use the API slug, e.g. `stackoverflow`, `superuser`, `serverfault`, `askubuntu`, `mathoverflow`, `unix`, `dba`, `security`. Applies to both modes.\n\n💡 Default is `stackoverflow`.",
            "default": "stackoverflow"
          },
          "searchQuery": {
            "title": "🔎 Search Query (Overview mode)",
            "type": "string",
            "description": "**KEYWORD SEARCH:** A phrase to search the chosen site for (uses advanced search). Leave empty to list the site's questions by sort/tag instead.\n\n**Examples:** `branch prediction`, `memory leak`, `async await`\n\n💡 **TIP:** Combine with the Tag and Sort filters below to narrow results."
          },
          "tagged": {
            "title": "🏷️ Tag Filter (Overview mode)",
            "type": "string",
            "description": "Restrict to questions with this tag (or several, semicolon-joined, e.g. `python;pandas`). Works with both listing and keyword search."
          },
          "sort": {
            "title": "↕️ Sort (Overview mode)",
            "enum": [
              "",
              "activity",
              "votes",
              "creation",
              "hot",
              "week",
              "month",
              "relevance"
            ],
            "type": "string",
            "description": "Order for the question list.\n- **Listing** (no query): `activity`, `votes`, `creation`, `hot`, `week`, `month`\n- **Search** (with a query): `relevance`, `votes`, `activity`, `creation`\n\nLeave empty for the smart default (`activity` for listings, `relevance` for search).",
            "default": ""
          },
          "overviewUrl": {
            "title": "🔗 Listing / Tag / Search URL (Overview mode, optional)",
            "type": "string",
            "description": "Paste a Stack Exchange URL instead of choosing a site/query — the site and filters are read from it.\n\n**Examples:**\n- `https://stackoverflow.com/questions/tagged/python`\n- `https://superuser.com/search?q=ssh`\n\nWhen provided, this overrides the Site / Search Query / Tag fields."
          },
          "questionId": {
            "title": "📄 Single Question (Detail mode)",
            "type": "string",
            "description": "**DETAIL MODE:** A question to fetch in full. Accepts a numeric id or a question URL.\n\n**Examples:**\n- `11227809`\n- `https://stackoverflow.com/questions/11227809/why-is-conditional-processing`"
          },
          "questionIds": {
            "title": "🚀 Bulk Questions (Detail mode)",
            "uniqueItems": true,
            "type": "array",
            "description": "**BULK DETAIL:** A list of question ids or question URLs to fetch in full.\n\n**TIER-BASED LIMITS:**\n- **FREE users:** results capped per run\n- **PAID users:** unlimited\n\n💡 Click **Bulk edit** to paste one id/URL per line.",
            "items": {
              "type": "string"
            }
          },
          "fetchAnswers": {
            "title": "💬 Also Fetch Each Question's Answers",
            "type": "boolean",
            "description": "In **Detail** mode, also fetch each question's full answer list (scores, accepted flag, authors, bodies). One extra request per question.",
            "default": true
          },
          "answerSort": {
            "title": "↕️ Answer Sort (Detail mode)",
            "enum": [
              "votes",
              "activity",
              "creation"
            ],
            "type": "string",
            "description": "Order for the fetched answers: `votes` (highest first), `activity`, or `creation`.",
            "default": "votes"
          },
          "answerPagesize": {
            "title": "🔢 Answers Per Question",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many answers to fetch per question (up to 100) when **Also Fetch Answers** is on.",
            "default": 100
          },
          "pagesize": {
            "title": "📦 Questions Per Page (Overview mode)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many questions to request per page (up to 100). Higher = fewer requests.",
            "default": 50
          },
          "maxResults": {
            "title": "🔢 Max Records Per Run",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on the total records saved this run. **FREE** runs are capped at 25 regardless of this value; **PAID** runs are unlimited.",
            "default": 100
          },
          "maxPages": {
            "title": "📄 Max Pages (Overview mode)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many pages to fetch in Overview mode (up to 100 questions each). Higher = more results, more cost.",
            "default": 3
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}