Reddit Post API
Returns one Reddit post as JSON, including its title, full body text, author, score, comment count, upvote ratio, and subreddit. It needs a single Reddit post url on reddit.com.
Use cases
- Archive the text and score of a specific Reddit thread for a research dataset.
- Check how well a linked post performed by reading its
score, numComments, and upvoteRatio.
- Flag NSFW or locked posts before showing them in a content feed.
- Resolve a post URL to its
id, subreddit, and author for later lookups.
Request
curl -X POST "https://api.sandbase.ai/v1/api/reddit/post" \
-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": {
"author": "PresidentObama",
"authorId": "8t1cq",
"body": "Hi, I’m Barack Obama, President of the United States. Ask me anything. I’ll be t…",
"createdUtc": 1346270496,
"domain": "self.IAmA",
"editedUtc": 1346276503,
"id": "z1c9z",
"image": "https://external-preview.redd.it/KftOKw5o_G5ug7ENkLFbplFDpcApH0MvkQoOQD4nKng.jpg…",
"isArchived": true,
"isLocked": false,
"isNsfw": false,
"numComments": 22716
},
"found": true
}
Response fields
Notes
- Send the post link in
url. The /r/<subreddit>/comments/<id>/, /user/<name>/comments/<id>/, /comments/<id>/ and /gallery/<id> forms are accepted. Share links and links to other sites are refused as invalid input.
- The post
id is the short code in the URL, such as z1c9z.
- To read the replies to a post, call Reddit Post Comments.
- To list more posts from the same community, call Reddit Subreddit Posts.
Pricing
Billed at the actual cost of each call, about $0.0005 for the request above. Failed calls are not charged.