# Stack Overflow Question Search - Developer Q\&A Data (`northglasslabs/stackoverflow-search`) Actor

Search Stack Overflow questions using the free Stack Exchange API. Returns question titles, scores, view counts, answer counts, tags, owner reputation, and links. No authentication required.

- **URL**: https://apify.com/northglasslabs/stackoverflow-search.md
- **Developed by:** [North Glass Labs](https://apify.com/northglasslabs) (community)
- **Categories:** Social media, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 results

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/platform/actors/running/actors-in-store#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 Question Search — Developer Q\&A Data Export

Search and extract **Stack Overflow** questions with titles, scores, view counts, answer counts, tags, owner reputation, and timestamps via the Stack Exchange API. Export structured JSON without launching a browser.

### What it does

The Stack Overflow Question Search actor searches questions using the **Stack Exchange API** (`api.stackexchange.com/2.3/search/advanced`). It communicates directly with the public REST API rather than rendering web pages.

Each question returned includes an HTML-decoded title, direct URL, score, view count, answer count, answered status, tags, the asker's display name and reputation, plus creation and last-activity timestamps in ISO-8601 format. Results always use the API's descending relevance ordering.

This makes the actor ideal for developer relations, competitive intelligence, technical content research, and lead generation — you can discover which questions are getting traction in your technology stack, identify active community members by reputation, and build datasets of developer pain points for product planning or content marketing.

### Input parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `searchQuery` | string | ✅ Yes | — | The text to search for in Stack Overflow questions. Must not be empty. |
| `maxResults` | integer | No | `50` | Maximum number of questions to retrieve (1–100). |
| `tagged` | string | No | — | Optional tag to filter questions (e.g. `python`, `javascript`, `docker`). Only questions with this tag are returned. |

### Output fields

Each result item pushed to the dataset contains:

| Field | Type | Description |
|-------|------|-------------|
| `title` | string | HTML-decoded question title |
| `questionUrl` | string | Direct URL to the question on stackoverflow.com |
| `score` | integer | Question score (net upvotes) |
| `viewCount` | integer | Number of times the question has been viewed |
| `answerCount` | integer | Number of answers posted on the question |
| `isAnswered` | boolean | Whether the question has an accepted or upvoted answer |
| `tags` | array of strings | Technology tags on the question (e.g. `["python", "asyncio"]`) |
| `ownerName` | string | Display name of the user who asked the question |
| `ownerReputation` | integer | Reputation score of the question asker at time of query |
| `createdAt` | string | ISO-8601 timestamp of when the question was posted |
| `lastActivityDate` | string | ISO-8601 timestamp of the most recent activity on the question |

### Use cases

- **Developer relations** — find unanswered questions about your product or API to respond to proactively
- **Content marketing** — identify trending questions in your technology niche to write blog posts, tutorials, or documentation that address real developer needs
- **Lead generation** — discover active, high-reputation developers by their questions for recruiting or community outreach
- **Competitive intelligence** — track question volume and sentiment around competing technologies or frameworks
- **Product research** — collect common developer pain points and recurring questions to inform your product roadmap
- **Data collection** — build datasets of developer Q\&A for NLP, trend analysis, or knowledge base construction

### How it works

The actor calls `https://api.stackexchange.com/2.3/search/advanced` with `q`, optional `tagged`, `pagesize`, `site=stackoverflow`, `sort=relevance`, and `order=desc`. It HTML-decodes titles and converts Unix timestamps to ISO-8601 strings before pushing the eleven documented fields to the default dataset. A valid empty API response produces no dataset items. HTTP, network, malformed-response, and JSON errors fail the run. If the API returns a `backoff` value, the actor logs a warning; it does not sleep or retry automatically.

### Example usage

#### Example input

```json
{
    "searchQuery": "async await error handling",
    "maxResults": 5,
    "tagged": "python"
}
```

#### Example output

```json
{
    "title": "How to properly handle errors with async/await in Python",
    "questionUrl": "https://stackoverflow.com/questions/78912345/how-to-properly-handle-errors-with-async-await",
    "score": 42,
    "viewCount": 15823,
    "answerCount": 3,
    "isAnswered": true,
    "tags": ["python", "asyncio", "error-handling"],
    "ownerName": "dev_user123",
    "ownerReputation": 5420,
    "createdAt": "2025-06-10T14:30:00+00:00",
    "lastActivityDate": "2025-07-01T09:15:00+00:00"
}
```

### Pricing

This actor uses the **pay-per-event (PPE)** pricing model on Apify. You are charged a small fee for each successful actor run. Because the Stack Overflow Search uses a free public API and does not launch a browser, runs are extremely fast and cost-efficient — typically completing in under 5 seconds. Check the actor's Apify Store page for the current per-run pricing. Apify's free tier includes monthly platform credits that are sufficient for hundreds of searches.

### Tips

- **Use the `tagged` filter to narrow results** — combining a search query with a tag like `python` or `react` ensures you get questions specific to that technology, not generic matches.
- **Results use relevance ordering** — sorting is fixed to `relevance` in descending order and is not an input option.
- **Respect API backoff requests** — the actor logs `backoff` values but does not automatically delay or retry the request.

# Actor input Schema

## `searchQuery` (type: `string`):

The text to search for in Stack Overflow questions.

## `maxResults` (type: `integer`):

Maximum number of questions to retrieve (1-100).

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

Optional tag to filter questions (e.g. 'python', 'javascript', 'docker').

## Actor input object example

```json
{
  "searchQuery": "python async",
  "maxResults": 50
}
```

# Actor output Schema

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

Questions stored in the default dataset

# 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 = {
    "searchQuery": "python async"
};

// Run the Actor and wait for it to finish
const run = await client.actor("northglasslabs/stackoverflow-search").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 = { "searchQuery": "python async" }

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

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

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

```

## CLI example

```bash
echo '{
  "searchQuery": "python async"
}' |
apify call northglasslabs/stackoverflow-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=northglasslabs/stackoverflow-search",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/bUCtlu9sIhyfGhecR/builds/WDzT0nwGIA1dmgKPB/openapi.json
