RedditapisRedditapis
Posts

Get Every Reddit Comment, Including Collapsed Replies

Read a Reddit thread with its "load more comments" and "continue this thread" replies expanded, as JSON, in one call.

GET/api/reddit/post/{id}/comments/expanded$0.02 / call

The comment tree of a post with Reddit's collapsed replies read in.

Reddit never sends a big thread whole. Where it stops, it leaves a kind: "more" stub in the tree: "load more comments" (a list of the hidden comment ids) or "continue this thread" (a branch cut at Reddit's depth limit). /api/reddit/post/{id}/comments returns the tree as Reddit sent it, stubs included. This endpoint reads those stubs and puts the comments back where the stubs were.

Measured on a 3,117-comment thread: one read of the tree returned 3 comments and a stub hiding 2,864. Each expansion read here brings in up to 100 of those.

Path Parameters

ParameterTypeRequiredDescription
idstringYesReddit post id (e.g. 1sgjld3). A t3_ prefix is optional.

Query Parameters

ParameterTypeRequiredDescription
limitnumberNoTop-level comments in the first read, 1-500 (default 100)
sortstringNoconfidence, top, new, controversial, old or qa, applied to the thread and to every expansion read
max_expansionsnumberNoMost expansion reads this call may make, 1-9 (default 9). Each reads up to 100 hidden comments or one "continue this thread" branch.

depth is not accepted here: a depth cap asks Reddit to collapse branches, which is the opposite of this endpoint. Use /api/reddit/post/{id}/comments for a depth-capped tree.

Example

curl -H "Authorization: Bearer $TOKEN" \
  "https://api.redditapis.com/api/reddit/post/1sgjld3/comments/expanded?sort=top"
const response = await fetch(
  "https://api.redditapis.com/api/reddit/post/1sgjld3/comments/expanded?sort=top",
  { headers: { Authorization: "Bearer TOKEN" } }
);
const { post, comments, expansion } = await response.json();
import requests

response = requests.get(
    "https://api.redditapis.com/api/reddit/post/1sgjld3/comments/expanded",
    params={"sort": "top"},
    headers={"Authorization": "Bearer TOKEN"},
)
data = response.json()

Response Shape

{
  "post": { "...": "same shape as /api/reddit/post/{id}" },
  "comments": [
    { "kind": "t1", "data": { "...": "Reddit's comment, with replies nested as Reddit nests them" } }
  ],
  "meta": { "limit_used": 100, "depth_used": null, "sort_used": "top", "max_expansions": 9 },
  "expansion": {
    "upstream_calls": 9,
    "max_expansions": 9,
    "stubs_expanded": 4,
    "comments_added": 812,
    "remaining_more_stubs": 1,
    "remaining_more_comments": 2052,
    "complete": false,
    "stopped_reason": "call_cap"
  },
  "after": null,
  "listing_status": "truncated"
}

comments has the same tree shape as /api/reddit/post/{id}/comments, so code that walks that tree walks this one. A stub this call did not reach stays where it was, so kind: "more" still means "there is more here".

expansion fieldMeaning
completetrue when no more stub is left in the tree
remaining_more_commentsHow many comments the stubs still left in the tree hide, by Reddit's own count
stopped_reasoncall_cap (the call used all of max_expansions), upstream_error (an expansion read failed), budget (the call's time budget ran low, so no further read was started), unreadable_stub (the stubs left carry no ids Reddit can expand) or null when complete

A thread larger than one call can expand still comes back usable and says how much is left. The completeness fields (listing_status, exhausted_reason) read the same way as on the comment tree page.

Errors

StatusWhen
400The id is not a valid post id, depth was sent, sort is not one of the listed values, or limit or max_expansions is out of range
404No post with that id exists
429EXPANDED_COMMENTS_CONCURRENCY: your account already has 2 expanded reads running; a third waits up to 3 seconds, then gets this with Retry-After: 2. Not billed. See Rate limits

Price

A flat $0.02 per call: the thread read plus up to 9 expansion reads, the same per-read basis as deep comment search. If an expansion read fails, or the call runs low on time, you get the partial tree with stopped_reason: "upstream_error" or "budget" and the call is not billed. A tree left with unreadable_stub is billed, because every read the call could make was made. For a thread with no stubs, /api/reddit/post/{id}/comments returns the same tree at the standard read price, so check that first when you do not know the thread's size.

Independent third-party API for developers and researchers. Not affiliated with, endorsed by, or sponsored by Reddit, Inc.

On this page