---
title: "Search Reddit Posts"
description: "Searches Reddit posts, subreddits, or users matching a query string globally or within a specified subreddit.\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`

Searches Reddit posts, subreddits, or users matching a query string globally or within a specified subreddit.

## Authentication

Requires one of the following:

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

## Query parameters

- `q` (`search.query.q`; string, required) — Search query, 1 to 256 characters.
  - maxLength 256
- `type` (`search.query.type`; string, optional) — Content type to search: post, subreddit, or user.
  - one of `"post"`, `"subreddit"`, `"user"`; default `"post"`
- `sub` (`search.query.sub`; string, optional) — Only search this subreddit.
- `sort` (`search.query.sort`; string, optional)
  - one of `"relevance"`, `"new"`, `"top"`, `"comments"`; default `"relevance"`
- `t` (`search.query.t`; string, optional) — Time window when sorting by `top` or `controversial`.
  - one of `"hour"`, `"day"`, `"week"`, `"month"`, `"year"`, `"all"`
- `limit` (`search.query.limit`; integer, optional) — Number of items per page.
  - min 1; max 100; default `25`
- `after` (`search.query.after`; string, optional) — Pagination cursor from the previous page's `after` field.
- `nsfw` (`search.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?q=best%20crm%20for%20small%20agency' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.threadapi.dev/v1/reddit/search?q=best%20crm%20for%20small%20agency';
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?q=best%20crm%20for%20small%20agency"

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

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

print(response.text)
```

## Responses

### 200

The search results.

#### Example

```json
{
  "subreddit": "string",
  "query": "string",
  "sort": "string",
  "count": 0,
  "items": [
    {
      "id": "string",
      "name": "string",
      "domain": "string",
      "is_self": true,
      "flair": "string",
      "spoiler": true,
      "stickied": true,
      "locked": true,
      "removed": true,
      "subreddit": "string",
      "title": "string",
      "author": "string",
      "score": 0,
      "upvote_ratio": 0,
      "num_comments": 0,
      "url": "string",
      "permalink": "string",
      "selftext": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "is_video": true,
      "over_18": true,
      "media": [
        {
          "type": "image",
          "url": "string",
          "width": 0,
          "height": 0,
          "caption": "string"
        }
      ],
      "poll": {
        "total_votes": 0,
        "is_closed": true,
        "options": [
          {
            "id": "string",
            "text": "string",
            "vote_count": 0
          }
        ]
      },
      "crosspost_of": {
        "id": "string",
        "subreddit": "string",
        "title": "string",
        "author": "string",
        "permalink": "string"
      },
      "comments": [
        {
          "id": "string",
          "parent_id": "string",
          "author": "string",
          "score": 0,
          "body": "string",
          "created_at": "2019-08-24T14:15:22Z",
          "depth": 0,
          "is_submitter": true,
          "controversy": 0,
          "replies": [
            {
              "id": "string",
              "parent_id": "string",
              "author": "string",
              "score": 0,
              "body": "string",
              "created_at": "2019-08-24T14:15:22Z",
              "depth": 0,
              "is_submitter": true,
              "controversy": 0,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "after": "string",
  "filtered_nsfw": 0,
  "degraded": true
}
```

One of:

- `Listing`
- `SubredditListing`
- `UserListing`

### 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` (`search.response.402.error`; object, required)
  - `code` (`search.response.402.error.code`; string, required)
    - example `"not_found"`
  - `message` (`search.response.402.error.message`; string, required)
  - `retryable` (`search.response.402.error.retryable`; boolean, required)
  - `retry_after` (`search.response.402.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` (`search.response.503.error`; object, required)
  - `code` (`search.response.503.error.code`; string, required)
    - example `"not_found"`
  - `message` (`search.response.503.error.message`; string, required)
  - `retryable` (`search.response.503.error.retryable`; boolean, required)
  - `retry_after` (`search.response.503.error.retry_after`; integer, optional) — Seconds to wait before retrying.


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