> Documentation index: https://docs.scrapier.io/llms.txt
> Auth: header `X-API-Key: <key>` · Base: https://api.scrapier.io/api/v2 · Synchronous; paginate with `cursor` ← `data.next_cursor`.

# Reddit Subreddit Posts

Structured Reddit data: send `subreddits`. Cursor-paginated, 1 credit per successful call.

`GET|POST https://api.scrapier.io/api/v2/reddit-subreddit-posts/` · 1 credit per successful call · Cursor-paginated

## Overview

Call `GET /api/v2/reddit-subreddit-posts/` with `subreddits`. The results are in `data.posts`; send `data.next_cursor` back as `cursor` to get the next page. 7 optional parameters refine the call (see Parameters).

## Request

```bash
curl -G "https://api.scrapier.io/api/v2/reddit-subreddit-posts/" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "subreddits=AbsoluteUnits" \
  --max-time 210
```

```python
import requests

resp = requests.get(
    "https://api.scrapier.io/api/v2/reddit-subreddit-posts/",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"subreddits": "AbsoluteUnits"},
    timeout=210,
)
body = resp.json()
if not resp.ok:
    raise RuntimeError(body.get("error") or body.get("detail"))

print(body["data"]["posts"])
```

POST with a JSON body works too (same parameters; the body is merged over the query string).

