# Stack Overflow Scraper - Questions, Scores & Tags (`eliai/stack-overflow-scraper`) Actor

Search Stack Overflow or any Stack Exchange site and get one row per question: score, answer count, views, tags, author reputation and ISO dates. Tag filters, bulk searches, no API key needed. $0.005 per question; empty searches are free.

- **URL**: https://apify.com/eliai/stack-overflow-scraper.md
- **Developed by:** [Broke to Built](https://apify.com/eliai) (community)
- **Categories:** Developer tools, Automation, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 questions scrapeds

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Stack Overflow Scraper — Questions, Scores & Tags

Search **Stack Overflow** — or any **Stack Exchange** site — and get **one row per question**:
score, answer count, views, tags, author and reputation, accepted-answer flag, and ISO dates.

No API key required. **$0.005 per question** — a search that matches nothing is recorded and
**not charged**.

### Input

```json
{ "query": "async await", "maxQuestions": 25, "sort": "votes" }
```

By tag, on another site, with a score floor:

```json
{
  "tagged": "python;pandas",
  "site": "stackoverflow",
  "minScore": 50,
  "answeredOnly": true,
  "maxQuestions": 100
}
```

| Field | Type | Notes |
|---|---|---|
| `query` | string | Free-text search over titles and bodies. |
| `queries` | string\[] | Up to 20 searches per run. |
| `tagged` | string | Semicolon-separated tags, e.g. `python;pandas`. Works with or without a query. |
| `site` | string | `stackoverflow`, `serverfault`, `superuser`, `askubuntu`, `math`, `unix`, `dba`… |
| `sort` | enum | `votes`, `activity`, `creation`, `relevance`. |
| `maxQuestions` | integer | 1–100 per search. **You are charged per question returned.** |
| `answeredOnly` | boolean | Only questions with an accepted answer. |
| `minScore` | integer | Skip questions below this score. |
| `apiKey` | string | Optional — see Limits. |

### Output

```json
{
  "ok": true,
  "questionId": 37576685,
  "title": "Using async/await with a forEach loop",
  "link": "https://stackoverflow.com/questions/37576685/...",
  "score": 3353,
  "answerCount": 35,
  "viewCount": 2481265,
  "isAnswered": true,
  "hasAcceptedAnswer": true,
  "tags": ["javascript", "node.js", "promise", "async-await"],
  "author": "Saad",
  "authorReputation": 52193,
  "createdAt": "2016-06-01T18:55:58.000Z",
  "lastActivityAt": "2026-08-14T09:12:40.000Z",
  "licence": "CC BY-SA 4.0"
}
```

### What it gets right

- **Dates are ISO-8601.** Stack Exchange returns epoch seconds; a bare `1464807358` is not a date
  and will not sort in a spreadsheet.
- **One row per question**, so filtering, sorting and importing all just work.
- **`site` reaches the whole network** — Server Fault, Super User, Ask Ubuntu, Math, Unix and the
  rest, not just Stack Overflow.
- **API errors are surfaced, not swallowed.** Stack Exchange reports a bad site or a bad parameter
  in a `200`-shaped body with an `error_message`; that message reaches you instead of an empty run.
- **Numbers are numbers and flags are booleans** — `score`, `answerCount`, `viewCount`,
  `isAnswered`, `hasAcceptedAnswer`.

### Pricing

**$0.005 per question returned.** No start fee. A search matching nothing produces a
`questionCount: 0` record and **is not charged**, so probing a narrow tag is free.

### Limits

⚠️ **The keyless API allows 300 requests per day per IP**, and Apify runs from shared addresses, so
that pool is not yours alone. This Actor reads the remaining quota from every response, reports it
as `quotaRemaining`, and when it runs out it writes an honest **uncharged** record rather than a
run of empty results.

**Pass your own free key via `apiKey` to raise the limit to 10,000/day** — register at
[stackapps.com](https://stackapps.com/apps/oauth/register). It takes a minute and costs nothing.

- 20 searches per run, up to 100 questions each.
- Returns question metadata, not answer bodies.
- Content is CC BY-SA; the `licence` field carries the exact version per question.

### FAQ

**Do I need an API key?** No — but supply one if you are running large or frequent jobs.

**Can I get the answers themselves?** Not in this Actor; it returns question metadata including
answer counts and the accepted-answer flag.

**Which sites work?** Any Stack Exchange site — pass its API slug in `site`.

### Changelog

- **0.1 (2026-09-10)** — first release. One row per question, whole Stack Exchange network, tag and
  score filters, bulk searches, quota surfaced with optional caller key.

# Actor input Schema

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

Free-text search across question titles and bodies.

## `queries` (type: `array`):

Several searches in one run. Up to 20.

## `tagged` (type: `string`):

Semicolon-separated tags, e.g. python;pandas. Can be used with or without a search.

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

stackoverflow, serverfault, superuser, askubuntu, math, unix, dba — any Stack Exchange site.

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

Order results by question score, most recent activity, creation date, or Stack Exchange relevance.

## `maxQuestions` (type: `integer`):

You are charged per question returned.

## `answeredOnly` (type: `boolean`):

Return only questions that have an accepted answer.

## `minScore` (type: `integer`):

Skip questions scoring below this number. Leave empty for no floor.

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

Without a key the API allows 300 requests/day per IP, shared across Apify. A free key raises it to 10,000/day. Register at stackapps.com.

## Actor input object example

```json
{
  "query": "async await",
  "queries": [],
  "site": "stackoverflow",
  "sort": "votes",
  "maxQuestions": 25,
  "answeredOnly": false
}
```

# Actor output Schema

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

Every item this run produced, as JSON.

## `resultsCsv` (type: `string`):

The same items as a spreadsheet-ready CSV.

# 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": "async await",
    "queries": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("eliai/stack-overflow-scraper").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": "async await",
    "queries": [],
}

# Run the Actor and wait for it to finish
run = client.actor("eliai/stack-overflow-scraper").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": "async await",
  "queries": []
}' |
apify call eliai/stack-overflow-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eliai/stack-overflow-scraper"
        }
    }
}
```

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/PXI7criGckleyTuHK/builds/Ey7TCleaavT8PYLnX/openapi.json
