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

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/postsposts: [...] + 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.

On this page