# Stack Overflow Search (`stackoverflow.search`)

Search questions on Stack Overflow or another Stack Exchange site: title, tags, score, answers, views and link.

- **Route:** `POST /v1/run/stackoverflow.search`
- **Price:** $0.0015 per request ($1.50 per 1,000) · `cost_usd` on every response
- **Source:** Stack Exchange API (`stackexchange`) · failover: no
- **Measured latency:** p50 233 ms · p95 233 ms · p99 233 ms (1 calls, 30d)
- **Heavy response:** no

## Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `query` | string | yes |  | Search words |
| `site` | string | no | "stackoverflow" | Stack Exchange site, e.g. stackoverflow, serverfault, superuser |
| `tag` | string | no |  | Only questions with this tag |
| `sort` | string | no | "relevance" | Sort order |
| `answered_only` | boolean | no | false | Only questions with at least one answer |
| `limit` | integer | no | 10 | Results to return |

## Output (`output` in the run envelope)

| Field | Meaning |
|---|---|
| `questions` | question_id, title, url, tags, score, answers, views, answered, asked_at. |
| `count` | Questions returned. |
| `license` | CC BY-SA attribution note. |

## Example

```bash
curl -s -X POST https://getallapis.com/v1/run/stackoverflow.search \
  -H "Authorization: Bearer $GETALLAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"asyncio gather vs wait","tag":"python","limit":5}'
```

```python
from getallapis_client import Client
client = Client()  # reads GETALLAPIS_API_KEY
result = client.run('stackoverflow.search', {'query': 'asyncio gather vs wait', 'tag': 'python', 'limit': 5})
print(result['cost_usd'], result['output'])
```

```bash
getallapis run stackoverflow.search '{"query":"asyncio gather vs wait","tag":"python","limit":5}'
```

Quote first (free, validates input): `POST /v1/quote/stackoverflow.search` with the same body.
