Reddit API
Reddit

Search Posts

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

Search posts globally or restrict to a subreddit. Mirrors the "Posts" tab on reddit.com search.

Query Parameters

ParameterTypeRequiredDescription
qstringYesSearch query
subredditstringNoRestrict to a subreddit
sortstringNorelevance | new | hot | top | comments
tstringNohour | day | week | month | year | all
nsfwbooleanNotrue to include NSFW (Safe Search off)
afterstringNoPagination cursor

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"},
)

On this page