Reddit full comment tree API
A post with its whole discussion: Reddit’s collapsed replies (“load more”, “continue this thread”) are read back into the tree, up to nine expansion reads in one call.
GET /v1/reddit/posts/{id}/thread5 credits per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/reddit/posts/1y1u285/thread?limit=200",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 5 credits{ "post": { "kind": "t3", "data": { "id": "1y1u285", "name": "t3_1y1u285", "title": "GTA 6's No-Nonsense Cops Are Scaring Players Into Actually Following the Law", "author": "tylerthe-theatre", "author_fullname": "t2_7ts4nnm5", "subreddit": "technology", "subreddit_name_prefixed": "r/technology", "subreddit_id": "t5_2qh16", "permalink": "/r/technology/comments/1y1u285/gta_6s_nononsense_cops_are_scaring_players_into/", "url": "https://www.ign.com/articles/gta-6-new-wanted-system-difficulty?utm_source=bluesky,threads,twitter", "domain": "ign.com", "created_utc": 1795257372, "score": 22161, "upvote_ratio": 0.895505617977528, "ups": 22161, "downs": 0, "num_comments": 1811, "selftext": "", "selftext_html": null, "is_self": false, "over_18": false, "spoiler": false, "stickied": false, "locked": false, "…": "9 more fields" } }, "comments": { "kind": "Listing", "data": { "after": null, "before": null, "dist": 54, "modhash": null, "geo_filter": "", "children": [ { "kind": "t1", "data": { "id": "19syvmhzo9sxu", "name": "t1_19syvmhzo9sxu", "author": "ihateslowdrivers", "author_fullname": null, "body": "I saw two cop cars pulled over attempting to arrest a guy dancing on the hood of one of the cop cars. I whipped out my p…", "body_html": "<div class=\"md\"><p>\n I saw two cop cars pulled over attempting to arrest a guy dancing on the hood of one of the co…", "parent_id": "t3_1y1u285", "link_id": "t3_1y1u285", "subreddit": "technology", "subreddit_id": "t5_2qh16", "permalink": "/r/technology/comments/1y1u285/comment/19syvmhzo9sxu/", "created_utc": 1795260970, "score": 8121, "ups": 8121, "downs": 0, "depth": 0, "is_submitter": false, "stickied": false, "distinguished": null, "edited": null, "replies": { "…": "2 fields" } } }, { "kind": "t1", "data": { "id": "19sytr7089ltw", "name": "t1_19sytr7089ltw", "author": "JohnGalactusX", "author_fullname": null, "body": "One of the first GTA games where I've actually felt compelled to follow traffic rules lol", "body_html": "<div class=\"md\"><p>\n One of the first GTA games where I've actually felt compelled to follow traffic rules lol\n …", "parent_id": "t3_1y1u285", "link_id": "t3_1y1u285", "subreddit": "technology", "subreddit_id": "t5_2qh16", "permalink": "/r/technology/comments/1y1u285/comment/19sytr7089ltw/", "created_utc": 1795258455, "score": 12969, "ups": 12969, "downs": 0, "depth": 0, "is_submitter": false, "stickied": false, "distinguished": null, "edited": null, "replies": { "…": "2 fields" } } }, "… 52 more" ] } }, "expansion": { "expansions": 4, "remaining": 70, "complete": false }}Parameters
| Name | Type | Description |
|---|---|---|
idpath · required | string | A post id (1y1u285), fullname (t3_1y1u285) or post URL. Example: 1y1u285. |
sortquery | "confidence" | "top" | "new" | "controversial" | "old" | "qa" | Comment order. Default confidence. One of confidence, top, new, controversial, old, qa. |
limitquery | integer | Comments on the first read, 1 to 500. Default 100. |
max_expansionsquery | integer | Expansion reads, 1 to 9. Default 9. |
Response fields
200 with a ExpandedThread, in Reddit’s own Things and Listings.
| Field | Type | Description |
|---|---|---|
post | Link | |
comments | CommentTree | |
expansion | object |
Status codes
| Status | Meaning |
|---|---|
200 | The post and its expanded comment tree. |
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
Reddit is a trademark of Reddit, Inc. We are not affiliated with or endorsed by Reddit.