# Reddit Search API

> Search Reddit posts, communities, comments, media and users with the Reddit app search. Sort by relevance, hot, top, new or comments and filter by time range, with NSFW and safe-search controls.

Source: https://www.sandbase.ai/apis/reddit/app/dynamic-search
API reference: https://www.sandbase.ai/apis/reddit/app/dynamic-search/docs

## Facts

- Provider: Reddit
- Type: Data API
- Endpoint: `POST https://api.sandbase.ai/v1/api/reddit/app/dynamic-search`
- Price: $0.0015 per call
- Free allowance: 100 calls per organization per UTC day, shared across eligible APIs
- Capabilities: api, reddit
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

`POST https://api.sandbase.ai/v1/api/reddit/app/dynamic-search` with `Authorization: Bearer $SANDBASE_API_KEY` and the parameters as a JSON body.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `query` | string | yes |  |
| `after` | string | no |  |
| `allow_nsfw` | string | no |  |
| `need_format` | boolean | no |  |
| `safe_search` | string | no |  |
| `search_type` | string | no |  |
| `sort` | string | no |  |
| `time_range` | string | no |  |

## FAQ

### How do I use the Reddit Search API?

Send a POST request to https://api.sandbase.ai/v1/api/reddit/app/dynamic-search with your SandBase API key in the Authorization header (Bearer) and the parameters as a JSON body. You can also try it in the Playground on this page without writing code.

### How much does the Reddit Search API cost?

$0.0015 per call. Every organization gets 100 free calls per UTC day, shared across eligible SandBase APIs including this one; after that each call is billed at this price from your SandBase balance. There is no subscription.

### What parameters does the Reddit Search API accept?

Required: query (string). Optional: after (string), allow_nsfw (string), need_format (boolean), safe_search (string), search_type (string) and sort (string) and 1 more. The Parameters table and the Playground on this page list every field.

### What does the Reddit Search API return?

A JSON response returned in the same HTTP request (synchronous). The README on this page includes a sample response.

### Do I need a Reddit developer account or API key?

No. Reddit Search runs through SandBase, so one SandBase API key covers this endpoint and every other API and model in the catalog. You do not need to apply for Reddit API access separately.

## README

### Reddit Search API

Search Reddit for a keyword across posts, communities, comments, media or people. Choose sort and time range, and paginate with `after`.

#### Use cases

- Monitor discussions about a brand or product.
- Find active subreddits for a topic.
- Collect posts and comments for sentiment analysis.

#### Request

```bash
curl -X POST "https://api.sandbase.ai/v1/api/reddit/app/dynamic-search" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "OpenAI"}'
```

#### Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `query` | string | Yes | Search keyword |
| `sort` | string | No | Sort method (only for post/comment/media): RELEVANCE, HOT, TOP, NEW, COMMENTS |
| `after` | string | No | Pagination parameter for fetching next page |
| `allow_nsfw` | string | No | Allow NSFW content, "0" or "1" |
| `time_range` | string | No | Time range (only for post/media): all, year, month, week, day, hour |
| `need_format` | boolean | No | Whether to clean and format the data |
| `safe_search` | string | No | Safe search setting, "unset" or "strict" |
| `search_type` | string | No | Search type: post, community, comment, media, people |

#### Example response

Real response for the request above, trimmed to the main fields. User names and long IDs are masked.

```json
{
  "search": {
    "dynamic": {
      "components": {
        "main": {
          "edges": [
            {
              "node": {
                "__typename": "SearchListComponent",
                "children": [
                  {
                    "__typename": "SearchPost",
                    "post": {
                      "id": "t3_1wsu05i",
                      "title": "Post by Altman pretty much confirms direction from OpenAI",
                      "type": "TEXT",
                      "isNsfw": false
                    },
                    "community": "codex"
                  }
                ]
              }
            }
          ],
          "pageInfo": {
            "hasNextPage": true,
            "endCursor": "<after>"
          }
        }
      }
    }
  }
}
```

#### Notes

- `search_type`: post, community, comment, media or people.
- Set `need_format` to `true` for a cleaned, flatter response.

#### Related APIs

- [Check if Subreddit is Muted](/model/reddit/app/check-subreddit-muted): Check if a specified Reddit subreddit is muted by the current user.
- [Fetch Reddit APP Comment Replies (Sub-comments)](/model/reddit/app/comment-replies): Fetch replies (sub-comments/second-level comments) under a specified Reddit APP comment Use this endpoint when a comment node has more.cursor field to get its …
- [Fetch Reddit APP Community Highlights](/model/reddit/app/community-highlights): Fetch featured highlight content of a specified Reddit APP community, including popular posts and important announcements.
