Reddit APIreddit.com ↗
Access Reddit posts, full comment threads, and subreddit search results. Retrieve scores, authors, depth-aware threading, and feed categories via 3 endpoints.
What is the Reddit API?
The Reddit API provides 3 endpoints that cover subreddit feeds, full comment trees, and keyword search across any subreddit. The get_post_comments endpoint returns a flattened comment array with depth indicators, parent_id for thread reconstruction, score, author, and body — everything needed to reproduce a discussion thread. The search_posts and list_posts endpoints expose post metadata including upvote_ratio, flair, and cursor-based pagination.
curl -X GET 'https://api.parse.bot/scraper/5c1e1643-5ce6-4086-9883-3886b0c0e506/get_post_comments?sort=top&limit=50&post_id=1u2lifp&subreddit=AskReddit' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace reddit-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: Reddit Subreddit Scraper — browse feeds, search, and drill into comments."""
from parse_apis.reddit_subreddit_scraper import (
Reddit, Category, TimeFilter, SearchSort, CommentSort, SubredditNotFound
)
client = Reddit()
# Browse top posts from a subreddit this year, capped at 5 items.
for post in client.subreddit("smallbusiness").list(category=Category.TOP, time_filter=TimeFilter.YEAR, limit=5):
print(post.title, post.score, post.num_comments)
# Search a subreddit for posts matching a keyword.
result = client.subreddit("AskReddit").search(query="career advice", sort=SearchSort.RELEVANCE, limit=1).first()
if result:
print(result.title, result.author, result.score)
# Drill into a post's full comment tree.
if result:
detail = result.comments()
print(detail.total_comments_fetched, detail.more_comments_available)
for comment in detail.comments[:3]:
print(comment.author, comment.score, comment.body[:80])
# Typed error handling for a non-existent subreddit.
try:
for post in client.subreddit("thissubredditdoesnotexist999").list(category=Category.HOT, limit=1):
print(post.title)
except SubredditNotFound as exc:
print(f"Subreddit not found: {exc.subreddit}")
print("exercised: subreddit.list / subreddit.search / post.comments / SubredditNotFound")
Retrieve a Reddit post and its full comment tree, flattened with depth indicators. Comments are sorted server-side; each carries score, author, body, and parent_id for threading reconstruction. The limit caps top-level comments fetched; nested replies within those top-level threads are always included. Returns the post metadata alongside the comment array.
| Param | Type | Description |
|---|---|---|
| sort | string | Comment sort order |
| limit | integer | Max number of top-level comments to fetch (up to 500) |
| post_idrequired | string | Reddit post ID (the alphanumeric code from the URL, e.g. '198xzca') |
| subredditrequired | string | Subreddit name (without r/ prefix) |
{
"type": "object",
"fields": {
"post": "object with id, title, author, selftext, score, upvote_ratio, num_comments, created_utc, url, permalink, subreddit, link_flair_text, is_self",
"comments": "array of comment objects with id, author, body, score, created_utc, depth, parent_id, permalink, is_submitter",
"total_comments_fetched": "integer count of comments returned",
"more_comments_available": "integer count of additional comments not fetched"
}
}About the Reddit API
Endpoints and Data Shape
The list_posts endpoint fetches a subreddit feed by category: hot, new, top, or rising. Each post object includes id, title, author, selftext, score, upvote_ratio, num_comments, created_utc, url, permalink, and link_flair_text. The time_filter parameter (hour, day, week, month, year, all) applies only when category is top. Both list_posts and search_posts return an after cursor for paginating through results up to 100 posts per page.
Searching Within a Subreddit
search_posts runs a full-text query against post titles and body text within a named subreddit. Required inputs are query and subreddit (without the r/ prefix). Optional inputs include sort, time_filter, limit (max 100), and the after pagination cursor. The response echoes back the query and subreddit used, along with a count and the posts array. This makes it straightforward to page through all matching posts by chaining after values.
Comment Thread Retrieval
get_post_comments takes a post_id (the alphanumeric code from a Reddit URL, e.g. 198xzca) and a subreddit name. Comments are returned as a flat array sorted server-side according to the sort parameter (confidence, top, new, controversial, old, qa). Each comment carries depth and parent_id so you can reconstruct the original tree structure client-side. The is_submitter flag identifies the original poster's replies. The response also returns more_comments_available — a count of comments that exist beyond the limit cap (max 500 top-level comments).
The Reddit API is a managed, monitored endpoint for reddit.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when reddit.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official reddit.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Aggregate community sentiment on a topic by collecting
scoreandbodyfrom comment threads in relevant subreddits - Monitor a subreddit's
newfeed for posts mentioning specific keywords usingsearch_postswith time-based filtering - Reconstruct threaded discussions offline by using
depthandparent_idfromget_post_comments - Track trending content by comparing
scoreandupvote_ratioacross posts from thehotandrisingfeeds - Identify active contributors in a subreddit by collecting
authorfields across multiple posts and comments - Surface posts with specific
link_flair_textvalues from a subreddit feed for category-based content filtering - Build a time-series of community activity by paginating
topposts with differenttime_filterwindows
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Reddit have an official developer API?+
What does `get_post_comments` return for deeply nested threads?+
depth integer (0 for top-level, 1 for direct replies, and so on) and a parent_id that points to the parent comment or post. You reconstruct hierarchy client-side. The more_comments_available field tells you how many additional comments exist beyond the limit cap.Does `search_posts` search across multiple subreddits at once?+
search_posts endpoint requires a single subreddit parameter and searches within that subreddit only. You can fork the API on Parse and revise it to add a cross-subreddit or site-wide search endpoint.