Reddit comment search API
Full-text search over comments, across Reddit or in one community: the matching comments themselves, with their post’s title, score and comment count.
GET /v1/reddit/search/comments2 credits per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/reddit/search/comments?q=standing%20desk&sort=top&t=year",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 2 credits{ "kind": "Listing", "data": { "after": "t1_m3svclx", "before": null, "dist": 25, "modhash": null, "geo_filter": "", "children": [ { "kind": "t1", "data": { "id": "nmwtt7k", "name": "t1_nmwtt7k", "author": "Nenoshka", "author_fullname": null, "body": "You need to go stand on someone's desk until they cut you a paper check. None of this \"next pay period\" sh\\*t.", "body_html": "<div class=\"md\"><p>\n You need to go stand on someone's desk until they cut you a paper check. None of this \"next pa…", "parent_id": "t3_1onhoxt", "link_id": "t3_1onhoxt", "subreddit": "antiwork", "subreddit_id": "t5_2y77d", "permalink": "/r/antiwork/comments/1onhoxt/my_companys_new_ai_payroll_bot_decided_i_dont/nmwtt7k/", "created_utc": 1762190652, "score": 9529, "ups": 9529, "downs": 0, "depth": 0, "is_submitter": false, "stickied": false, "distinguished": null, "edited": null, "replies": "", "link_title": "My company’s new AI payroll bot decided I don’t deserve a paycheck this month", "link_permalink": "/r/antiwork/comments/1onhoxt/my_companys_new_ai_payroll_bot_decided_i_dont/", "link_num_comments": 575, "…": "2 more fields" } }, { "kind": "t1", "data": { "id": "orzferw", "name": "t1_orzferw", "author": "UncleHec", "author_fullname": null, "body": "> Pipkin did a demonstration of the bulbs' integrity to his supervisor at General Electric. He presented to his supervis…", "body_html": "<div class=\"md\"><blockquote>\n <p>\n Pipkin did a demonstration of the bulbs' integrity to his supervisor at Gen…", "parent_id": "t1_orz8sgh", "link_id": "t3_1u7ct5a", "subreddit": "todayilearned", "subreddit_id": "t5_2qqjc", "permalink": "/r/todayilearned/comments/1u7ct5a/til_marvin_pipkin_as_a_new_ge_recruit_solved_the/orzferw/", "created_utc": 1781617310, "score": 8844, "ups": 8844, "downs": 0, "depth": 1, "is_submitter": false, "stickied": false, "distinguished": null, "edited": null, "replies": "", "link_title": "TIL Marvin Pipkin, as a new GE recruit, solved the \"impossible\" task of making an inside-frosted lightbulb—a job handed …", "link_permalink": "/r/todayilearned/comments/1u7ct5a/til_marvin_pipkin_as_a_new_ge_recruit_solved_the/", "link_num_comments": 686, "…": "2 more fields" } }, "… 23 more" ] }}Parameters
| Name | Type | Description |
|---|---|---|
qquery · required | string | Search query. Example: typescript generics. |
subredditquery | string | Only this subreddit. Example: typescript. |
sortquery | "relevance" | "new" | "top" | relevance (default), new or top. One of relevance, new, top. |
tquery | "hour" | "day" | "week" | "month" | "year" | "all" | Time window for top and controversial. Default day. One of hour, day, week, month, year, all. |
limitquery | integer | Items per page, 1 to 100. Default 25. |
afterquery | string | Cursor: the previous page's data.after. Omit for the first page. |
Response fields
200 with a SearchCommentListing, in Reddit’s own Things and Listings.
| Field | Type | Description |
|---|---|---|
kind | "Listing" | |
data | object |
Status codes
| Status | Meaning |
|---|---|
200 | Matching comments. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The subreddit, post or user does not exist. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Reddit is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
Do Reddit search operators work?
Yes: author:, subreddit: and quoted phrases go in q as on reddit.com.
Reddit is a trademark of Reddit, Inc. We are not affiliated with or endorsed by Reddit.