> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stophy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Reddit subreddit

> Read a subreddit page as JSON with the reddit-subreddit parser. $1 per 1,000 calls. Send the page to scrape. Examples in cURL, TypeScript and Python.

Reads a subreddit page, like reddit.com/r/programming/ or reddit.com/r/programming/top/?t=week, and returns a list of posts as JSON.

## Make a request

Send the page's URL to [scrape](https://docs.stophy.dev/api-reference/endpoint/scrape.md) with a `json` format that names the parser. Get an API key in the [Quickstart](https://docs.stophy.dev/quickstart).

```bash cURL theme={null}
curl -X POST https://api.stophy.dev/v1/scrape \
  -H "Authorization: Bearer $STOPHY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.reddit.com/r/programming/top/?t=week","formats":[{"type":"json","parser":"reddit-subreddit"}]}'
```

```typescript TypeScript theme={null}
const response = await fetch("https://api.stophy.dev/v1/scrape", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STOPHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://www.reddit.com/r/programming/top/?t=week",
    formats: [{ type: "json", parser: "reddit-subreddit" }],
  }),
});
console.log(await response.json());
```

```python Python theme={null}
import os

import requests

response = requests.post(
    "https://api.stophy.dev/v1/scrape",
    headers={"Authorization": f"Bearer {os.environ['STOPHY_API_KEY']}"},
    json={
        "url": "https://www.reddit.com/r/programming/top/?t=week",
        "formats": [{"type": "json", "parser": "reddit-subreddit"}],
    },
)
print(response.json())
```

## Read the response

The parser's data is in `data.json`. Its fields include `results`, `cursor`, `page` and `total`. This sample is cut to the first items.

```json theme={null}
{
  "success": true,
  "data": {
    "json": {
      "results": [
        {
          "id": "1xjiofl",
          "url": "https://www.reddit.com/r/programming/comments/1xjiofl/how_curl_was_accidentally_turingcomplete_for_nine/",
          "title": "How curl was accidentally Turing-complete for nine months",
          "text": null,
          "author": {
            "id": "0",
            "name": null,
            "handle": "example_user",
            "url": "https://example.com/example_user",
            "avatarUrl": null,
            "isVerified": null
          },
          "community": {
            "name": "programming",
            "url": "https://www.reddit.com/r/programming/"
          },
          "publishedAt": "2026-10-30T15:37:35.622Z",
          "likes": 758,
          "comments": 41,
          "shares": null,
          "views": null,
          "media": [],
          "hashtags": [],
          "score": 758,
          "upvotePercent": 98,
          "flair": null,
          "linkUrl": "https://seriot.ch/computation/curl.html",
          "thumbnailUrl": null,
          "isNsfw": false,
          "isVideo": false,
          "isPinned": false,
          "videoHlsUrl": null,
          "videoDurationSeconds": null,
          "pollOptions": [],
          "pollTotalVotes": null,
          "pollEndsAt": null,
          "repostOfUrl": null
        }
      ],
      "cursor": "dDNfMXhscWZiNg==",
      "page": null,
      "total": null,
      "subreddit": {
        "id": "2fwo",
        "handle": "programming",
        "name": "programming",
        "bio": "Computer Programming",
        "avatarUrl": "https://styles.redditmedia.com/t5_2fwo/styles/communityIcon_1bqa1ibfp8q11.png?width=64&frame=1&auto=webp&s=2545f3c0332e…",
        "isVerified": null,
        "followers": 6932223,
        "following": null,
        "posts": null,
        "website": null,
        "location": null,
        "category": null,
        "url": "https://www.reddit.com/r/programming/",
        "createdAt": "2006-02-28T18:19:29.538Z",
        "isNsfw": false
      },
      "sidebar": "/r/programming is a reddit for discussion and news about [computer…",
      "rules": [
        {
          "title": "No LLM-Written Content",
          "description": "If you don't want to write it, we don't want to read it. This includes the use of LLMs for translation or…"
        }
      ]
    }
  }
}
```

## Options

Send options in the `options` object of the `json` format.

| Option | What it does |
| - | - |
| `cursor` | The cursor from the previous response. Send it as is. |

## Price

\$1 per 1,000 calls. See [Pricing](https://docs.stophy.dev/account/pricing.md).

## Limits and errors

* The URL must be a subreddit page, like reddit.com/r/programming/ or reddit.com/r/programming/top/?t=week. Any other URL fails with `invalidRequest`.
* To read the next page, send the `cursor` from the response as the `cursor` option. Paging needs an API key.
* The answer comes back in `data.json`. If the page cannot be read, the call fails with an error code from [Errors](https://docs.stophy.dev/api-reference/errors.md).

## Related

* [Pre-built parsers](https://docs.stophy.dev/scrape/prebuilt-parsers) lists every parser.
* [Scrape](https://docs.stophy.dev/scrape/overview) has the options every scrape takes.
* [Reddit search](https://docs.stophy.dev/scrape/prebuilt-parsers/social/reddit-search.md)
* [Reddit post](https://docs.stophy.dev/scrape/prebuilt-parsers/social/reddit-post.md)
* [Reddit user](https://docs.stophy.dev/scrape/prebuilt-parsers/social/reddit-user.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.