Reddit Comments API
Reddit Comments API and comment scraper — get the full nested comment tree for any Reddit post, sorted by top, new, controversial, old, or Q&A. JSON, $0.01 per call.
/v1/reddit/post-commentsThe Reddit Comments API returns the comments on a post as a nested tree: each comment has its depth and a replies array with its children. It's a ready-made Reddit comment scraper — sentiment analysis, summarizing threads with an LLM, or mining feedback — with no HTML parsing or Reddit app needed.
Get post URLs from Subreddit Posts, Reddit Search, or the permalink of any post.
Usage
const res = await fetch('https://api.yepapi.com/v1/reddit/post-comments', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({"url": "https://www.reddit.com/r/Python/comments/1xennpj/sunday_daily_thread_whats_everyone_working_on/", "sort": "top"}),
});
const { data } = await res.json();
console.log(data);curl -X POST https://api.yepapi.com/v1/reddit/post-comments \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.reddit.com/r/Python/comments/1xennpj/sunday_daily_thread_whats_everyone_working_on/", "sort": "top"}'import requests
res = requests.post(
"https://api.yepapi.com/v1/reddit/post-comments",
headers={"x-api-key": "YOUR_API_KEY"},
json={"url": "https://www.reddit.com/r/Python/comments/1xennpj/sunday_daily_thread_whats_everyone_working_on/", "sort": "top"},
)
print(res.json()["data"])To flatten the tree in Python:
def walk(comments):
for c in comments:
yield c
yield from walk(c["replies"])
flat = list(walk(res.json()["data"]["comments"]))Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
url | string | Yes | Full Reddit post URL, e.g. https://www.reddit.com/r/Python/comments/1xennpj/post_title/ (old.reddit.com works; redd.it short links do not) | — |
sort | string | No | One of: top, new, controversial, old, qa | top |
cursor | string | No | cursor from the previous response, to fetch the next page | — |
Response
{
"ok": true,
"data": {
"comments": [
{
"author": "Traditional_Yogurt",
"body": "Over the last four months, the Finance Toolkit has gained portfolio optimization, ETF analysis, yield curve models and a full econometrics module. I've shared this project before, 3 years ago by now: …",
"created_at": "2026-10-29T15:12:24.136000+0000",
"depth": 0,
"id": "t1_19ru410esvg9s",
"media": [
{
"type": "image",
"url": "https://preview.redd.it/ry41q3q3afyh1.jpg?vthumb=1&s=31f3fcdfd88b4d5167113dcfe67357dbbf11480a"
},
{
"type": "image",
"url": "https://preview.redd.it/ry41q3q3afyh1.jpg?vthumb=1&s=31f3fcdfd88b4d5167113dcfe67357dbbf11480a"
}
],
"parent_id": null,
"permalink": "https://www.reddit.com/r/Python/comments/1xennpj/comment/19ru410esvg9s/",
"replies": [],
"score": 1
},
{
"author": "marshlw",
"body": "VisTest: visual regression testing for pytest + Playwright.\nPlaywright for JS has toHaveScreenshot(); Python has nothing built in, so teams end up with pixel diffs that either fail on every font rende…",
"created_at": "2026-10-29T14:54:00.304000+0000",
"depth": 0,
"id": "t1_19ru37gyj3uhu",
"media": [],
"parent_id": null,
"permalink": "https://www.reddit.com/r/Python/comments/1xennpj/comment/19ru37gyj3uhu/",
"replies": [],
"score": 0
}
],
"cursor": null
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data.comments | object[] | Top-level comments, each with nested replies |
data.comments[].id | string | Comment fullname (t1_…) |
data.comments[].author | string | Author username |
data.comments[].body | string | Comment text |
data.comments[].score | number | Net upvotes |
data.comments[].depth | number | Nesting level, 0 for top-level comments |
data.comments[].parent_id | string | null | Parent comment, null for top-level comments |
data.comments[].permalink | string | Full URL of the comment |
data.comments[].created_at | string | ISO 8601 timestamp |
data.comments[].media | object[] | Images or GIFs in the comment: type, url |
data.comments[].replies | object[] | Child comments, same shape (recursive) |
data.cursor | string | null | Cursor for more comments, null when the whole tree was returned |
Pagination
Each response includes a cursor. Send the same request again with that value in cursor to get the next page. When cursor is null, there are no more results. A post with no comments returns 200 with an empty list and cursor: null. Every page is a separate $0.01 call.
Caching
Responses are cached for 15 minutes.
Errors
| Status | Code | When |
|---|---|---|
400 | VALIDATION_ERROR | url is not a full Reddit post URL, or sort is invalid |
429 | RATE_LIMITED_UPSTREAM | Too many requests in a short burst — retry after a few seconds |
502 | UPSTREAM_ERROR | Temporary problem fetching data from Reddit — retry |
Failed calls are not charged.
Related Endpoints
- Reddit Post API — the post itself
- Subreddit Comments — latest comments across a subreddit
- Reddit User Comments API — comments by one account
Reddit Post API
Reddit Post API — get one Reddit post by URL with title, body, author, score, upvote ratio, comment count, images, and video. JSON, $0.01 per call.
Reddit User API
Reddit User API — get a Reddit profile with karma breakdown, account age, avatar, bio, and verification flags. JSON, $0.01 per call.