# Stack Overflow Comments

Returns one page of comments on a question: comment id, score, edited flag, ISO 8601 date, owner, the user replied to, link, HTML body, plain-text body and license. Sort by creation or votes. Costs 1 credit per successful request.

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

## 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. |
| `sort` | string | No | creation or votes. Defaults to creation. |
| `order` | string | No | asc or desc. Defaults to asc. |
| `page` | integer | No | 1-based page, 1-25. Defaults to 1. |
| `pagesize` | integer | No | Items per page, 1-100. Defaults to 30. |

## Example request

```bash
#!/bin/bash

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

## Example response

```json
{
    "success": true,
    "data": {
        "question_id": 11227809,
        "comments": [
            {
                "comment_id": 141067132,
                "post_id": 11227809,
                "score": 0,
                "edited": false,
                "created_at": "2026-05-24T13:59:16Z",
                "owner": {
                    "user_id": 224132,
                    "display_name": "Peter Cordes",
                    "reputation": 384129,
                    "user_type": "registered",
                    "accept_rate": 83,
                    "link": "https://stackoverflow.com/users/224132/peter-cordes",
                    "profile_image": "https://i.sstatic.net/N4ivW.png?s=256"
                },
                "link": "https://stackoverflow.com/questions/11227809/why-is-conditional-processing-of-a-sorted-array-faster-than-of-an-unsorted-array#comment141067132_1122780...",
                "body": "@SuhitKalubarme: This question isn&#39;t asking whether it&#39;s worth sorting first if you need to run this algorithm on data that isn&#39;t sorted. ...",
                "body_text": "@SuhitKalubarme: This question isn't asking whether it's worth sorting first if you need to run this algorithm on data that isn't sorted. Any comparis...",
                "license": "CC BY-SA 4.0"
            }
        ],
        "page": 1,
        "pagesize": 2,
        "has_more": true
    },
    "meta": {
        "endpoint_family": "comments",
        "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. |
| 422 | Invalid Parameter | A value in this request is invalid or the requested page is out of range. 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)
