{
  "openapi": "3.0.1",
  "info": {
    "title": "Stack Overflow Scraper: Questions, Answers and Comments",
    "description": "Scrape Stack Overflow and every Stack Exchange site through the official API: questions by tag, search or URL with answers and comments, bodies in HTML, plain text and Markdown, score, views, tags, accepted answer, author and CC BY-SA attribution.",
    "version": "1.0",
    "x-build-id": "fdRLH9XE7zQ3OU6KU"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/zhtech~stack-overflow-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-zhtech-stack-overflow-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/zhtech~stack-overflow-scraper/runs": {
      "post": {
        "operationId": "runs-sync-zhtech-stack-overflow-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/zhtech~stack-overflow-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-zhtech-stack-overflow-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": {
          "mode": {
            "title": "What to scrape",
            "enum": [
              "tags",
              "search",
              "urls"
            ],
            "type": "string",
            "description": "Questions by tag: the questions of one or more tags. Search: free text search, optionally inside some tags. Question URLs or IDs: specific questions (links from any Stack Exchange site, answer links work too).",
            "default": "tags"
          },
          "site": {
            "title": "Site",
            "type": "string",
            "description": "Any Stack Exchange site: a short name (stackoverflow, superuser, serverfault, askubuntu, math, unix, dba, datascience, gaming, cooking and so on), a domain (math.stackexchange.com) or a link to the site. Question URLs carry their own site; this field is then only used for bare numeric IDs.",
            "default": "stackoverflow"
          },
          "tags": {
            "title": "Tags (mode: Questions by tag)",
            "type": "array",
            "description": "Tags exactly as on the site, one per line, for example python, javascript, c#, google-sheets. A tag page link (https://stackoverflow.com/questions/tagged/python) works too.",
            "default": [
              "web-scraping"
            ],
            "items": {
              "type": "string"
            }
          },
          "tagMatch": {
            "title": "Several tags",
            "enum": [
              "any",
              "all"
            ],
            "type": "string",
            "description": "Any: each tag is its own query (duplicates are removed). All: only questions that carry every tag, for example python and pandas together.",
            "default": "any"
          },
          "searchQueries": {
            "title": "Search queries (mode: Search)",
            "type": "array",
            "description": "Free text searches, one per line, for example: async await deadlock. Each query is searched separately in titles, bodies and tags.",
            "items": {
              "type": "string"
            }
          },
          "searchTags": {
            "title": "Only in these tags (mode: Search)",
            "type": "array",
            "description": "Optional. Search only questions that carry at least one of these tags.",
            "items": {
              "type": "string"
            }
          },
          "questionUrls": {
            "title": "Question URLs or IDs (mode: Question URLs or IDs)",
            "type": "array",
            "description": "One per line: question links (https://stackoverflow.com/questions/11227809/...), short links (https://superuser.com/q/123), answer links (https://stackoverflow.com/a/456, resolved to their question) or numeric IDs (Site is used for those). Links from different sites can be mixed. Up to 100 questions per API request.",
            "items": {
              "type": "string"
            }
          },
          "sort": {
            "title": "Sort",
            "enum": [
              "votes",
              "activity",
              "creation",
              "relevance",
              "hot",
              "week",
              "month"
            ],
            "type": "string",
            "description": "Order of questions. Votes: highest score first. Activity: recently active first. Creation: newest first (best for monitoring). Relevance: search only. Hot, week and month: tag listings only, like the tabs on the site.",
            "default": "votes"
          },
          "maxQuestionsPerQuery": {
            "title": "Max questions per tag or query",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Stops each tag or search after this many saved questions. Without an API key the API serves at most 25 pages of 100 (2,500 questions) per query. Not used in the Question URLs mode.",
            "default": 20
          },
          "includeAnswers": {
            "title": "Include answers",
            "type": "boolean",
            "description": "Adds the answers of each question (accepted answer first, then by score) with body, score and author. They come in the same API request as the questions, so they cost no extra quota. Each included answer is a billable answer event.",
            "default": true
          },
          "maxAnswersPerQuestion": {
            "title": "Max answers per question",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "1 keeps only the accepted (or top voted) answer. Raise it for full threads.",
            "default": 1
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Adds the comments of each question and of each included answer. Comments are free (no extra event).",
            "default": false
          },
          "outputMode": {
            "title": "Output layout",
            "enum": [
              "nested",
              "separate"
            ],
            "type": "string",
            "description": "Nested: one row per question with its answers inside (best for JSON and automations). Separate rows: answers become their own rows linked by questionId (best for spreadsheets).",
            "default": "nested"
          },
          "fromDate": {
            "title": "Asked on or after",
            "type": "string",
            "description": "Only questions created on or after this date. YYYY-MM-DD (UTC), a full ISO timestamp, or a relative value such as 24 hours, 7 days, 3 months. Applied by the API, so it costs no extra quota."
          },
          "toDate": {
            "title": "Asked on or before",
            "type": "string",
            "description": "Only questions created on or before this date. Same formats; a plain date includes the whole UTC day."
          },
          "minScore": {
            "title": "Min score",
            "type": "integer",
            "description": "Only questions with at least this score (upvotes minus downvotes). Leave empty for no limit."
          },
          "minAnswers": {
            "title": "Min answers",
            "minimum": 0,
            "type": "integer",
            "description": "Only questions with at least this many answers."
          },
          "minViews": {
            "title": "Min views",
            "minimum": 0,
            "type": "integer",
            "description": "Only questions viewed at least this many times."
          },
          "acceptedAnswer": {
            "title": "Accepted answer",
            "enum": [
              "any",
              "yes",
              "no"
            ],
            "type": "string",
            "description": "Keep all questions, only those with an accepted answer, or only those without one.",
            "default": "any"
          },
          "closedStatus": {
            "title": "Open or closed",
            "enum": [
              "any",
              "open",
              "closed"
            ],
            "type": "string",
            "description": "Keep all questions, only open ones, or only closed ones.",
            "default": "any"
          },
          "titleContains": {
            "title": "Title contains",
            "type": "string",
            "description": "Only questions whose title contains this text."
          },
          "excludeTags": {
            "title": "Exclude tags",
            "type": "array",
            "description": "Skip questions that carry any of these tags.",
            "items": {
              "type": "string"
            }
          },
          "maxQuestions": {
            "title": "Max questions (whole run)",
            "minimum": 0,
            "type": "integer",
            "description": "Stops the whole run after this many questions. 0 means no limit. Your maximum cost per run (set in the run options) is respected as well.",
            "default": 0
          },
          "maxPagesPerQuery": {
            "title": "Max API pages per tag or query",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Protects your API quota. Each page holds up to 100 questions. Filters that the API cannot apply itself (several tags with All, or filters combined with the hot, week or month sort) may need several pages.",
            "default": 10
          },
          "apiKey": {
            "title": "Stack Exchange API key (optional)",
            "type": "string",
            "description": "Optional and free. Without a key the API allows 300 requests per day per IP address, and on Apify that IP address is shared. With your own key you get 10,000 requests per day and no 25 page limit. Register an app at https://stackapps.com/apps/oauth/register and paste its Key (not the client secret)."
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Not needed: the official API is used. A proxy only changes the IP address of the run (one IP for the whole run). Residential proxy is replaced by datacenter automatically.",
            "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}