YepAPI
Reddit API

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.

POST/v1/reddit/post-comments
$0.01/call

The 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

ParameterTypeRequiredDescriptionDefault
urlstringYesFull 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)—
sortstringNoOne of: top, new, controversial, old, qatop
cursorstringNocursor 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

FieldTypeDescription
okbooleanWhether the request succeeded
data.commentsobject[]Top-level comments, each with nested replies
data.comments[].idstringComment fullname (t1_…)
data.comments[].authorstringAuthor username
data.comments[].bodystringComment text
data.comments[].scorenumberNet upvotes
data.comments[].depthnumberNesting level, 0 for top-level comments
data.comments[].parent_idstring | nullParent comment, null for top-level comments
data.comments[].permalinkstringFull URL of the comment
data.comments[].created_atstringISO 8601 timestamp
data.comments[].mediaobject[]Images or GIFs in the comment: type, url
data.comments[].repliesobject[]Child comments, same shape (recursive)
data.cursorstring | nullCursor 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

StatusCodeWhen
400VALIDATION_ERRORurl is not a full Reddit post URL, or sort is invalid
429RATE_LIMITED_UPSTREAMToo many requests in a short burst — retry after a few seconds
502UPSTREAM_ERRORTemporary problem fetching data from Reddit — retry

Failed calls are not charged.

On this page