{
  "openapi": "3.0.1",
  "info": {
    "title": "Stack Overflow Q&A Scraper",
    "description": "Extract questions and answers from Stack Overflow via the official Stack Exchange API. Filter by tags, keywords, or top voted. Returns question body, accepted answer, top answers, vote counts, and tags. Perfect for AI training data, RAG pipelines, and knowledge bases.",
    "version": "1.0",
    "x-build-id": "PdbVxIahFS3Hk9ook"
  },
  "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"
            ],
            "type": "string",
            "description": "How to query Stack Exchange: by tags, keyword search, top voted all-time, or explore popular tags.",
            "default": "tags"
          },
          "tags": {
            "title": "Tags",
            "type": "array",
            "description": "Filter questions by tags (used in 'By tags' mode). E.g. python, javascript, docker, react.",
            "items": {
              "type": "string"
            },
            "default": [
              "python"
            ]
          },
          "keywords": {
            "title": "Search keywords",
            "type": "string",
            "description": "Search query (used in 'By keyword search' mode). Supports full text search: 'how to reverse a list in python'.",
            "default": ""
          },
          "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. 30 most popular sites available + any other via custom input.",
            "default": "stackoverflow"
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "votes",
              "activity",
              "creation"
            ],
            "type": "string",
            "description": "How to sort questions.",
            "default": "votes"
          },
          "onlyAnswered": {
            "title": "Only answered questions",
            "type": "boolean",
            "description": "Skip questions with no accepted answer. Turn off for broader discovery.",
            "default": true
          },
          "includeAnswers": {
            "title": "Include answers",
            "type": "boolean",
            "description": "Fetch the top answers for each question. Disable for faster runs.",
            "default": true
          },
          "includeLinked": {
            "title": "Include linked questions",
            "type": "boolean",
            "description": "Also fetch questions linked to each result. Useful for building connected knowledge graphs.",
            "default": false
          },
          "maxAnswersPerQuestion": {
            "title": "Max answers per question",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many top-voted answers to fetch per question.",
            "default": 3
          },
          "maxLinkedQuestions": {
            "title": "Max linked questions",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many linked questions to fetch per result.",
            "default": 5
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum number of questions (or tags in 'popular tags' mode) to extract.",
            "default": 50
          },
          "fromDate": {
            "title": "From date",
            "type": "string",
            "description": "Only return questions created after this date (YYYY-MM-DD). Leave empty for no lower limit.",
            "default": ""
          },
          "toDate": {
            "title": "To date",
            "type": "string",
            "description": "Only return questions created before this date (YYYY-MM-DD). Leave empty for no upper limit.",
            "default": ""
          },
          "minScore": {
            "title": "Min score",
            "minimum": 0,
            "type": "integer",
            "description": "Only return questions with at least this score. E.g. set to 10 to get well-vetted content.",
            "default": 0
          },
          "maxAnswers": {
            "title": "Max answers",
            "minimum": 0,
            "type": "integer",
            "description": "Only return questions with at most this many answers. 0 = no limit. Useful for finding unanswered questions.",
            "default": 0
          },
          "apiKey": {
            "title": "Stack Exchange API key (optional)",
            "type": "string",
            "description": "Optional API key to increase daily quota from 300 to 10,000 requests. Get one free at stackapps.com.",
            "default": ""
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}