# Stack Exchange API
> Search Stack Overflow and the Stack Exchange network — questions by relevance with scores, answer counts and tags, full question details, and user profiles with reputation, badges and location. Ideal for developer tools, tech-trend monitoring, Q&A aggregation and reputation lookups.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/stackexchange-api/..."
```

## Pricing
- **Free** (Free) — 4,000 calls/Mo, 2 req/s
- **Basic** ($8/Mo) — 60,000 calls/Mo, 8 req/s
- **Pro** ($24/Mo) — 300,000 calls/Mo, 20 req/s
- **Mega** ($99/Mo) — 1,500,000 calls/Mo, 50 req/s

## Endpoints

### Stack Exchange

#### `GET /v1/question` — Question by id

**Parameters:**
- `id` (query, required, string) — Numeric question id Example: `11227809`
- `site` (query, optional, string) — Site slug Example: `stackoverflow`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/stackexchange-api/v1/question?id=11227809&site=stackoverflow"
```

**Response:**
```json
{
    "data": {
        "id": 11227809,
        "link": "https://stackoverflow.com/questions/11227809/why-is-conditional-processing-of-a-sorted-array-faster-than-of-an-unsorted-array",
        "tags": [
            "java",
            "c++",
            "performance",
            "cpu-architecture",
            "branch-prediction"
        ],
        "owner": "GManNickG",
        "score": 27530,
        "title": "Why is conditional processing of a sorted array faster than of an unsorted array?",
        "created_at": "2012-06-27T13:51:36.000Z",
        "view_count": 1985304,
        "is_answered": true,
        "answer_count": 26,
        "last_activity_at": "2026-04-08T05:35:32.000Z",
        "accepted_answer_id": 11227902
    },
    "meta": {
        "timestamp": "2026-05-30T06:33:29.921Z",
        "request_id": "17f03b07-c69f-4aed-8065-159a7ff98e4d"
    },
    "status": "ok",
    "message": "Question retrieved",
    "success": true
}
```

#### `GET /v1/search` — Search questions

**Parameters:**
- `q` (query, required, string) — Search term Example: `async await`
- `site` (query, optional, string) — Site slug Example: `stackoverflow`
- `limit` (query, optional, string) — Max 1-30 Example: `15`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/stackexchange-api/v1/search?q=async+await&site=stackoverflow&limit=15"
```

**Response:**
```json
{
    "data": {
        "site": "stackoverflow",
        "count": 15,
        "query": "async await",
        "results": [
            {
                "id": 37576685,
                "link": "https://stackoverflow.com/questions/37576685/using-async-await-with-a-foreach-loop",
                "tags": [
                    "javascript",
                    "node.js",
                    "promise",
                    "async-await",
                    "ecmascript-2017"
                ],
                "owner": "Saad",
                "score": 3351,
                "title": "Using async/await with a forEach loop",
                "created_at": "2016-06-01T18:55:58.000Z",
                "view_count": 2476066,
                "is_answered": true,
                "answer_count": 35,
                "last_activity_at": "2025-01-28T01:27:13.000Z",
                "accepted_answer_id": 37576787
            },
            {
                "id": 14455293,
                "link": "https://stackoverflow.com/questions/14455293/how-and-when-to-use-async-and-await",
                "tags": [
                    "c#",
                    ".net",
                    "asynchronous",
                    "async-await"
                ],
                "owner": "Dan Dinu",
                "score": 1429,
                "title": "How and when to use ‘async’ and ‘await’",
                "created_at": "2013-01-22T09:29:58.000Z",
                "view_count": 1314415,
                "
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/user` — User profile by id

**Parameters:**
- `id` (query, required, string) — Numeric user id Example: `22656`
- `site` (query, optional, string) — Site slug Example: `stackoverflow`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/stackexchange-api/v1/user?id=22656&site=stackoverflow"
```

**Response:**
```json
{
    "data": {
        "id": 22656,
        "link": "https://stackoverflow.com/users/22656/jon-skeet",
        "name": "Jon Skeet",
        "badges": {
            "gold": 895,
            "bronze": 9357,
            "silver": 9318
        },
        "location": "Reading, United Kingdom",
        "user_type": "registered",
        "created_at": "2008-09-26T12:05:05.000Z",
        "reputation": 1527510,
        "profile_image": "https://www.gravatar.com/avatar/6d8ebb117e8d83d74ea95fbdd0f87e13?s=256&d=identicon&r=PG",
        "last_access_at": "2026-05-29T19:26:28.000Z"
    },
    "meta": {
        "timestamp": "2026-05-30T06:33:31.171Z",
        "request_id": "71c132cc-8cd1-4db2-b206-cf8d80cff462"
    },
    "status": "ok",
    "message": "User retrieved",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/stackexchange-api
OpenAPI spec: https://www.oanor.com/api/stackexchange-api/openapi.json
