{
  "openapi": "3.0.1",
  "info": {
    "title": "Stack Overflow Q&A Scraper",
    "description": "Extract Stack Overflow and Stack Exchange questions with their best answers (accepted first) in HTML and Markdown, votes, comments, closed status and quality scores. Search by tags or keywords, or pass question URLs. Built for AI training data, RAG and research.",
    "version": "1.0",
    "x-build-id": "TW2L0I1TNKd5NcoVb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sheshinmcfly~stackoverflow-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sheshinmcfly-stackoverflow-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/sheshinmcfly~stackoverflow-scraper/runs": {
      "post": {
        "operationId": "runs-sync-sheshinmcfly-stackoverflow-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/sheshinmcfly~stackoverflow-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-sheshinmcfly-stackoverflow-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": "Mode",
            "enum": [
              "tags",
              "search",
              "top",
              "popularTags",
              "questions"
            ],
            "type": "string",
            "description": "How to pick questions: by tags, keyword search, top questions of the site, popular tags, or specific question URLs (filled below).",
            "default": "tags"
          },
          "tags": {
            "title": "Tags",
            "type": "array",
            "description": "Questions must have all these tags ('By tags' mode). E.g. python, docker, react.",
            "items": {
              "type": "string"
            },
            "default": [
              "python"
            ]
          },
          "keywords": {
            "title": "Search keywords",
            "type": "string",
            "description": "Search text ('By keyword search' mode), e.g. 'how to reverse a list in python'.",
            "default": ""
          },
          "questionUrls": {
            "title": "Question URLs or IDs",
            "type": "array",
            "description": "Specific questions from any Stack Exchange site (https://stackoverflow.com/questions/231767, https://math.stackexchange.com/questions/1, or a bare ID on the selected site). When filled, only these questions are returned.",
            "items": {
              "type": "string"
            }
          },
          "site": {
            "title": "Stack Exchange site",
            "enum": [
              "stackoverflow",
              "superuser",
              "serverfault",
              "askubuntu",
              "mathoverflow",
              "math",
              "stats",
              "datascience",
              "physics",
              "chemistry",
              "biology",
              "electronics",
              "unix",
              "tex",
              "english",
              "rpg",
              "scifi",
              "gaming",
              "worldbuilding",
              "diy",
              "academia",
              "workplace",
              "law",
              "politics",
              "economics",
              "philosophy",
              "history",
              "travel",
              "fitness",
              "cooking"
            ],
            "type": "string",
            "description": "Which Stack Exchange community to query.",
            "default": "stackoverflow"
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "votes",
              "activity",
              "creation",
              "hot",
              "week",
              "month",
              "relevance"
            ],
            "type": "string",
            "description": "Order of the questions. Keyword search supports most voted, recent activity, newest and relevance.",
            "default": "votes"
          },
          "onlyAnswered": {
            "title": "Only answered questions",
            "type": "boolean",
            "description": "Only questions with an accepted or upvoted answer. Turn off to include unanswered ones.",
            "default": true
          },
          "minScore": {
            "title": "Min score",
            "minimum": 0,
            "type": "integer",
            "description": "Only questions with at least this score (e.g. 10 for well-vetted content). 0 = no limit.",
            "default": 0
          },
          "maxAnswers": {
            "title": "Max answers",
            "minimum": 0,
            "type": "integer",
            "description": "Only questions with at most this many answers (e.g. 1 to find questions that still need answers; turn off 'Only answered'). 0 = no limit.",
            "default": 0
          },
          "fromDate": {
            "title": "From date",
            "type": "string",
            "description": "Only questions created on or after this date (YYYY-MM-DD)."
          },
          "toDate": {
            "title": "To date",
            "type": "string",
            "description": "Only questions created before this date (YYYY-MM-DD)."
          },
          "includeAnswers": {
            "title": "Include answers",
            "type": "boolean",
            "description": "Answers for each question: the accepted one first, then the highest voted, in HTML and Markdown.",
            "default": true
          },
          "maxAnswersPerQuestion": {
            "title": "Max answers per question",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "How many answers to keep per question.",
            "default": 3
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Comments on each question and on its answers.",
            "default": false
          },
          "includeLinked": {
            "title": "Include linked questions",
            "type": "boolean",
            "description": "Questions linked to each result — useful for connected knowledge graphs.",
            "default": false
          },
          "maxLinkedQuestions": {
            "title": "Max linked questions",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "How many linked questions to keep per result.",
            "default": 5
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of questions (or tags in 'Popular tags' mode). Up to 2,500 per run without an API key.",
            "default": 50
          },
          "apiKey": {
            "title": "Stack Apps key (optional)",
            "type": "string",
            "description": "Not needed. A free key from stackapps.com only lifts the 2,500-results-per-query limit."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}