## Parameters

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `X-API-Key` (header) | string | yes | — | Your API key. |
| `subreddits` | string | yes | e.g. `AbsoluteUnits` | Subreddit name ("AbsoluteUnits"), "r/AbsoluteUnits" or a full reddit.com/r/AbsoluteUnits/ URL (case-insensitive) -> ONE native Reddit Listing page per call (`limit` posts, default 25) in listing order, each row with the post's engagement metrics, author, flair, selftext, media URL, permalink and the subreddit info block. A private / banned / quarantined / premium-only / unknown / empty subreddit answers one status row (next_cursor null). Required on the first call; ignored when `cursor` is supplied. |
| `cursor` | string | no | — | Pagination cursor returned in the previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When `next_cursor` is null, you have reached the last page. |
| `after` | string | no | — | First call only: start the walk at a Reddit post fullname ("t3_1w05sdh" or the bare id) instead of the top of the listing. Later pages come from `cursor` (which carries Reddit's own `after`). |
| `sort` | string | no | `hot` | hot (default) \| new \| top \| rising \| controversial \| best. One of: `hot`, `new`, `top`, `rising`, `controversial`, `best`. Locked in cursor. |
| `timeframe` | string | no | — | Window for sort=top / controversial (empty = Reddit's default, day). One of: `hour`, `day`, `week`, `month`, `year`, `all`. Locked in cursor. |
| `trim` | boolean | no | `true` | true = the reference post fields only; false = + every other field Reddit returns for the post (~110 keys). Locked in cursor. |
| `limit` | integer | no | `25` | Posts per page = one Reddit Listing call, 1..100 (default 25); larger values are clamped to 100 with a note in `warnings`. Locked in cursor. |
| `include_subreddit_info` | boolean | no | `true` | Attach the subreddit info block (subscribers, weekly_active_users, rules, icons ...) to every row: /about + /about/rules + one community page load on the first call; continuation pages reuse the weekly stats carried in the cursor. Locked in cursor. |
| `use_proxy` | boolean | no | `true` | Route the request through Scrapier's residential proxy pool. Default: `true`. Leave as is unless support tells you otherwise. |
| `raw_data` | boolean | no | `false` | When true, the response carries the full raw upstream payload(s) the scraper received (GraphQL / JSON API bodies, HTML, embedded JSON-LD -- exactly as the platform returned them) under `raw_responses`, in place of the formatted items. When false (default) you get the formatted output. Pagination (`cursor` / `next_cursor`) works the same in both modes. |

## Response

HTTP 200. Results are in `data.posts`. Sample from the live catalog, arrays trimmed to 3 items.

```json
{
  "success": true,
  "data": {
    "subreddits": "AbsoluteUnits",
    "subreddit": "AbsoluteUnits",
    "sort": "top",
    "timeframe": "month",
    "status": "ok",
    "note": null,
    "page": 1,
    "page_size": 2,
    "after": null,
    "next_after": "t3_1w12kzi",
    "has_more": true,
    "posts": [
      {
        "input_subreddit": "AbsoluteUnits",
        "subreddit": "AbsoluteUnits",
        "status": "ok",
        "position": 1,
        "post_id": "1wb8slx",
        "post_url": "https://www.reddit.com/r/AbsoluteUnits/comments/1wb8slx/of_a_polar_bear_literally_trying_to_figure_out/",
        "id": "1wb8slx",
        "author": "DarthiusFatticus",
        "author_fullname": "t2_5t81wgdhd",
        "title": "of a polar bear. Literally trying to figure out how to eat them.",
        "link_flair_text": "/r/all",
        "selftext": null,
        "selftext_html": null,
        "downs": 0,
        "name": "t3_1wb8slx",
        "upvote_ratio": 0.97,
        "ups": 57502,
        "total_awards_received": 0,
        "score": 57502,
        "created": 1788920629,
        "created_utc": 1788920629,
        "created_at_iso": "2026-09-09T02:23:49.000Z",
        "num_comments": 2848,
        "url": "https://v.redd.it/zbef9p7fneoh1",
        "permalink": "/r/AbsoluteUnits/comments/1wb8slx/of_a_polar_bear_literally_trying_to_figure_out/",
        "subreddit_subscribers": 2138337,
        "is_video": true,
        "over_18": false,
        "spoiler": false,
        "domain": "v.redd.it",
        "subreddit_id": "t5_a7wuv",
        "post_hint": "hosted:video",
        "sort": "top",
        "timeframe": "month",
        "subreddit_info": {
          "subreddit_id": "t5_a7wuv",
          "display_name": "AbsoluteUnits",
          "weekly_active_users": 2104672,
          "weekly_contributions": 23960,
          "subscribers": 2138336,
          "created_at": "2018-01-05T10:35:24.000Z",
          "title": "Lads that you’re in awe at the size of.",
          "subreddit_type": "public",
          "...": "(rules, description, header_img, icon_img, advertiser_category, submit_text, url, is_nsfw, language, rules_list)"
        },
        "pagination": {
          "page": 1,
          "after_sent": null,
          "next_after": "t3_1w12kzi",
          "has_more": true,
          "next_cursor": "t3_1w12kzi"
        },
        "scraped_at": "2026-09-21T11:31:34.910Z"
      },
      {
        "position": 2,
        "post_id": "1w12kzi",
        "title": "of a Bong",
        "author": "Desilaundry",
        "score": 51708,
        "num_comments": 3905,
        "url": "https://v.redd.it/eudnuq8xi6mh1",
        "created_at_iso": "2026-08-28T20:55:44.000Z",
        "...": "(same shape as row 1)"
      }
    ],
    "warnings": [],
    "next_cursor": "eyJhIjoidDNfMXcxMmt6aSIsImxrIjp7ImxpbWl0IjoiMiIsInNvcnQiOiJ0b3AiLCJ0aW1lZnJhbWUiOiJtb250aCJ9LCJwIjoxLCJwb3MiOjIsInMiOlsidDNfMXdiOHNseCIsInQzXzF3MTJremkiXSwic3ViIjoiQWJzb2x1dGVVbml0cyJ9"
  }
}
```

## Response fields

| Field | Type | Example | Description |
|---|---|---|---|
| `subreddits` | string | `AbsoluteUnits` |  |
| `subreddit` | string | `AbsoluteUnits` |  |
| `sort` | string | `top` |  |
| `timeframe` | string | `month` |  |
| `status` | string | `ok` |  |
| `note` | null | `null` |  |
| `page` | integer | `1` |  |
| `page_size` | integer | `2` |  |
| `after` | null | `null` |  |
| `next_after` | string | `t3_1w12kzi` |  |
| `has_more` | boolean | `true` |  |
| `posts` | array | `[2 items]` | The results. |
| `warnings` | array | `[]` |  |
| `next_cursor` | string | `eyJhIjoidDNfMXcxMmt6aSIsImxrIjp7ImxpbWl0IjoiM…` | Pass back as `cursor` for the next page. `null` on the last page. |
| `posts[].input_subreddit` | string | `AbsoluteUnits` |  |
| `posts[].subreddit` | string | `AbsoluteUnits` |  |
| `posts[].status` | string | `ok` |  |
| `posts[].position` | integer | `1` |  |
| `posts[].post_id` | string | `1wb8slx` |  |
| `posts[].post_url` | string | `https://www.reddit.com/r/AbsoluteUnits/commen…` |  |
| `posts[].id` | string | `1wb8slx` |  |
| `posts[].author` | string | `DarthiusFatticus` |  |
| `posts[].author_fullname` | string | `t2_5t81wgdhd` |  |
| `posts[].title` | string | `of a polar bear. Literally trying to figure o…` |  |
| `posts[].link_flair_text` | string | `/r/all` |  |
| `posts[].selftext` | null | `null` |  |
| `posts[].selftext_html` | null | `null` |  |
| `posts[].downs` | integer | `0` |  |
| `posts[].name` | string | `t3_1wb8slx` |  |
| `posts[].upvote_ratio` | number | `0.97` |  |
| `posts[].ups` | integer | `57502` |  |
| `posts[].total_awards_received` | integer | `0` |  |
| `posts[].score` | integer | `57502` |  |
| `posts[].created` | integer | `1788920629` |  |
| `posts[].created_utc` | integer | `1788920629` |  |
| `posts[].created_at_iso` | string | `2026-09-09T02:23:49.000Z` |  |
| `posts[].num_comments` | integer | `2848` |  |
| `posts[].url` | string | `https://v.redd.it/zbef9p7fneoh1` |  |
| `posts[].permalink` | string | `/r/AbsoluteUnits/comments/1wb8slx/of_a_polar_…` |  |
| `posts[].subreddit_subscribers` | integer | `2138337` |  |
| `posts[].is_video` | boolean | `true` |  |
| `posts[].over_18` | boolean | `false` |  |
| `posts[].spoiler` | boolean | `false` |  |
| `posts[].domain` | string | `v.redd.it` |  |
| `posts[].subreddit_id` | string | `t5_a7wuv` |  |
| `posts[].post_hint` | string | `hosted:video` |  |
| `posts[].sort` | string | `top` |  |
| `posts[].timeframe` | string | `month` |  |
| `posts[].subreddit_info` | object | `{…}` |  |
| `posts[].pagination` | object | `{…}` |  |
| `posts[].scraped_at` | string | `2026-09-21T11:31:34.910Z` |  |

## Pagination

Pass `data.next_cursor` back as `cursor` until it is `null`. Required inputs are ignored once a cursor is sent. Each page is one billed call.

```python
import requests

URL = "https://api.scrapier.io/api/v2/reddit-subreddit-posts/"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}
params = {"subreddits": "AbsoluteUnits"}
items = []

for _ in range(10):  # each page is one billed call
    resp = requests.get(URL, headers=HEADERS, params=params, timeout=210)
    resp.raise_for_status()
    data = resp.json()["data"]
    items.extend(data.get("posts") or [])
    if not data.get("next_cursor"):  # None = last page
        break
    params = {"cursor": data["next_cursor"]}
```

## Errors

Failed calls are free. Branch on HTTP status; the message is in `error` (or `detail`). See https://docs.scrapier.io/errors.md

- **400** Bad input. The exact message varies by endpoint. `{"success":false,"error":"…"}`
- **402** Balance below the endpoint's price. `{"error":"Insufficient credits. Buy more to scrape more.","balance":1,"required":2}`
- **403** Invalid or unknown API key. `{"detail":"Authentication service unavailable or invalid API key."}`
- **429** Throttled — wait for Retry-After. `{"detail":"Request was throttled. Expected available in N seconds."}`
- **404** unknown slug · **503** busy (retry after `Retry-After`) · **5xx** upstream failure or timeout (retry with backoff).

## Notes

- Locked into the cursor: `sort`, `timeframe`, `trim`, `limit`, `include_subreddit_info`. Set them on the first call; later pages reuse them.

## Related

- [Reddit Comment Replies](https://docs.scrapier.io/api-reference/reddit/reddit-comment-replies.md): Structured Reddit data: send `urls`. Cursor-paginated, 1 credit per successful call.
- [Reddit Post Comments](https://docs.scrapier.io/api-reference/reddit/reddit-comments.md): Structured Reddit data: send `urls`. Cursor-paginated, 1 credit per successful call.
- [Reddit Post Search](https://docs.scrapier.io/api-reference/reddit/reddit-post-search.md): Structured Reddit data: send `queries`. Cursor-paginated, 1 credit per successful call.
- [Reddit Post Transcript](https://docs.scrapier.io/api-reference/reddit/reddit-post-transcript.md): Structured Reddit data: send `urls`. Single lookup, 1 credit per successful call.
