# Stack Overflow Question

Returns one Stack Overflow question by id: title, link, tags, score, counts, accepted answer id, closed reason, bounty, ISO 8601 dates, owner, HTML body, plain-text body and license. An unknown id answers 404 and is never charged. Costs 1 credit per successful request.

- **Documentation:** [https://scrappa.co/docs/stackoverflow-api/stackoverflow_question](https://scrappa.co/docs/stackoverflow-api/stackoverflow_question)
- **API group:** Stack Overflow API
- **Endpoint:** `GET https://scrappa.co/api/stackoverflow/question`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `question_id` | integer | Yes | Stack Overflow question id, e.g. 11227809. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/stackoverflow/question?question_id=11227809"
```

## Example response

```json
{
    "success": true,
    "data": {
        "question_id": 11227809,
        "title": "Why is conditional processing of a sorted array faster than of an unsorted array?",
        "link": "https://stackoverflow.com/questions/11227809/why-is-conditional-processing-of-a-sorted-array-faster-than-of-an-unsorted-array",
        "tags": [
            "java",
            "c++"
        ],
        "score": 27548,
        "view_count": 2015920,
        "answer_count": 25,
        "comment_count": 14,
        "is_answered": true,
        "accepted_answer_id": 11227902,
        "created_at": "2012-06-27T13:51:36Z",
        "last_activity_at": "2026-09-04T02:36:50Z",
        "last_edited_at": "2026-04-08T05:35:32Z",
        "owner": {
            "user_id": 87234,
            "display_name": "GManNickG",
            "reputation": 507437,
            "user_type": "registered",
            "accept_rate": 100,
            "link": "https://stackoverflow.com/users/87234/gmannickg",
            "profile_image": "https://i.sstatic.net/FkjBe.png?s=256"
        },
        "body": "<p>In this C++ code, sorting the data (<em>before</em> the timed region) makes the primary loop ~6x faster:</p>\n<pre class=\"lang-cpp prettyprint-overr...",
        "body_text": "In this C++ code, sorting the data (before the timed region) makes the primary loop ~6x faster:\n\n#include <algorithm>\n#include <ctime>\n#include <iostr..."
    },
    "meta": {
        "endpoint_family": "question",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 503 | Upstream Unavailable | The source could not be fetched after the attempt budget. Never charged. Safe to retry. |
| 500 | Parser Drift | The source returned a shape this parser does not recognise. The incident is reported. Never charged. |
| 404 | Not Found | The source has no such public resource. Never charged. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
