Subreddit Search
Posts in one community matching a query, about 7 a page.
GET
apiKeyheader
AuthorizationBearer <token>An API key from the dashboard: Authorization: Bearer sapi_….
name?stringThe community's name, with or without r/.
url?stringIts link, instead of name.
query*stringWhat to search for.
sort?stringrelevance (the default), hot, top, new or comments.
Value in
"relevance""hot""top""new""comments"time?stringhour, day, week, month, year or all (the default).
Value in
"hour""day""week""month""year""all"cursor?stringnextCursor of the previous page.
maxAge?integerHow old a cached answer may be, in seconds; 0 always fetches. Default and most: the endpoint's cache lifetime.
Format
int64Range
0 <= valueThe answer.
application/json- response
A page of a list, as every list endpoint answers: { "data": [...], "pagination": … }.
data*array<>pagination*import { SocialAPI } from "@socialapihq/sdk";const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });const { data, pagination } = await client.reddit.subredditSearch({ name: "Coffee", query: "espresso" });Example Response
{ "data": [ { "id": "ue7pc", "url": "https://www.reddit.com/r/Coffee/comments/ue7pc/wife_trying_espresso_for_the_first_time/", "text": null, "createdAt": "2012-05-31T18:09:05.636Z", "author": { "id": "4ospk", "username": "snick88", "displayName": null, "avatarUrl": null, "verified": false, "url": "https://www.reddit.com/user/snick88/" }, "stats": { "views": null, "likes": 614, "comments": 107, "shares": null, "saves": null, "engagementRate": null }, "media": [], "hashtags": [], "mentions": [], "ext": { "title": "Wife trying espresso for the first time", "kind": "text", "subreddit": "Coffee", "score": 614, "upvoteRatio": null, "link": null, "domain": null, "flair": null, "nsfw": false, "spoiler": false, "locked": false, "stickied": false, "crossposts": null, "crosspostOf": null, "awards": null, "editedAt": null, "snippet": null } }, { "id": "zft81c", "url": "https://www.reddit.com/r/Coffee/comments/zft81c/unpopular_opinion_espresso_is_overrated_and_it_is/", "text": null, "createdAt": "2022-12-08T08:24:30.471Z", "author": { "id": "a2u1qsx7", "username": "ee_72020", "displayName": null, "avatarUrl": null, "verified": false, "url": "https://www.reddit.com/user/ee_72020/" }, "stats": { "views": null, "likes": 24, "comments": 55, "shares": null, "saves": null, "engagementRate": null }, "media": [], "hashtags": [], "mentions": [], "ext": { "title": "Unpopular opinion: espresso is overrated and it is absolutely the worst way to brew light and medium roasts", "kind": "text", "subreddit": "Coffee", "score": 24, "upvoteRatio": null, "link": null, "domain": null, "flair": null, "nsfw": false, "spoiler": false, "locked": false, "stickied": false, "crossposts": null, "crosspostOf": null, "awards": null, "editedAt": null, "snippet": null } } ], "pagination": { "nextCursor": "L3N2Yy9zaHJlZGRpdC9yL0NvZmZlZS9zZWFyY2gvP3E9ZXNwcmVzc28mdHlwZT1wb3N0cyZzb3J0PXJlbGV2YW5jZSZ0PWFsbCZjdXJzb3I9ZXlKallXNWthV1JoZEdWelgzSmxkSFZ5Ym1Wa0lqb2llMXdpYzJWamRHbHZibDh4WDNCcGNHVnNhVzVsWHpCZloyeHZZbUZzWDIxdlpHbG1hV1Z5YzF3aU9sd2lNVndpTEZ3aWMyVmpkR2x2Ymw4eFgzQnBjR1ZzYVc1bFh6RmZiRzlqWVd4ZmJXOWthV1pwWlhKelhDSTZYQ0l5WENJc1hDSnpaV04wYVc5dVh6SmZjR2x3Wld4cGJtVmZOMTl6WTI5d1pWOXpkMmwwWTJobGNsd2lPbHdpTUZ3…", "hasMore": true }}