# Get Subreddit Posts

<p>Retrieve public subreddit metadata and posts using Reddit public JSON or old Reddit HTML extraction. Each successful request costs <strong>1 credit</strong>; 404, 422, 502, and 503 responses are not billable.</p>

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

## 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 | Required subreddit name without r/. Must be 2-100 letters, numbers, or underscores. |
| `sort` | string | No | Optional sort: hot, new, top, or rising. |
| `timeframe` | string | No | Optional top-post timeframe: hour, day, week, month, year, or all. |
| `limit` | integer | No | Optional number of posts from 1 to 100. Defaults to 25. |
| `after` | string | No | Optional pagination cursor with at most 200 characters. |
| `extraction_path` | string | No | Optional source: public_json or old_reddit. Defaults to public_json. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/reddit/subreddit?subreddit=Laravel&sort=hot&limit=25&extraction_path=public_json"
```

## Example response

```json
{
    "source": "public_json",
    "data": {
        "subreddit": {
            "display_name": "Laravel",
            "title": "Laravel",
            "public_description": "Laravel PHP framework discussion.",
            "subscribers": 123456,
            "active_user_count": 321,
            "over_18": false,
            "created_utc": 1200000000,
            "lang": "en",
            "url": "https://www.reddit.com/r/Laravel/"
        },
        "posts": [
            {
                "id": "abc123",
                "name": "t3_abc123",
                "subreddit": "Laravel",
                "title": "Laravel 13 release notes",
                "author": "example_user",
                "permalink": "https://www.reddit.com/r/Laravel/comments/abc123/laravel_13_release_notes/",
                "url": "https://www.reddit.com/r/Laravel/comments/abc123/laravel_13_release_notes/",
                "selftext": "A discussion of the latest Laravel release.",
                "score": 128,
                "upvote_ratio": 0.95,
                "num_comments": 36,
                "created_utc": 1781900000,
                "over_18": false,
                "spoiler": false,
                "stickied": false,
                "flair": "News",
                "thumbnail": "self"
            }
        ],
        "after": "t3_next",
        "before": null,
        "dist": 1
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Reddit Content Not Found |  |
| 422 | Validation Error |  |
| 502 | Reddit Upstream Error |  |
| 503 | Reddit Temporarily Unavailable |  |

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