# Reddit — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Search Reddit posts and comments across any subreddit. Retrieve post discussions with full comment threads, search by keyword, and browse subreddit feeds by category (hot, new, top, rising) with flexible sorting and pagination.

**Category:** Social Media | **Website:** [www.reddit.com/r/smallbusiness/comments/198xzca/whats_your_biggest_struggle_in_running_your_small/](https://www.reddit.com/r/smallbusiness/comments/198xzca/whats_your_biggest_struggle_in_running_your_small/) | **Docs:** [parse.bot/marketplace/b113169d-5470-4822-8a48-d91824623a1a/reddit-com-api](https://parse.bot/marketplace/b113169d-5470-4822-8a48-d91824623a1a/reddit-com-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-reddit-com-api-b113169d/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_post_comments

Retrieve a Reddit post and its full comment tree, flattened with depth indicators. Comments are sorted server-side; each carries score, author, body, and parent_id for threading reconstruction. The limit caps top-level comments fetched; nested replies within those top-level threads are always included. Returns the post metadata alongside the comment array. Post and comment objects include a media array with any attached images, videos, GIFs, gallery items, or external embeds.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `limit` | integer | No | Max number of top-level comments to fetch (up to 500) |
| `post_id` | string | Yes | Reddit post ID (the alphanumeric code from the URL, e.g. '198xzca') |
| `sort` | string | No | Comment sort order |
| `subreddit` | string | Yes | Subreddit name (without r/ prefix) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-reddit-com-api-b113169d/get_post_comments \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit":"<integer>","post_id":"<string>","sort":"<string>","subreddit":"<string>"}'
```

### list_posts

List posts from a subreddit feed by category. Supports hot (currently trending), new (most recent), top (highest scored within a time window), and rising. The time_filter parameter applies only when category is top. Supports cursor-based pagination via the after token. Each post includes a media array with any attached images, videos, GIFs, gallery items, or external embeds.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `after` | string | No | Pagination cursor from previous response (e.g. t3_abc123). Omit for first page. |
| `category` | string | No | Post feed category |
| `limit` | integer | No | Number of results per page (max 100) |
| `subreddit` | string | Yes | Subreddit name (without r/ prefix) |
| `time_filter` | string | No | Time filter for top category |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-reddit-com-api-b113169d/list_posts \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"after":"<string>","category":"<string>","limit":"<integer>","subreddit":"<string>","time_filter":"<string>"}'
```

### search_posts

Full-text search over one subreddit's posts. The query matches title and body text; results can be sorted and filtered by time window. Supports cursor-based pagination via the after token returned in each response. Returns an array of post summaries with scores, metadata, and media attachments.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `after` | string | No | Pagination cursor from previous response (e.g. t3_abc123). Omit for first page. |
| `limit` | integer | No | Number of results per page (max 100) |
| `query` | string | Yes | Search query string |
| `sort` | string | No | Sort order for results |
| `subreddit` | string | Yes | Subreddit name (without r/ prefix) |
| `time_filter` | string | No | Time window filter |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-reddit-com-api-b113169d/search_posts \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"after":"<string>","limit":"<integer>","query":"<string>","sort":"<string>","subreddit":"<string>","time_filter":"<string>"}'
```
