# Stack Overflow Scraper – Questions & Answers API (`unnoted/stackoverflow-questions`) Actor

Search Stack Overflow or any Stack Exchange site by keyword, tags and date. Get each question's title, link, body, tags, score, views, answer count, accepted answer and dates, with its CC BY-SA license. No login needed. Unofficial.

- **URL**: https://apify.com/unnoted/stackoverflow-questions.md
- **Developed by:** [Unnoted](https://apify.com/unnoted) (community)
- **Categories:** Developer tools, AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 questions

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What does Stack Overflow Scraper – Questions & Answers API do?

Stack Overflow Scraper searches Stack Overflow, or any other Stack Exchange site, by keyword, tags and date, and returns each question as one typed row: title, link, Markdown body, tags, score, views, answer count, accepted answer, open bounty, close status, dates and the CC BY-SA license that applies to it.

Unofficial, not affiliated with Stack Overflow.

**Main features:** up to 100,000 questions per run, no login needed, export to JSON, CSV or Excel, and full API and scheduling support on Apify.

### What data can you get from Stack Overflow?

Each question is one row with these fields:

| Field | Description |
|---|---|
| `questionId` | Question id on its site (always filled) |
| `title` | Question title (always filled) |
| `link` | Question page URL (always filled) |
| `tags` | Tags on the question |
| `body` | Question text in Markdown, as the asker wrote it |
| `score` | Upvotes minus downvotes |
| `viewCount` | Times the question was viewed |
| `answerCount` | Number of answers |
| `isAnswered` | Whether the question has an accepted or upvoted answer |
| `acceptedAnswerId` | Id of the accepted answer; empty when none is accepted |
| `createdAt` | When the question was asked (ISO 8601) |
| `lastActivityAt` | Last answer, comment or edit (ISO 8601) |
| `lastEditAt` | Last edit of the question (ISO 8601); empty if never edited |
| `closedAt` | When the question was closed (ISO 8601); empty while open |
| `closedReason` | Why it was closed, e.g. Duplicate or Needs more focus |
| `bountyAmount` | Open bounty in reputation points; empty when none |
| `contentLicense` | License of the question's current text: CC BY-SA 2.5, 3.0 or 4.0, by the date of its last revision |
| `site` | Site the question is on, e.g. stackoverflow.com |
| `searchQuery` | Search words that found the question |
| `scrapedAt` | When the question was collected (ISO 8601) |

### How to scrape Stack Overflow with Stack Overflow Scraper – Questions & Answers API

1. Open Stack Overflow Scraper – Questions & Answers API on Apify and go to the **Input** tab.
2. In **Search words**, enter `python`.
3. In **Max questions**, enter `100`.
4. Click **Start** and wait for the run to finish. A small run like this one takes under a minute.
5. Open the **Output** tab to see the results, or download them as JSON, CSV, Excel or HTML.

### Input

See the **Input** tab for every option. The fields:

| Field | Name | What it does | Default |
|---|---|---|---|
| `query` | Search words | Words to search for in question titles and bodies, e.g. python asyncio or "null pointer". Empty means every question (narrowed by tags and dates). |  |
| `tags` | Tags | Only questions carrying all of these tags, e.g. python and pandas. Empty means any tags. |  |
| `site` | Site | Which Stack Exchange site to search: stackoverflow, superuser, serverfault, askubuntu, math, or any site's address such as math.stackexchange.com. | `"stackoverflow"` |
| `sort` | Sort by | Order of the results. "Best match" stops at 2,500 questions without an API key; the other orders can go past it. Options: `activity` (Recent activity), `creation` (Newest), `votes` (Most votes), `relevance` (Best match). | `"activity"` |
| `acceptedAnswer` | Accepted answer | Filter by whether the asker accepted an answer. Options: `any` (Any), `yes` (Only questions with an accepted answer), `no` (Only questions without one). | `"any"` |
| `dateFrom` | Asked from | Only questions asked on or after this date (YYYY-MM-DD, e.g. 2025-01-01). Empty means no lower bound. |  |
| `dateTo` | Asked until | Only questions asked on or before this date (YYYY-MM-DD). Empty means up to today. |  |
| `apiKey` | Stack Exchange app key (optional) | Optional: your own free Stack Exchange app key, for large or frequent runs. |  |
| `maxItems` | Max questions | Maximum number of questions in total. You pay only for questions saved. | `100` |

Example input:

```json
{
  "query": "python",
  "maxItems": 100
}
```

### Output

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel. One real result:

````json
{
  "questionId": 80008650,
  "title": "Does type-checking have any runtime overhead?",
  "link": "https://stackoverflow.com/questions/80008650/does-type-checking-have-any-runtime-overhead",
  "tags": [
    "python",
    "python-typing"
  ],
  "body": "At the moment I am excluding all the type-checking imports from runtime as code below but now wondering if this is necessary and whether these actually get compiled into the .pyc and used at runtime anyway?\n\n```\n\nimport os\n\ninteractive_mode: bool = True if os.getenv('PYCHARM_HOSTED') else False\n\nif interactive_mode:\n    from typing import Iterator\n    from typing import Any\n    import types\n    from types import FrameLocalsProxyType\n    from wsgiref.types import StartResponse\n```\n\nNote:\nThe linked duplicate doesn't really answer the question; it is quite old and seemingly inconclusive.  The root question of whether ```import typing``` or ```import types``` has runtime overhead remains unanswered.",
  "score": -4,
  "viewCount": 43,
  "answerCount": 0,
  "isAnswered": false,
  "acceptedAnswerId": null,
  "createdAt": "2026-10-08T10:01:16.000Z",
  "lastActivityAt": "2026-10-08T22:36:54.000Z",
  "lastEditAt": "2026-10-08T22:36:54.000Z",
  "closedAt": "2026-10-08T10:06:31.000Z",
  "closedReason": "Duplicate",
  "bountyAmount": null,
  "contentLicense": "CC BY-SA 4.0",
  "site": "stackoverflow.com",
  "searchQuery": "python",
  "scrapedAt": "2026-10-08T22:59:05.352Z"
}
````

### How much does it cost to scrape Stack Overflow?

Stack Overflow Scraper – Questions & Answers API uses pay-per-event pricing: **$2.00 per 1,000 questions** (Question). You pay only for questions saved to the dataset; platform usage is included in the price. Each run also has Apify's standard start fee of a fraction of a cent.

| Questions | Price |
|---|---|
| 100 | $0.20 |
| 1,000 | $2.00 |
| 10,000 | $20.00 |

Set **Max items** (and the run's maximum cost in the run options) to cap what a run can spend. The run stops when either limit is reached.

### Use cases

- **Developer relations and product teams:** track every new question tagged with your library or API and see what users get stuck on.
- **Technology trend research:** count questions per tag and month to compare frameworks, languages or cloud services.
- **Documentation gaps:** find high-view questions without an accepted answer and write the docs or answers they need.
- **Support monitoring:** schedule a daily run for your product's tag and send new questions to Slack, email or Google Sheets.
- **Community analytics:** study scores, answer rates and close reasons across Stack Exchange sites such as Super User, Server Fault or Mathematics.

### Tips

- Tags are matched all together: python plus pandas returns questions tagged with both.
- Sort by Newest and set Asked from to yesterday's date for a daily feed of new questions.
- Without an app key a search goes up to 2,500 questions per window; with Recent activity, Newest or Most votes the Actor starts a new window and keeps going.
- For runs of many thousands of questions, or several runs a day, add your own free Stack Exchange app key.
- To credit the authors as CC BY-SA requires, keep each question's link and contentLicense with any text you reuse.

### FAQ

#### Is it legal to scrape Stack Overflow?

Stack Overflow Scraper – Questions & Answers API collects only data that Stack Overflow shows publicly to every visitor, and it leaves out personal data such as private profiles and contact details. Our Actors are ethical and do not extract private user data. Results could still contain personal data in titles or descriptions written by uploaders. Personal data is protected by the GDPR in the European Union and by other regulations around the world. You should not scrape personal data unless you have a legitimate reason to do so. If you're unsure whether your reason is legitimate, consult your lawyers. You are responsible for how you use the data.

#### Can I use it through an API?

Yes. Every Apify Actor has an API: start runs, pass input and read results over HTTP, or use the JavaScript and Python clients. See the **API** tab on the Actor page for ready-made examples.

#### Can I schedule runs and connect other apps?

Yes. Use Apify **Schedules** to run Stack Overflow Scraper – Questions & Answers API every hour, day or week, and integrations (Make, Zapier, Google Sheets, webhooks and more) to send the results where you need them.

#### Why did I get fewer results than expected?

The run stops at **Max items** or at the run's maximum cost, whichever comes first. Stack Overflow may also return fewer results for rare search terms. Duplicates across search terms are saved once. Check the run's `RUN_SUMMARY` record in the key-value store for the inputs that returned nothing.

#### What if it stops working?

Sites change. We run a daily check of our own and fix breakages quickly. If something looks wrong, open an issue in the **Issues** tab with the run link and we'll look at it.

#### Which sites can I search?

Any public Stack Exchange site: Stack Overflow, Super User, Server Fault, Ask Ubuntu, Mathematics, and about 180 more. Enter the site's short name (superuser) or its address (math.stackexchange.com).

#### Do I need an app key?

No. Without one, the Stack Exchange API allows 300 requests a day per IP address, and each request gets up to 100 questions. The servers this Actor runs on are shared with other users, so for large or frequent runs add your own free key from stackapps.com.

#### Can I reuse the questions?

Stack Exchange content is licensed CC BY-SA: credit the author with a link to the question and share changes under the same license. Stack Exchange's API terms do not allow using the content as a training corpus for generative AI models.

#### Are answers included?

Each question has its answer count, whether it is answered and the accepted answer's id. The answer texts are not included.

### Not included

No personal data: no asker or editor names, user ids, profiles, reputation or avatars, and no comments. Answer texts are not included. Using the data to train generative AI models is not allowed by Stack Exchange's API terms.

### More Actors from us

- [AliExpress Search Scraper – Products & Prices](https://apify.com/unnoted/aliexpress-product-search)
- [BBB Scraper – Business Ratings & Accreditation](https://apify.com/unnoted/bbb-business-search)
- [Bilibili Scraper – Video Search & Stats API](https://apify.com/unnoted/bilibili-video-scraper)
- [Bumeran Jobs Scraper – LATAM Job Listings](https://apify.com/unnoted/bumeran-job-listings)
- [Foundit Jobs Scraper – India Job Listings API](https://apify.com/unnoted/foundit-job-listings)
- [Google Jobs Scraper – Job Listings API](https://apify.com/unnoted/google-jobs-listings)
- [Google Play Reviews Scraper – App Reviews API](https://apify.com/unnoted/google-play-reviews-scraper)
- [Google Trends Scraper – Interest & Related Queries](https://apify.com/unnoted/google-trends-data)
- [Idealo Scraper – Price Comparison Data](https://apify.com/unnoted/idealo-price-search)
- [Kleinanzeigen Scraper – Listings & Prices](https://apify.com/unnoted/kleinanzeigen-listings-scraper)
- [Mercari Japan Scraper – Listings & Prices API](https://apify.com/unnoted/mercari-japan-search)
- [Resident Advisor Scraper – RA Event Listings](https://apify.com/unnoted/resident-advisor-events)
- [Sainsbury's Scraper – UK Grocery Prices](https://apify.com/unnoted/sainsburys-grocery-search)
- [Tokopedia Scraper – Product Search & Prices](https://apify.com/unnoted/tokopedia-product-search)
- [Workday Jobs Scraper – Any Careers Site](https://apify.com/unnoted/workday-jobs-scraper)
- [Yandex Maps Scraper – Places & Business Data](https://apify.com/unnoted/yandex-maps-places)

# Actor input Schema

## `query` (type: `string`):

Words to search for in question titles and bodies, e.g. python asyncio or "null pointer". Empty means every question (narrowed by tags and dates).

## `tags` (type: `array`):

Only questions carrying all of these tags, e.g. python and pandas. Empty means any tags.

## `site` (type: `string`):

Which Stack Exchange site to search: stackoverflow, superuser, serverfault, askubuntu, math, or any site's address such as math.stackexchange.com.

## `sort` (type: `string`):

Order of the results. "Best match" stops at 2,500 questions without an API key; the other orders can go past it.

## `acceptedAnswer` (type: `string`):

Filter by whether the asker accepted an answer.

## `dateFrom` (type: `string`):

Only questions asked on or after this date (YYYY-MM-DD, e.g. 2025-01-01). Empty means no lower bound.

## `dateTo` (type: `string`):

Only questions asked on or before this date (YYYY-MM-DD). Empty means up to today.

## `apiKey` (type: `string`):

Your own free Stack Exchange app key (register an app at stackapps.com). Without one, the API allows 300 requests a day per IP address, which other users of the same servers share; a key raises it to 10,000 a day.

## `maxItems` (type: `integer`):

Maximum number of questions in total. You pay only for questions saved.

## Actor input object example

```json
{
  "query": "python",
  "site": "stackoverflow",
  "sort": "activity",
  "acceptedAnswer": "any",
  "maxItems": 100
}
```

# Actor output Schema

## `results` (type: `string`):

One item per question.

## `runSummary` (type: `string`):

Items saved, inputs done, and how complete each field was.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "python",
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("unnoted/stackoverflow-questions").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "python",
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("unnoted/stackoverflow-questions").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "python",
  "maxItems": 100
}' |
apify call unnoted/stackoverflow-questions --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,unnoted/stackoverflow-questions"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/35taFWtqZtoNO3xby/builds/cRuBFrhUQCQX2cqYw/openapi.json
