Skip to content
redditdataapi.io
AI & RAG Pipelines · Tutorial6 min read·Updated 2026-11-04

Scraping Nested Reddit Comment Trees for LLM & RAG Pipelines

How to extract full multi-level Reddit discussion threads with explicit depth and parent_id pointers for AI sentiment analysis, RAG knowledge bases, and fine-tuning datasets.

$0.10 / 1K Posts · $0.10 / 1K Comments · $0.20 / 1K Lookups · No OAuth Needed

Instant Quickstart · Copy & Run in 30 Seconds

Fetch nested comments for a post

Execute in Live Playground →
import requests

res = requests.get(
    "https://api.redditdataapi.io/v1/posts/comments",
    params={"post_id": "1xmjld9", "sort": "top", "limit": 100},
    headers={"x-api-key": "rd_live_your_api_key"},
)
comments = res.json()["data"]["items"]

Key Engineering Takeaways (TL;DR)

  • ✓GET /v1/posts/comments extracts up to 200 comments per call with depth (0, 1, 2...) and parent_id (t3_... or t1_...).
  • ✓Supports sorting by top, best, new, controversial, or old, plus offset cursor pagination for mega-threads.
  • ✓Costs 1 Credit per returned comment ($0.10 per 1,000 comments base rate, or $0.0575 per 1,000 on Pro).

1. Reconstructing Parent-Child Comment Threads

Every comment item includes comment_id (t1_...), parent_id, and integer depth so you can reconstruct the exact conversation tree or chunk threads for embeddings.

Fetch nested comments for a post

Pass either a bare post_id (1xmjld9), t3_1xmjld9, or full reddit.com URL.

curl "https://api.redditdataapi.io/v1/posts/comments?post_id=1xmjld9&sort=top&limit=100" \
  -H "x-api-key: rd_live_your_api_key"

Interactive Engineering Workbench · GET /v1/posts/comments

Verify real-time latency, pagination math & JSON schema

5,000 posts/day
10,000 comments/day
1,000 lookups/day
Our HTTP Calls/Day
1,100
Large page sizes
Legacy Provider Calls
1,400
30-item small pages
Official Research API
Exceeds 1K Cap
1,000 req/day limit
Estimated Monthly Pipeline Cost (30 Days)
$30.91/ mo with Business bonus ($51.00 base rate)
Daily consumption: 17,000 Credits ($1.70/day)
RedditDataAPI.io (with volume bonus):$30.91 / mo
Legacy Scrapers ($1.50 / 1K calls):$63.00 / mo
Failed / 404 request fee:$0.00 (0 Credits)

Frequently Asked Questions

Can I pass a full Reddit post URL to /v1/posts/comments?
Yes. Both ?post_id=1xmjld9 and ?url=https://www.reddit.com/r/saas/comments/1xmjld9/... are automatically normalized by the gateway.