# Q\&A Knowledge Extractor (Stack Exchange) (`datahoeven/qa-knowledge-extractor`) Actor

Extracts RAG-ready Q\&A pairs from the Stack Exchange network via the official API. Returns coupled question+answer records with full attribution, license metadata, and incremental diff support for growing datasets.

- **URL**: https://apify.com/datahoeven/qa-knowledge-extractor.md
- **Developed by:** [Daan Hoeven](https://apify.com/datahoeven) (community)
- **Categories:** AI, Developer tools, Agents
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 q\&a pair extracteds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Q&A Knowledge Extractor (Stack Exchange)

**Extract clean, production-ready Q&A datasets from Stack Overflow and the entire Stack Exchange network for RAG, fine-tuning, and AI agent development.**

This Apify Actor fetches question-answer pairs from the Stack Exchange API and delivers them as **RAG-ready JSON records** with full licensing attribution, quality metadata, and incremental diff support. Each pair is coupled (question ↔ best/accepted answer), normalized for immediate use, and includes code examples intact.

Perfect for building **retrieval-augmented generation (RAG) systems**, **fine-tuning language models**, **training AI agents**, and **growing proprietary knowledge bases** without maintenance overhead.

---

### What You Get

- **Coupled Q&A pairs**: Each record contains one question and its best (accepted or highest-scoring) answer, ready to use as a training example or RAG context window.
- **Code-safe formatting**: Markdown with fenced code blocks preserved intact — no corrupted Python snippets or mangled SQL.
- **Full attribution**: Every record includes author names, profile URLs, and exact license version per content. Comply with CC BY-SA licensing automatically.
- **Incremental extraction**: Run the Actor multiple times. Only new or updated Q&A pairs are fetched and charged — grow your dataset without re-processing old content.
- **RAG chunking** (optional): Automatically split answer text into overlapping chunks on natural boundaries (paragraphs, code blocks) for vector embedding and retrieval.
- **Quality filters**: Minimum score thresholds, tag filtering, and accepted-answer-only mode eliminate low-quality noise.

---

### Use Cases

#### 1. **Retrieval-Augmented Generation (RAG)**
Build knowledge-grounded chatbots and search systems that cite real Stack Overflow solutions. The Actor provides clean, pre-chunked context windows ready to embed.

````

User query: "How to parse JSON in Python?"
↓ RAG retrieval
→ Returns top-scoring Stack Overflow answers + metadata
→ LLM generates response citing sources

```

#### 2. **Fine-tuning Language Models**
Create domain-specific instruction datasets by filtering on tags (Python, React, databases) and score thresholds. Each Q&A pair becomes a training example.

**Example**: Fine-tune a model on production Docker best practices by filtering `tag: "docker"` and `minQuestionScore: 10`.

#### 3. **AI Agents & Multi-Tool Learning**
Equip agents with task-specific knowledge bases. The Actor outputs clean, parseable records agents can query during reasoning.

```

Agent: "I need to debug a Flask authentication issue."
→ Queries the local Q\&A dataset
→ Returns 5 relevant Stack Overflow answers
→ Incorporates into reasoning chain

````

#### 4. **Internal Knowledge Base**
Populate a company knowledge base with Stack Overflow solutions relevant to your tech stack. Incremental mode keeps it fresh without re-scraping.

#### 5. **Academic Research**
Extract Q&A datasets for studying software engineering practices, API design patterns, or how developers solve real problems at scale.

---

### Key Features

| Feature | Details |
|---------|---------|
| **Data source** | Stack Exchange API v2.3 (official, stable) |
| **Supported sites** | Stack Overflow, Server Fault, Super User, Ask Ubuntu, and 200+ other Stack Exchange sites |
| **Q&A coupling** | Automatic pairing of questions with best/accepted answers |
| **Incremental mode** | Store a high-water-mark; next run only fetches new/updated pairs — save money & time |
| **Filtering** | Tags (AND), score thresholds, date ranges, free-text search, accepted-answer-only |
| **Output schema** | Structured JSON with question metadata, answer body, licensing, attribution, optional chunks |
| **Code handling** | Markdown with fenced code blocks intact — never corrupts code samples |
| **License compliance** | CC BY-SA attribution built into every record; seamless license version detection |
| **RAG-ready** | Optional chunking on paragraph/code-block boundaries; overlap support for context preservation |
| **Pricing** | Pay-per-result: $0.005 per new/updated Q&A pair; incremental mode means you only pay once |
| **Error handling** | Graceful quota management, schema-drift detection, canary sanity checks |

---

### Example: Input & Output

#### Input Configuration
```json
{
  "site": "stackoverflow",
  "tags": ["python", "pandas"],
  "query": "how to merge dataframes",
  "minQuestionScore": 5,
  "minAnswerScore": 10,
  "acceptedOnly": true,
  "incremental": true,
  "enableChunking": false,
  "maxItems": 100
}
````

#### Output Record (JSON)

````json
{
  "_schemaVersion": 1,
  "site": "stackoverflow",
  "questionId": 11227809,
  "question": {
    "title": "Why is processing a sorted array faster than an unsorted array?",
    "bodyMarkdown": "A... branch misprediction explanation... ```code block``` preserved.",
    "tags": ["c++", "performance", "cpu-cache"],
    "score": 27000,
    "viewCount": 1900000,
    "createdAt": "2011-06-27T13:51:36Z",
    "lastActivityAt": "2024-02-10T08:00:00Z",
    "url": "https://stackoverflow.com/q/11227809",
    "author": {
      "name": "GManNickG",
      "url": "https://stackoverflow.com/users/123456/gmannickG"
    }
  },
  "answer": {
    "answerId": 11227902,
    "bodyMarkdown": "Excellent explanation of cache lines and branch predictors... ```code``` intact.",
    "score": 35000,
    "isAccepted": true,
    "createdAt": "2011-06-27T13:56:42Z",
    "url": "https://stackoverflow.com/a/11227902",
    "author": {
      "name": "Mysticial",
      "url": "https://stackoverflow.com/users/555555/mysticial"
    }
  },
  "license": {
    "name": "CC BY-SA 4.0",
    "url": "https://creativecommons.org/licenses/by-sa/4.0/"
  },
  "attribution": "Question by GManNickG (https://stackoverflow.com/users/123456/gmannickG) and answer by Mysticial (https://stackoverflow.com/users/555555/mysticial) on Stack Overflow, licensed under CC BY-SA 4.0.",
  "scrapedAt": "2024-06-07T10:00:00Z"
}
````

***

### Licensing & Attribution

**This Actor respects CC BY-SA licensing.** Every output record includes:

1. **License metadata** (`license` object) with the correct CC version (4.0 for content created after May 2, 2018; 3.0 for older content).
2. **Attribution string** (`attribution` field) listing question author, answer author, Stack Overflow URL, and license version.

#### Your Responsibilities

- **Include the attribution** in any dataset you publish or distribute.
- **Maintain the CC BY-SA** license on the Q\&A content when sharing your output dataset. (Your model, RAG application, or analysis doesn't have to be CC BY-SA — only the underlying Q\&A text does.)
- **Do not use `nofollow`** or obfuscate links to the original questions.

#### Stack Overflow & Stack Exchange Terms

- Commercial use via the API is allowed per the [Stack Exchange API Terms of Service](https://api.stackexchange.com/docs) and [Attribution Required blog post](https://stackoverflow.blog/2009/06/25/attribution-required/).
- The Actor respects API rate limits and quota: ~300 requests/day per IP without an API key, ~10,000/day with a free key (register at [stackapps.com](https://stackapps.com)).
- See the [licensing discussion](#open-questions--decisions) in the PRD for full details.

***

### Getting Started

#### 1. **Configure Your Input**

Choose your data source and filters:

| Parameter | Purpose | Example |
|-----------|---------|---------|
| `site` | Stack Exchange site to query | `"stackoverflow"`, `"serverfault"` |
| `tags` | Filter by tags (AND) | `["python", "pandas"]` |
| `query` | Free-text search | `"memory leak"` |
| `minQuestionScore` | Minimum question score | `5` |
| `minAnswerScore` | Minimum answer score | `10` |
| `acceptedOnly` | Only paired with accepted answers | `true` |
| `incremental` | Store high-water-mark for delta runs | `true` |
| `enableChunking` | Split answers into RAG chunks | `false` (set `true` if embedding) |
| `chunkSize` | Target chunk size (chars) | `1200` |
| `maxItems` | Hard limit on results | `0` (no limit) |
| `apiKey` | Optional Stack Exchange app key | — |

#### 2. **Run the Actor**

Use the Apify Console or CLI:

```bash
apify run
```

Or via the Apify platform: click **"Start actor"** in the store listing.

#### 3. **Retrieve Results**

The Actor pushes Q\&A pairs to the Apify Dataset. Download as JSON, CSV, or access via API:

```bash
apify dataset get-items
```

#### 4. **Use in Your Application**

##### RAG Example (pseudo-code)

```python
## Load the dataset
qapairs = load_dataset('apify_results.json')

## Embed and index for retrieval
for pair in qapairs:
  ## Chunk the answer if needed
  chunks = pair.get('chunks') or [pair['answer']['bodyMarkdown']]
  for chunk in chunks:
    embedding = embedding_model.encode(chunk)
    index.add(embedding, metadata={'pair_id': pair['questionId']})

## At query time
user_query = "How to optimize pandas merge?"
query_embedding = embedding_model.encode(user_query)
retrieved = index.search(query_embedding, top_k=5)
## Pass retrieved to LLM for RAG
```

***

### FAQ

#### Q: How much does it cost?

**A:** $0.005 per new or updated Q\&A pair. With incremental mode enabled (default), subsequent runs only charge for new pairs — a dataset of 10,000 pairs costs ~$50 to build once, then additional updates cost only for the new pairs added.

#### Q: Can I use this data commercially?

**A:** Yes. The Stack Exchange content is CC BY-SA licensed; you may use it commercially in closed or open applications, provided you include attribution (which the Actor does automatically for each record).

#### Q: What's the incremental mode?

**A:** The Actor stores the latest activity date from each run. Next run fetches only Q\&A pairs updated after that date, deduplicates them, and charges only for new/changed pairs. Grow your dataset without re-processing.

#### Q: Can I use multiple Stack Exchange sites in one run?

**A:** Not yet — one site per run. Use multiple Actor runs with different `site` parameters to multi-source (or contact support for multi-site feature request).

#### Q: How often does the Stack Exchange API update?

**A:** Continuously. Questions and answers are updated in real-time; the Actor can refresh your dataset as often as you want (respecting the rate-limit quota).

#### Q: Do code blocks stay intact?

**A:** Yes. The Actor fetches `body_markdown` (not HTML), preserving fenced code blocks (` ```python ``` `) exactly as Stack Overflow displays them. HTML entities are decoded for readability.

#### Q: What if there's no accepted answer?

**A:** If `acceptedOnly=false`, the Actor pairs the question with its highest-scoring answer instead. If `acceptedOnly=true` (default), questions without accepted answers are skipped.

#### Q: Can I chunk the Q\&A text for embeddings?

**A:** Yes. Enable `enableChunking: true` and set `chunkSize` (default 1200 chars). The Actor splits text on paragraph and code-block boundaries, never mid-block. Each record gets a `chunks` array ready to embed.

#### Q: What if the Stack Exchange API breaks?

**A:** The Actor includes a canary check (validates against a known-good answer) and schema-drift detection. If something changes, you'll see a `[Canary] FAILED` warning in logs — not a silent failure.

***

### Technical Details

- **Language:** Node.js 20+ (TypeScript)
- **HTTP client:** `got-scraping` with automatic gzip decompression, retries, and quota awareness
- **Tests:** 138+ unit + integration tests via Vitest; all fixtures use real Stack Exchange API responses
- **Error handling:** Graceful quota exhaustion, schema-drift warnings, per-record isolation
- **Build:** Multi-stage Docker (builder installs all deps, runtime installs prod deps only)

***

### Support & Issues

- **Stack Exchange API docs:** https://api.stackexchange.com/docs
- **Register a free API key:** https://stackapps.com/apps/oauth/register
- **Attribution requirements:** https://stackoverflow.blog/2009/06/25/attribution-required/
- **CC BY-SA 4.0 license:** https://creativecommons.org/licenses/by-sa/4.0/

For Actor-specific issues or feature requests, open an issue on the project GitHub or contact the maintainer.

***

### Summary

Use **Q\&A Knowledge Extractor** to build better RAG systems, fine-tune smarter models, and empower your AI agents with real, production-proven solutions. Clean data, transparent pricing, automatic licensing — from Stack Overflow to your application in minutes.

**Start extracting now.** 🚀

# Actor input Schema

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

The Stack Exchange network site to query. Use the site's subdomain (e.g. 'stackoverflow', 'serverfault', 'superuser', 'askubuntu'). Full list at stackexchange.com/sites.

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

Only return Q\&A pairs tagged with ALL of the specified tags. Leave empty to skip tag filtering.

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

Free-text search term (passed as 'q' to /search/advanced). Can be combined with tags.

## `acceptedOnly` (type: `boolean`):

When enabled, only questions with an accepted answer are returned. When disabled, questions without an accepted answer get their highest-scoring answer instead.

## `minQuestionScore` (type: `integer`):

Only return Q\&A pairs where the question has at least this score (upvotes minus downvotes). Useful for filtering out low-quality content.

## `minAnswerScore` (type: `integer`):

Only return Q\&A pairs where the linked answer has at least this score. Applied after fetching; answers below this threshold are excluded.

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

Sort questions by votes (highest-scoring first), activity (most recently active first), or creation (newest first). Note: incremental mode always overrides this to 'activity'.

## `fromDate` (type: `string`):

Only return Q\&A pairs with activity on or after this date (ISO 8601, e.g. '2024-01-01'). Ignored when 'incremental' is enabled — the stored high-water-mark is used instead.

## `incremental` (type: `boolean`):

When enabled, each run stores a high-water-mark (the latest activity date seen). Subsequent runs only fetch Q\&A pairs updated after that mark, so you only pay for new or changed content.

## `enableChunking` (type: `boolean`):

When enabled, the combined Q\&A text is split into overlapping chunks on natural boundaries (paragraphs, code blocks). Each record gets a 'chunks' array ready to embed. Code blocks are never split mid-block.

## `chunkSize` (type: `integer`):

Target chunk size in characters when RAG chunking is enabled. Actual chunks may be slightly larger to avoid splitting code blocks.

## `chunkOverlap` (type: `integer`):

Number of characters to overlap between consecutive chunks when RAG chunking is enabled. Helps preserve context across chunk boundaries.

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

Hard limit on the number of Q\&A pairs returned per run. Set to 0 for no limit. Use this to control costs on large queries.

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

Optional Stack Exchange application key. Without a key the daily quota is ~300 requests/IP; with a free key it rises to ~10,000/day. Register at stackapps.com.

## `proxyConfiguration` (type: `object`):

Apify proxy settings. Datacenter proxies are sufficient for the Stack Exchange API.

## Actor input object example

```json
{
  "site": "stackoverflow",
  "tags": [
    "python",
    "pandas"
  ],
  "query": "how to merge two dataframes",
  "acceptedOnly": true,
  "minQuestionScore": 5,
  "minAnswerScore": 1,
  "sort": "votes",
  "fromDate": "2024-01-01",
  "incremental": true,
  "enableChunking": false,
  "chunkSize": 1200,
  "chunkOverlap": 100,
  "maxItems": 100,
  "apiKey": "your_app_key_here",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("datahoeven/qa-knowledge-extractor").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("datahoeven/qa-knowledge-extractor").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 '{}' |
apify call datahoeven/qa-knowledge-extractor --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Q&A Knowledge Extractor (Stack Exchange)",
        "description": "Extracts RAG-ready Q&A pairs from the Stack Exchange network via the official API. Returns coupled question+answer records with full attribution, license metadata, and incremental diff support for growing datasets.",
        "version": "0.1",
        "x-build-id": "qjJYchNvXCakUinM5"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/datahoeven~qa-knowledge-extractor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-datahoeven-qa-knowledge-extractor",
                "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/datahoeven~qa-knowledge-extractor/runs": {
            "post": {
                "operationId": "runs-sync-datahoeven-qa-knowledge-extractor",
                "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/datahoeven~qa-knowledge-extractor/run-sync": {
            "post": {
                "operationId": "run-sync-datahoeven-qa-knowledge-extractor",
                "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": {
                    "site": {
                        "title": "Stack Exchange site",
                        "type": "string",
                        "description": "The Stack Exchange network site to query. Use the site's subdomain (e.g. 'stackoverflow', 'serverfault', 'superuser', 'askubuntu'). Full list at stackexchange.com/sites.",
                        "default": "stackoverflow"
                    },
                    "tags": {
                        "title": "Tags (AND filter)",
                        "type": "array",
                        "description": "Only return Q&A pairs tagged with ALL of the specified tags. Leave empty to skip tag filtering.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "query": {
                        "title": "Search query",
                        "type": "string",
                        "description": "Free-text search term (passed as 'q' to /search/advanced). Can be combined with tags.",
                        "default": ""
                    },
                    "acceptedOnly": {
                        "title": "Accepted answers only",
                        "type": "boolean",
                        "description": "When enabled, only questions with an accepted answer are returned. When disabled, questions without an accepted answer get their highest-scoring answer instead.",
                        "default": true
                    },
                    "minQuestionScore": {
                        "title": "Minimum question score",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return Q&A pairs where the question has at least this score (upvotes minus downvotes). Useful for filtering out low-quality content.",
                        "default": 0
                    },
                    "minAnswerScore": {
                        "title": "Minimum answer score",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return Q&A pairs where the linked answer has at least this score. Applied after fetching; answers below this threshold are excluded.",
                        "default": 0
                    },
                    "sort": {
                        "title": "Sort order",
                        "enum": [
                            "votes",
                            "activity",
                            "creation"
                        ],
                        "type": "string",
                        "description": "Sort questions by votes (highest-scoring first), activity (most recently active first), or creation (newest first). Note: incremental mode always overrides this to 'activity'.",
                        "default": "votes"
                    },
                    "fromDate": {
                        "title": "From date (ISO 8601)",
                        "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
                        "type": "string",
                        "description": "Only return Q&A pairs with activity on or after this date (ISO 8601, e.g. '2024-01-01'). Ignored when 'incremental' is enabled — the stored high-water-mark is used instead.",
                        "default": ""
                    },
                    "incremental": {
                        "title": "Incremental mode",
                        "type": "boolean",
                        "description": "When enabled, each run stores a high-water-mark (the latest activity date seen). Subsequent runs only fetch Q&A pairs updated after that mark, so you only pay for new or changed content.",
                        "default": true
                    },
                    "enableChunking": {
                        "title": "Enable RAG chunking",
                        "type": "boolean",
                        "description": "When enabled, the combined Q&A text is split into overlapping chunks on natural boundaries (paragraphs, code blocks). Each record gets a 'chunks' array ready to embed. Code blocks are never split mid-block.",
                        "default": false
                    },
                    "chunkSize": {
                        "title": "Chunk size (characters)",
                        "minimum": 100,
                        "maximum": 8000,
                        "type": "integer",
                        "description": "Target chunk size in characters when RAG chunking is enabled. Actual chunks may be slightly larger to avoid splitting code blocks.",
                        "default": 1200
                    },
                    "chunkOverlap": {
                        "title": "Chunk overlap (characters)",
                        "minimum": 0,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Number of characters to overlap between consecutive chunks when RAG chunking is enabled. Helps preserve context across chunk boundaries.",
                        "default": 100
                    },
                    "maxItems": {
                        "title": "Max Q&A pairs",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Hard limit on the number of Q&A pairs returned per run. Set to 0 for no limit. Use this to control costs on large queries.",
                        "default": 0
                    },
                    "apiKey": {
                        "title": "Stack Exchange API key",
                        "type": "string",
                        "description": "Optional Stack Exchange application key. Without a key the daily quota is ~300 requests/IP; with a free key it rises to ~10,000/day. Register at stackapps.com."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Apify proxy settings. Datacenter proxies are sufficient for the Stack Exchange API.",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
