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

# Reddit search, posts and comments API (REDDIT)

> Search Reddit posts, read one post with its first page of comments, or list a subreddit's or user's newest posts.

`REDDIT` reads public Reddit. It has four modes, chosen by the payload: search (`query`), one post with its comments (`url`), a subreddit feed (`action: "feed"`) and a user's posts (`action: "user_posts"`).

| | |
| - | - |
| `taskType` | `REDDIT` |
| Input | `query`, or `url`, or `action` (`feed`, `user_posts`); `subreddit`, `username`, `commentSort`, `commentMaxDepth`, `limit`, `country` |
| Credits | 1 per task |
| Country | Defaults to `US`. |
| Location | Not supported (`422 LOCATION_UNSUPPORTED`). |

## Search posts

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/async/task \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskType": "REDDIT", "payload": { "query": "running shoes for flat feet", "subreddit": "RunningShoeGeeks" } }'
```

| Field | Required | Description |
| - | - | - |
| `query` | Yes | The search query. `prompt` is accepted when `query` is absent. |
| `subreddit` | No | Search one subreddit: its name without `r/`, 2-21 letters, digits or underscores. |

Search returns up to 25 posts. For example:

```json theme={"theme":"css-variables"}
{
  "results": [
    { "postId": "1uzk9m4", "title": "...", "url": "https://www.reddit.com/r/RunningShoeGeeks/comments/1uzk9m4/...", "subreddit": "RunningShoeGeeks", "preview": "..." }
  ]
}
```

`preview` is the start of the post's text, up to 2,000 characters, when the post has text. An empty `results` in a completed task means Reddit found nothing.

## Read a post and its comments

Send a post `url` instead of `query`:

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/async/task \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskType": "REDDIT", "payload": { "url": "https://www.reddit.com/r/RunningShoeGeeks/comments/1uer62n/", "commentSort": "top", "commentMaxDepth": 1 } }'
```

| Field | Required | Description |
| - | - | - |
| `url` | Yes | A reddit.com post address: `https://www.reddit.com/r/{subreddit}/comments/{postId}/...`. Other addresses return `422 VALIDATION_ERROR`. |
| `commentSort` | No | `top`, `new`, `controversial`, `old` or `qa`. Without it, Reddit's own default order applies. |
| `commentMaxDepth` | No | Drops replies deeper than this, an integer from 0 to 100. `0` keeps top-level comments only. |

The task reads the post with its first page of comments, about 20-25 of them. For example:

```json theme={"theme":"css-variables"}
{
  "post": {
    "postId": "1uer62n", "title": "...", "body": "...", "author": "...", "subreddit": "RunningShoeGeeks",
    "score": 12, "upvoteRatio": 0.9, "commentCount": 48, "createdAt": "2026-06-24T21:51:21.586000+0000",
    "archived": false, "url": "https://www.reddit.com/r/RunningShoeGeeks/comments/1uer62n/..."
  },
  "comments": {
    "availableCount": 24,
    "returnedCount": 24,
    "items": [
      { "commentId": "otlz8m5", "author": "...", "body": "...", "score": 5, "depth": 0, "isSubmitter": false, "createdAt": "...", "url": "https://www.reddit.com/r/..." }
    ]
  }
}
```

| Field | Description |
| - | - |
| `post.commentCount` | The post's comment count as Reddit reports it. When Reddit leaves it out, the number of comments on the page that was read. `comments` holds only that page. |
| `post.archived` | Estimated from the post's age; Reddit locks comments after about 180 days. |
| `post.author`, `post.body` | `null` when Reddit shows none (a deleted author, a link post). |
| `comments.items[].depth` | Reply depth; `0` is a top-level comment. `parentId` is present on replies. |
| `comments.items[].isSubmitter` | `true` when the post's author wrote the comment. |

> [!NOTE]
>
> Only the first page of comments is available. `commentLimit`, which expands further comments, returns `422 VALIDATION_ERROR` on self-serve plans.

## List newest posts

| Payload | Returns |
| - | - |
| `{ "action": "feed", "subreddit": "RunningShoeGeeks" }` | The subreddit's newest posts. Without `subreddit`, r/popular. |
| `{ "action": "user_posts", "username": "example_user" }` | What the user submitted. `username` is 3-20 letters, digits, underscores or hyphens. |

Both return `results` in the search shape, up to `limit` posts (default 25).

## Limits and errors

* `REDDIT` ignores `markdown`, `rawResponse` and `searchQueries`. It rejects `html` and `analysis` with `422` and `citationAnalysis` with `400`; see [unsupported flags](/engines/response-options.md#unsupported-flags).
* An invalid `subreddit`, `username`, `url` or `commentSort` returns `422 VALIDATION_ERROR`.
* Other request errors are listed in [Errors](/concepts/errors.md).

## Related

* [Web scrape](/engines/web-scrape.md) for pages outside Reddit
* [Async tasks](/concepts/async-tasks.md)


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