Blog/Guides

Reddit Search API: Search Posts and Subreddits

Search all of Reddit, one subreddit, or subreddits by topic with a simple REST API. Sort and time filters, pagination and Python examples included.

The Social Parse team · · Updated

A Reddit search API lets your code ask the questions you'd type into Reddit's search bar and get the results as JSON. Social Parse has three: search all of Reddit, search inside one subreddit, and find subreddits about a topic. Each is a GET request with an API key, with Reddit's sort and time filters and cursor pagination.

Three ways to search Reddit

EndpointPathUse it to
Search/v1/reddit/searchFind posts anywhere on Reddit
Subreddit post search/v1/reddit/subreddits/searchFind posts inside one community
Subreddit search/v1/reddit/search/subredditsFind communities about a topic

Your query runs through Reddit's own search, so the results match what reddit.com shows a logged-out visitor.

Set your key and base URL:

export API_KEY="your-api-key"
export API_URL="https://api.socialparse.dev"

Search all of Reddit

The month's top posts about a topic:

curl -G -H "x-api-key: $API_KEY" "$API_URL/v1/reddit/search" \
  --data-urlencode "q=standing desk" -d sort=top -d time=month

Each post has its id, url, title, author, subreddit, score, comment_count and created_at.

Search inside a subreddit

When you know where the conversation happens, search there. It's more precise than searching all of Reddit:

curl -G -H "x-api-key: $API_KEY" "$API_URL/v1/reddit/subreddits/search" \
  -d subreddit=Fitness --data-urlencode "q=push ups" -d sort=new

Find subreddits about a topic

curl -G -H "x-api-key: $API_KEY" "$API_URL/v1/reddit/search/subreddits" --data-urlencode "q=espresso"

Each community comes with its description, weekly_visitors and weekly_contributions (posts and comments in the last week), which tell you how big and how active it is.

Sort and time filters

ParameterValuesNotes
sortrelevance, hot, top, new, commentscomments puts the most discussed first
timehour, day, week, month, year, allWith relevance, top or comments only

For monitoring, use sort=new and keep the ids you've seen. For research, sort=top with a time window gives you the posts people engaged with most.

Get more than one page

When page.has_more is true, send page.next_cursor back as cursor, with the same other parameters:

import os

import requests

API_URL = os.environ["API_URL"]
HEADERS = {"x-api-key": os.environ["API_KEY"]}

params = {"q": "standing desk", "sort": "top", "time": "year"}
posts = []
for _ in range(10):  # at most 10 pages: 10 credits
    response = requests.get(f"{API_URL}/v1/reddit/search", params=params, headers=HEADERS, timeout=120)
    body = response.json()
    if not response.ok:
        print("stopped:", body["error"]["code"])  # see the Errors docs for which codes to retry
        break
    posts.extend(body["data"])
    if not body["page"]["has_more"]:
        break
    params["cursor"] = body["page"]["next_cursor"]

print(len(posts), "posts")

Each page is one call and costs one credit. See Responses for how pagination works.

From search results to comments

Search finds the threads; the conversation is in the comments. Pass a post's id to post comments:

curl -H "x-api-key: $API_KEY" "$API_URL/v1/reddit/posts/comments?post_id=t3_1wkziub&sort=top"

Each comment has its text, score, depth and parent_id, so you can rebuild the thread. The Reddit sentiment analysis guide turns this into a full pipeline.

Why not Reddit's official API?

Reddit's API needs an approved OAuth app, and commercial use needs a contract. If you only read public posts and comments, a per-call API is quicker to start. The Reddit API pricing guide compares the two.

FAQ

Is there a free Reddit search API?

Reddit's own API is free for non-commercial use once your app is approved. Social Parse gives new accounts 100 free credits, one per search page, with no approval step.

Can I search a subreddit's posts by date?

Use sort=new for the newest first, or sort=top with time set to day, week, month or year.

Can I search Reddit comments?

Reddit's search finds posts and communities. Search for posts first, then read their comments with the post comments endpoint.

Does search include private communities?

No. Only what a logged-out visitor can see is read: private and members-only communities never appear, and a private community answers 403 LOGIN_REQUIRED.

How do I start?

Create a key and follow the quickstart.

Related posts

More from the Social Parse team.

Need public social data as JSON?

Start with 100 free credits, no card needed. Get an API key, or read the quickstart.