Integration Guide
How to Get All Comments from a Reddit Post (Complete Thread)
Reddit's API truncates comment trees. Here's how to get the full thread from any post — with code examples and method comparison.
- reddit comments
- reddit API
- comment tree
- reddit scraping
- full thread
Getting all comments from a Reddit post sounds simple. It’s not.
Reddit’s own API and JSON endpoints truncate comment trees by design. Deeply nested replies are replaced with "more" stubs — placeholder objects that say “there are more comments here, make another request to fetch them.” A popular post with 500 comments might return 50 top-level comments on the first call, with dozens of "more" stubs hiding the rest.
If you need the full comment thread — for analysis, archiving, sentiment analysis, or feeding into an AI — here’s how to actually do it.
Why Reddit Truncates Comments
Reddit’s comment rendering uses a tree structure. When a thread is long or deeply nested, the API returns a partial tree with "kind": "more" nodes. Each "more" node contains a list of comment IDs that weren’t included.
To get those missing comments, you need to:
- Parse the response to find all
"more"stubs - Extract the comment IDs from each stub
- Call
/api/morechildrenfor each batch (max 100 IDs per request) - Merge the results back into the tree
- Repeat if the newly fetched comments contain their own
"more"stubs
This is tedious, slow (each call eats into your rate limit), and easy to get wrong. A 1,000-comment thread can require 10+ API calls just for the comments.
Method 1: Reddit’s JSON Endpoint (Incomplete)
Append .json to any Reddit post URL:
const res = await fetch(
'https://www.reddit.com/r/AskReddit/comments/abc123/whats_your_opinion.json',
{ headers: { 'User-Agent': 'MyApp/1.0' } }
);
const [postData, commentData] = await res.json();
// Top-level comments (many will be missing)
const comments = commentData.data.children;
// Check for truncation
const moreStubs = comments.filter(c => c.kind === 'more');
console.log(`Got ${comments.length} items, ${moreStubs.length} "more" stubs hiding additional comments`);
Problems:
- Only returns the first ~200 comments (Reddit’s default)
- Nested replies beyond 2-3 levels are replaced with
"more"stubs - No built-in way to expand stubs without OAuth
- Rate limited to 10 req/min without auth
Method 2: PRAW’s replace_more() (Python Only)
PRAW has a replace_more() method that automates the stub expansion:
import praw
reddit = praw.Reddit(client_id="...", client_secret="...", user_agent="...")
submission = reddit.submission(url="https://www.reddit.com/r/AskReddit/comments/abc123/")
submission.comments.replace_more(limit=None) # Expand all stubs
all_comments = submission.comments.list()
print(f"Total comments: {len(all_comments)}")
Catches:
replace_more(limit=None)makes one API call per stub — a 1,000-comment thread can trigger 10-20 extra requests- Each call counts against your 100 req/min rate limit
- Python-only
- Requires Reddit OAuth credentials
- Can take minutes on large threads
- Non-commercial use only on the free tier
Method 3: FetchLayer API (Full Tree, One Call)
FetchLayer returns the complete comment tree in a single request — no stubs, no extra calls:
const res = await fetch('https://fetchlayer.dev/api/reddit/post', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk-your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.reddit.com/r/AskReddit/comments/abc123/whats_your_opinion/'
})
});
const data = await res.json();
console.log(data.title);
console.log(`${data.comments.length} comments (full tree)`);
// Each comment has: author, body, score, timestamp, and nested replies
for (const comment of data.comments) {
console.log(`${comment.author}: ${comment.body.slice(0, 80)}...`);
if (comment.replies?.length) {
console.log(` └─ ${comment.replies.length} replies`);
}
}
What’s different:
- Returns the full comment tree, not a truncated version
- No
"more"stubs to expand - One API call regardless of thread size
- Works from any language (JavaScript, Python, Go, etc.)
- No Reddit credentials needed
Best for: Any use case where you need complete comment data — sentiment analysis, content research, AI training, archiving.
Method Comparison
| Reddit JSON | PRAW | FetchLayer | |
|---|---|---|---|
| Full comment tree | No (truncated) | Yes (slow, multi-call) | Yes (single call) |
| Language | Any | Python only | Any |
| Auth required | No (limited) / OAuth | Reddit OAuth | API key |
| Rate limit impact | 1+ calls per thread | 10-20+ calls per large thread | 1 call per thread |
| Commercial use | No (free tier) | ~$12K/yr | Free tier + pay-per-use |
Getting a Specific Comment by Permalink
If you need a single comment and its parent context (not the whole thread), use the comment-permalink endpoint:
const res = await fetch('https://fetchlayer.dev/api/reddit/comment-permalink', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk-your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.reddit.com/r/webdev/comments/abc123/post_title/def456/'
})
});
const comment = await res.json();
console.log(comment.author, comment.body, comment.score);
Use Case: Feeding Comments into an AI
If you’re using an AI coding tool (Cursor, Claude Desktop, VS Code), you can skip the API code entirely. FetchLayer’s MCP server lets your AI agent fetch comment threads directly:
"Scrape all comments from this Reddit post and summarize the main opinions"
The agent calls the scrape_post tool, gets the full comment tree, and processes it inline.