Search
search(q, options?): Listing<Post | Subreddit | User>
Finds posts matching a query, or with type, subreddits or users. Posts come back as in Subreddit, subreddits as in Subreddits, users as in User. To search comments, use Comment search. 1 credit per page of up to 100 results; see Listings and pages.
Security
API Key
All requests require a valid API key from the developer dashboard.
Headers: Authorization: Bearer YOUR_API_KEYorX-API-Key: YOUR_API_KEY
See Authentication for headers and rate limits.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
qquery | string | Yes | The search query, 1 to 256 characters. Reddit's search syntax works for posts: |
typequery | string | No |
|
subquery | string | No | Only search posts in this subreddit. |
sortquery | string | No | For posts: |
tquery | string | No | Time window for posts: |
limitquery | integer | No | Results per page, 1 to 100. Default |
afterquery | string | No | The previous page's |
nsfwquery | boolean | No | Include NSFW results. Default |
Response
// GET /v1/reddit/search?q=golang%20generics&limit=3
{
"subreddit": null,
"query": "golang generics",
"sort": "relevance",
"count": 3,
"items": [
{
"id": "lh7dkd",
"name": "t3_lh7dkd",
"subreddit": "programming",
"title": "The Golang proposal to add generics has now been accepted.",
"score": 713,
"num_comments": 431,
"url": "https://github.com/golang/go/issues/43651#issuecomment-776944155",
"domain": "github.com",
"created_at": "2021-02-10T23:42:03Z"
// …the other post fields, as in Subreddit
}
],
"after": "t3_1wgu40p",
"filtered_nsfw": 0
}
// GET /v1/reddit/search?q=golang&type=subreddit&limit=3
{
"query": "golang",
"items": [
{
"name": "golang",
"title": "The Go Programming Language",
"public_description": "Ask questions and post articles about the Go programming language and related tools, events etc.",
"subscribers": 380079,
"created_at": "2009-11-11T00:54:28Z",
"over_18": false,
"type": "public",
"url": "/r/golang/"
}
],
"after": "t5_3bzfq"
// …
}