RedditapisRedditapis
Listings & Search

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.

GET/api/reddit/search$0.002 / call

Search 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.

EndpointReturnsUse it when
/api/reddit/search (this page)PostsYou want posts, optionally restricted to one subreddit with subreddit=
/api/reddit/search/mediaPosts with mediaYou only want image, video, or gallery posts and you want the media_url
/api/reddit/search/communitiesSubredditsYou are looking for a place, not a post
/api/reddit/search/usersAccountsYou 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

ParameterTypeRequiredDescription
qstringYesSearch query
subredditstringNoRestrict to a subreddit
sortstringNorelevance | 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.
tstringNohour | day | week | month | year | all. An unrecognised value returns 400.
nsfwbooleanNotrue to include NSFW (Safe Search off)
limitnumberNoNumber of posts to return, 1-100 (default 25)
afterstringNoPagination cursor. Pass back the after value from the previous response exactly as issued; it is opaque and carries your paging depth. See Pagination depth.
min_scorenumberNoKeep only posts with score >= this. Applied to the returned page (see Advanced filters).
max_scorenumberNoKeep only posts with score <= this.
min_commentsnumberNoKeep only posts with comment count >= this.
max_commentsnumberNoKeep only posts with comment count <= this.
is_videobooleanNotrue = only video posts, false = only non-video.
is_selfbooleanNotrue = only self/text posts, false = only link posts.
over_18booleanNoFilter the page by the NSFW flag. Distinct from nsfw, which controls whether NSFW posts are included in the search at all.
lockedbooleanNoFilter by the locked flag.
stickiedbooleanNoFilter by the stickied flag.
spoilerbooleanNoFilter by the spoiler flag.
contest_modebooleanNoFilter by the contest_mode flag.
sort_typestringNoRe-sort the filtered page (descending): score | num_comments | created.

Advanced filters

Reddit's search cannot filter on score, comment count, media type, or post flags server-side, so those filters are applied to the page the search returns (the same model as pullpush). A filter can therefore return far fewer than limit results per page, so when any filter is passed the response adds a meta object with completeness counts and you paginate with after for more:

"meta": { "fetched": 25, "returned": 3, "filtered_out": 22, "filters": { "min_score": 500 } }

fetched is how many the page held, returned how many passed your filters, filtered_out the difference. When no filter is passed the response keeps the plain { posts, after } shape.

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.).

When after comes back empty

An empty cursor means there is no next page to ask for. It does not always mean you have every post: Reddit often stops serving a busy listing long before it runs out. Paging r/all on 2026-08-14 stopped after 400 posts covering about a minute of a feed that plainly holds more.

The response tells you which happened. When after is null it also carries listing_status, which reads complete, truncated or unknown. Only complete means you have everything; treat the other two as a partial answer and widen your search rather than stopping. The full field list and what to do about each answer is in Pagination depth.

Independent third-party API for developers and researchers. Not affiliated with, endorsed by, or sponsored by Reddit, Inc.

On this page