Reddit's API documents no comment search. Its search endpoint, GET /search, takes a type of sr, link or user: subreddits, posts and people. Our Reddit search API returns comments too, with the full comment text and the post title.
What Reddit's own search covers
Reddit's API lists GET [/r/subreddit]/search for subreddits, posts and users. It returns up to 100 results a request and sorts by relevance, hot, top, new or comments, with a time window. PRAW, Reddit's main Python wrapper, calls the same endpoint, and subreddit.search() returns posts. Once you have a post you can pull its comments, but you can't ask for every comment that contains a word.
If Reddit has approved your app and you search posts, use its endpoint. Our Reddit API pricing post covers its free limit and commercial use.
Search Reddit comments with ToolzerHub
We make ToolzerHub. Our Reddit API has /v1/reddit/search with type set to posts, comments, communities, people or media. Each call is a GET with the x-api-key header, returns one Reddit search page and costs 1 credit.
export TOOLZERHUB_API_KEY=your_key
curl -H "x-api-key: $TOOLZERHUB_API_KEY" \
"https://api.toolzerhub.com/v1/reddit/search?q=supabase&type=comments"
One comment that came back, without fullname, subreddit_id and nsfw:
{
"kind": "comment",
"id": "pf1m7ij",
"post_fullname": "t3_1x2c958",
"post_title": "Deno is joining Cloudflare - and being discontinued in 2027",
"subreddit": "Supabase",
"author": "revadike",
"permalink": "/r/Supabase/comments/1x2c958/deno_is_joining_cloudflare_and_being_discontinued/pf1m7ij/",
"created_at": "2026-10-10T13:34:01.674000+0000",
"body": "Good, I think edge functions were probably one of the biggest pain points with supabase. This looks promising!"
}
body is the whole comment, not a snippet: the longest we pulled ran to 7,681 characters. Comment rows carry no score. Post results (type=posts) carry title, score and comment_count but no text.
Paging
One call is one of Reddit's search pages: 8 to 14 comments, 7 posts or 10 communities. The response carries next_cursor; send it back as cursor for the next page, and stop when it is null. The cursor is Reddit's own and still worked about 20 minutes later. There is no sort or time filter. Results come in Reddit's order, not newest first, so filter on created_at yourself.
Reddit's query syntax goes through untouched. supabase subreddit:webdev with type=comments returned only comments from r/webdev. Search matches the word, not the brand, so for a brand that is also a word, add subreddit: or a longer phrase.
Save the comments that mention a word to CSV
The script runs one search, or one per subreddit you list, skips results it has already written in this run, and saves each comment (or post) to a CSV with a link to it on Reddit.
import csv
import os
import sys
import time
import requests
URL = "https://api.toolzerhub.com/v1/reddit/search"
HEADERS = {"x-api-key": os.environ.get("TOOLZERHUB_API_KEY", "")}
FIELDS = ["created_at", "subreddit", "author", "kind", "title", "text", "score", "link"]
def search_page(q, kind, cursor=None, tries=3):
# 429, 5xx and dropped connections are retried; failed calls cost no credits.
params = {"q": q, "type": kind, **({"cursor": cursor} if cursor else {})}
for attempt in range(tries):
last = attempt == tries - 1
try:
r = requests.get(URL, headers=HEADERS, params=params, timeout=180)
except requests.RequestException:
if last:
raise
time.sleep(10 * (attempt + 1))
continue
if r.status_code in (429, 500, 502, 503, 504) and not last:
time.sleep(10 * (attempt + 1))
continue
r.raise_for_status()
return r.json()["data"]
def search(q, kind, pages):
# One Reddit page per call, 1 credit each; stop early when Reddit runs out.
results, cursor = [], None
for _ in range(pages):
data = search_page(q, kind, cursor)
results += data["results"]
cursor = data.get("next_cursor")
if not cursor:
break
return results
def row(item):
comment = item["kind"] == "comment"
return {
"created_at": (item.get("created_at") or "")[:19].replace("T", " "),
"subreddit": item.get("subreddit"), "author": item.get("author"), "kind": item["kind"],
"title": item.get("post_title") if comment else item.get("title"),
"text": (item.get("body") or "").replace("\n", " "), # posts come without text
"score": item.get("score"),
"link": "https://www.reddit.com" + item["permalink"] if item.get("permalink")
else "https://www.reddit.com/comments/" + item["post_fullname"][3:], # the post, not the comment
}
def main(query, kind="comments", pages="10", subreddits="", out="reddit_search.csv"):
# One call per subreddit goes deeper than one call across all of Reddit.
subs = [s.strip().removeprefix("r/") for s in subreddits.split(",") if s.strip()]
queries = [f"{query} subreddit:{s}" for s in subs]
seen = set()
with open(out, "w", newline="", encoding="utf-8-sig") as f: # -sig: Excel reads UTF-8
writer = csv.DictWriter(f, fieldnames=FIELDS)
writer.writeheader()
for q in queries or [query]:
results = search(q, kind, int(pages))
for item in results:
if item["id"] not in seen:
seen.add(item["id"])
writer.writerow(row(item))
print(f"{q}: {len(results)} results")
print(f"wrote {len(seen)} rows to {out}")
if __name__ == "__main__":
if len(sys.argv) < 2:
sys.exit('usage: python reddit_search.py "supabase" [comments|posts] [pages] [sub1,sub2] [file.csv]')
if not HEADERS["x-api-key"]:
sys.exit("set TOOLZERHUB_API_KEY first")
main(*sys.argv[1:])
python reddit_search.py "supabase" comments 10 "Supabase,webdev,SaaS,SideProject,nextjs" reads up to 10 pages per subreddit: at most 50 calls and 50 credits, fewer when a subreddit runs out of results.
In our run across these five subreddits, 495 of 499 comments contained "supabase". r/Supabase's were all recent; in r/webdev, r/SideProject, r/nextjs and r/SaaS they reached back to October 2022.
Results are not ordered by date, so a rerun returns mostly the same comments. To track new mentions, keep the comment ids you have already saved and drop them on the next run.
What it costs
Each call is 1 credit and returns one Reddit page, so the run above costs at most 50 credits. You get 100 free credits a month; $19 buys 10,000 credits that never expire, and plans for higher volume cover more subreddits. Set your key and run the script on your first word.
To read a subreddit's posts and a thread's comments with a free script instead, see our Reddit scraper in Python. To compare communities by weekly visitors, see what replaced the subreddit member count. For public Telegram channels, see Telegram channel messages as JSON. For football scores and xG, see is there a SofaScore API.
We are not affiliated with Reddit.