# Reddit Subreddit Posts API Documentation

<p><strong>Reddit Subreddit Posts API</strong> lists the posts of one subreddit. Sort by <code>hot</code> (default), <code>new</code>, <code>top</code>, <code>rising</code> or <code>controversial</code>. The time window <code>t</code> only works with <code>top</code> and <code>controversial</code>; with another sort the request fails with 422. A subreddit that does not exist, is private or is banned returns 404.</p><p>Each post has id, fullname, title, selftext (<code>null</code> for link posts), author, subreddit, score, upvote_ratio, num_comments, awards, flair, created_at and created_utc, permalink, url, domain, <code>post_type</code> (text, link, image, gallery, video or crosspost), the flags over_18, spoiler, stickied, locked and archived, <code>removed_by_category</code>, <code>thumbnail_url</code>, <code>gallery</code>, <code>video</code> and <code>crosspost_parent</code>. Deleted authors and removed posts show Reddit's own marker such as <code>[deleted]</code>.</p><p>Every list has <code>pagination</code> with <code>limit</code>, <code>after</code>, <code>next_after</code> and <code>has_more</code>. Pass <code>next_after</code> as <code>after</code> to read the next page. A page is never another page's data under a new label. Reddit ends every list after about 1000 items.</p>

- **Documentation:** [https://scrappa.co/docs/reddit-api/reddit_subreddit_posts](https://scrappa.co/docs/reddit-api/reddit_subreddit_posts)
- **API group:** Reddit API
- **Endpoint:** `GET https://scrappa.co/api/reddit/subreddit/posts`

## 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 |
| --- | --- | --- | --- |
| `subreddit` | string | Yes | Subreddit name without r/. Example: programming. |
| `sort` | string | No | hot (default), new, top, rising or controversial. Example: top. |
| `t` | string | No | Time window: hour, day, week, month, year or all. Only with sort top or controversial. Items outside the window are never returned. Example: week. |
| `after` | string | No | Cursor from pagination.next_after of the previous page. Example: t3_1xhv532. |
| `limit` | integer | No | Items per page, 1 to 100 (default 25). Example: 25. |

## Example response

```json
{
    "data": {
        "sort": "hot",
        "time": null,
        "posts": [],
        "subreddit": "singularity",
        "pagination": {
            "after": null,
            "limit": 2,
            "has_more": true,
            "next_after": "t3_1xi16s3"
        }
    },
    "meta": {
        "billable": true,
        "endpoint_family": "subreddit_posts"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A required parameter or a value is invalid. This response is not billable. |
| 404 | Not Found | The subreddit, post or user does not exist, is private or is banned. This response is not billable. |
| 503 | Upstream Unavailable | Reddit could not be reached or returned data that does not match the request. This response is not billable and is retryable. |

## 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)
