---
title: "Search Reddit Comments"
description: "Searches Reddit comments globally or scoped to a specific subreddit with pagination support.\n"
---

> Documentation Index
> Fetch the complete documentation index at: https://staging.threadapi.dev/llms.txt
> Use this file to discover all available pages before exploring further.

Path: ThreadAPI API › Reddit

`GET /v1/reddit/search/comments`

Searches Reddit comments globally or scoped to a specific subreddit with pagination support.

## Authentication

Requires one of the following:

- `bearerAuth`, http, header `Authorization`
- `apiKeyAuth`, apiKey, in header, header `x-api-key`

## Query parameters

- `q` (`searchComments.query.q`; string, required) — Search query, 1 to 500 characters.
  - maxLength 500
- `sub` (`searchComments.query.sub`; string, optional) — Only search this subreddit.
- `sort` (`searchComments.query.sort`; string, optional)
  - one of `"relevance"`, `"new"`, `"top"`; default `"relevance"`
- `t` (`searchComments.query.t`; string, optional) — Time window when sorting by `top` or `controversial`.
  - one of `"hour"`, `"day"`, `"week"`, `"month"`, `"year"`, `"all"`
- `after` (`searchComments.query.after`; string, optional) — Pagination cursor from the previous page's `after` field.
- `nsfw` (`searchComments.query.nsfw`; boolean, optional) — Include NSFW content (filtered out by default).
  - default `false`

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://api.threadapi.dev/v1/reddit/search/comments?q=postgres%20replica%20lag' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.threadapi.dev/v1/reddit/search/comments?q=postgres%20replica%20lag';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.threadapi.dev/v1/reddit/search/comments?q=postgres%20replica%20lag"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

The comments.

#### Example

```json
{
  "subreddit": "string",
  "query": "string",
  "sort": "string",
  "count": 0,
  "items": [
    {
      "id": "string",
      "name": "string",
      "post_id": "string",
      "post_title": "string",
      "subreddit": "string",
      "author": "string",
      "score": 0,
      "body": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "permalink": "string",
      "parent_id": "string",
      "is_submitter": true,
      "controversiality": 0
    }
  ],
  "after": "string",
  "filtered_nsfw": 0,
  "degraded": true
}
```

- `sort` (`searchComments.response.200.sort`; string, required)
- `count` (`searchComments.response.200.count`; integer, required)
- `items` (`searchComments.response.200.items`; array<object>, required)
  - `id` (`searchComments.response.200.items.id`; string, optional)
  - `name` (`searchComments.response.200.items.name`; string, optional)
  - `post_id` (`searchComments.response.200.items.post_id`; string, optional)
  - `post_title` (`searchComments.response.200.items.post_title`; string, optional)
  - `subreddit` (`searchComments.response.200.items.subreddit`; string, optional)
  - `author` (`searchComments.response.200.items.author`; string, optional)
  - `score` (`searchComments.response.200.items.score`; integer, optional)
  - `body` (`searchComments.response.200.items.body`; string, optional)
  - `created_at` (`searchComments.response.200.items.created_at`; string, optional)
    - format `date-time`
  - `permalink` (`searchComments.response.200.items.permalink`; string, optional)
  - `parent_id` (`searchComments.response.200.items.parent_id`; string, optional)
  - `is_submitter` (`searchComments.response.200.items.is_submitter`; boolean, optional)
  - `controversiality` (`searchComments.response.200.items.controversiality`; integer, optional)
- `filtered_nsfw` (`searchComments.response.200.filtered_nsfw`; integer, required)
- `subreddit` (`searchComments.response.200.subreddit`; string | null, optional)
- `query` (`searchComments.response.200.query`; string | null, optional)
- `after` (`searchComments.response.200.after`; string | null, optional)
- `degraded` (`searchComments.response.200.degraded`; boolean, optional)

### 400

Bad request (invalid parameter or unknown action)

#### Example

```json
{
  "error": "unauthorized: missing or invalid credentials",
  "error_code": "insufficient_credits"
}
```

One of:

- `ErrorResponse`
- `Error`

### 401

Missing or invalid API key or OAuth access token

#### Example

```json
{
  "error": "unauthorized: missing or invalid credentials",
  "error_code": "insufficient_credits"
}
```

One of:

- `ErrorResponse`
- `Error`

### 402

The account has no credits left (`insufficient_credits`).

#### Example

```json
{
  "error": {
    "code": "not_found",
    "message": "string",
    "retryable": true,
    "retry_after": 0
  }
}
```

- `error` (`searchComments.response.402.error`; object, required)
  - `code` (`searchComments.response.402.error.code`; string, required)
    - example `"not_found"`
  - `message` (`searchComments.response.402.error.message`; string, required)
  - `retryable` (`searchComments.response.402.error.retryable`; boolean, required)
  - `retry_after` (`searchComments.response.402.error.retry_after`; integer, optional) — Seconds to wait before retrying.

### 403

Reddit does not show this content to logged-out readers, e.g. a private or quarantined subreddit (`reddit_refused`).

#### Example

```json
{
  "error": {
    "code": "not_found",
    "message": "string",
    "retryable": true,
    "retry_after": 0
  }
}
```

- `error` (`searchComments.response.403.error`; object, required)
  - `code` (`searchComments.response.403.error.code`; string, required)
    - example `"not_found"`
  - `message` (`searchComments.response.403.error.message`; string, required)
  - `retryable` (`searchComments.response.403.error.retryable`; boolean, required)
  - `retry_after` (`searchComments.response.403.error.retry_after`; integer, optional) — Seconds to wait before retrying.

### 429

Rate limit or daily request quota exceeded

#### Example

```json
{
  "error": "unauthorized: missing or invalid credentials",
  "error_code": "insufficient_credits"
}
```

One of:

- `ErrorResponse`
- `Error`

### 503

A temporary problem reaching Reddit (`upstream_busy`, `upstream_timeout`, `upstream_error`). Retry shortly; nothing was billed.

#### Example

```json
{
  "error": {
    "code": "not_found",
    "message": "string",
    "retryable": true,
    "retry_after": 0
  }
}
```

- `error` (`searchComments.response.503.error`; object, required)
  - `code` (`searchComments.response.503.error.code`; string, required)
    - example `"not_found"`
  - `message` (`searchComments.response.503.error.message`; string, required)
  - `retryable` (`searchComments.response.503.error.retryable`; boolean, required)
  - `retry_after` (`searchComments.response.503.error.retry_after`; integer, optional) — Seconds to wait before retrying.


Source: https://staging.threadapi.dev/api/Reddit/searchComments/index.md
