Search Reddit Posts Globally or by Subreddit
Search Reddit posts globally or restrict to a subreddit — mirrors the Posts tab on reddit.com search. Supports sort, timeframe, NSFW filter, and pagination.
/api/reddit/search$0.002 / callSearch posts globally or restrict to a subreddit. Mirrors the "Posts" tab on reddit.com search.
Choosing a search endpoint
Reddit splits search across tabs, and so do we. Each endpoint returns a different object, so pick by what you want back rather than by what you are searching for.
| Endpoint | Returns | Use it when |
|---|---|---|
/api/reddit/search (this page) | Posts | You want posts, optionally restricted to one subreddit with subreddit= |
/api/reddit/search/media | Posts with media | You only want image, video, or gallery posts and you want the media_url |
/api/reddit/search/communities | Subreddits | You are looking for a place, not a post |
/api/reddit/search/users | Accounts | You have a name and need the account behind it |
Only this endpoint takes a subreddit parameter. The others search site-wide.
To confine a media search to one subreddit, put Reddit's subreddit: operator in
the query instead, as shown on the
Search Media page.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Yes | Search query |
subreddit | string | No | Restrict to a subreddit |
sort | string | No | relevance | new | hot | top | comments. Defaults to relevance when omitted, matching Reddit's own default. Pass sort=new explicitly for a reverse-chronological feed. An unrecognised value returns 400. |
t | string | No | hour | day | week | month | year | all. An unrecognised value returns 400. |
nsfw | boolean | No | true to include NSFW (Safe Search off) |
limit | number | No | Number of posts to return, 1-100 (default 25) |
after | string | No | Pagination cursor |
Sort and freshness
sort=relevance (and sort=top) blend text match with a post's score, so on a broad or long-lived query the highest-upvoted posts can outrank the closest matches. The t time window bounds which posts are eligible and it does apply to relevance on search. When you omit t, Reddit defaults to all, which lets old viral posts surface. Pass a bounded window such as t=week or t=month to keep a relevance search recent and on-topic, or use sort=new for a strict reverse-chronological feed.
Example
curl -H "Authorization: Bearer $TOKEN" \
"https://api.redditapis.com/api/reddit/search?q=twitter+api+alternative&sort=relevance&t=all"const response = await fetch(
"https://api.redditapis.com/api/reddit/search?q=twitter+api+alternative&sort=relevance&t=all",
{ headers: { Authorization: "Bearer TOKEN" } }
);import requests
response = requests.get(
"https://api.redditapis.com/api/reddit/search",
params={"q": "twitter api alternative", "sort": "relevance", "t": "all"},
headers={"Authorization": "Bearer TOKEN"},
)Response Shape
Same shape as /api/reddit/posts — posts: [...] + after cursor. See that page for the per-post field reference (upvotes, comments, link_url, is_crosspost, crosspost_origin, etc.).
Independent third-party API for developers and researchers. Not affiliated with, endorsed by, or sponsored by Reddit, Inc.
Subreddit Posts
Fetch posts from any subreddit via a simple HTTP GET. Supports all Reddit sort tabs — New, Hot, Top, Rising, Controversial, Best — plus timeframe, cursor.
Top Posts
Get the top posts in any subreddit for a timeframe — day, week, month, year, or all-time. Alias for /api/reddit/posts with sort=top, with cursor pagination.
