Reddit Post Comments API
Returns the comments on a Reddit post, with author, body, score, creation time and the parent comment for each reply. It needs the full URL of the post as url.
Use cases
- Collect the replies to a popular AMA to study which questions got the most upvotes.
- Rebuild a comment thread as a tree by matching each
parentId to a comment id.
- Pull the top-scored comments on a post to summarize what readers think.
- Link each comment back to its page on Reddit using its
url to review or moderate it.
Request
curl -X POST "https://api.sandbase.ai/v1/api/reddit/post-comments" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_united_states/"}'
The result is returned in outputs[0].data.
Parameters
Example response
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"comments": [
{
"author": "Biinaryy",
"body": "Here is a collection of all the questions and answers:\n\nQuestion: [Link](http://…",
"createdUtc": 1346276659,
"id": "c60o0iw",
"parentId": "",
"score": 5399,
"url": "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_…"
}
],
"media": null,
"nextCursor": "cur_E_QuTid3jKG5pjQCweyA_g"
},
"found": true
}
Response fields
Notes
Need to find a thread first? Search posts within one subreddit. Then follow the Python request walkthrough to read a selected thread without assuming complete comment coverage.
- Copy the post URL from Reddit. A gallery link or a relative permalink such as
/r/<subreddit>/comments/<id>/... also works.
- To get more comments, repeat the request with the same
url and the nextCursor value as cursor.
- Comments are listed in a flat array. Use
parentId to see which comment each reply answers.
Pricing
Billed at the actual cost of each call, about $0.0006 for the request above. Failed calls are not charged.