Skip to Content

Subreddit

A community with its members, rules and weekly visitors.

GET
/v1/reddit/subreddit

Authorization

apiKey
headerAuthorizationBearer <token>

An API key from the dashboard: Authorization: Bearer sapi_….

Query Parameters

name?string

The community's name, with or without r/.

url?string

Its link (https://www.reddit.com/r/AskReddit/), instead of name.

maxAge?integer

How old a cached answer may be, in seconds; 0 always fetches. Default and most: the endpoint's cache lifetime.

Formatint64
Range0 <= value

Response Body

The answer.

application/json
  1. response

One item, as every single-item endpoint answers: { "data": … }.

data*

A community (a subreddit).

Example Request
import { SocialAPI } from "@socialapihq/sdk";const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });const { data } = await client.reddit.subreddit({ name: "AskReddit" });
Example Response
{  "data": {    "id": "2qh1i",    "name": "AskReddit",    "title": "Ask Reddit...",    "description": "r/AskReddit is the place to ask and answer thought-provoking questions.",    "url": "https://www.reddit.com/r/AskReddit/",    "iconUrl": "https://styles.redditmedia.com/t5_2qh1i/styles/communityIcon_p6kb2m6b185b1.png?width=256&s=c28b9f038c305e139b62739f2133d7b776582696",    "bannerUrl": "https://styles.redditmedia.com/t5_2qh1i/styles/bannerBackgroundImage_fs33xogq946f1.png?width=4000&s=460f7387ea96fb4707fad8acaa81643df40f19a9",    "subscribers": 60238961,    "weeklyVisitors": 13756269,    "weeklyContributions": 1050330,    "createdAt": "2008-01-25T03:52:15.000Z",    "kind": "public",    "nsfw": false,    "language": "es",    "category": "Lifestyles",    "rules": [      {        "title": "Rule 1 - Questions must be clear and direct and may not use the body textbox",        "description": "* All questions must be clear, written in English, and conclude with a question mark\n* All context in the title must be ***necessary to understanding the question***; do not give “example answers” in the post title (i.e. “Other than your mom, \\_\\_\\_\\_\\_\\_?”)\n* No text in the text box - any additional info from you must be added as a comment to your post\n\n[The full rule can be viewed here](https://…",        "appliesTo": "link"      },      {        "title": "Rule 2 - No personal or professional advice requests",        "description": "* Askreddit is NOT your personal or professional advice platform\n\n* Do not makes posts asking for professional advice - medical, legal, financial, or otherwise\n\n* All posts asking for advice must be generic and not specific to your situation alone\n\n* Do not use first person pronouns\n\n* No crowdsourcing naming or purchasing decisions\n\n[The full rule can be viewed here](https://www.reddit.com/r/AskR…",        "appliesTo": "link"      },      {        "title": "Rule 3 - Open ended questions only",        "description": "* Post must be an open-ended discussion question\n\n* Title must not be phrased to allow a simple yes/no answer\n\n* No questions that have definite answers\n\n* Question must not be a poll or survey\n\n* No “Either/Or” type questions\n\n* Do not ask for NSFW links\n\n* Do not specify a length (eg \"in three words...\") or make your post into a game\n\n[The full rule can be viewed here](https://www.reddit.com/r/A…",        "appliesTo": "link"      }    ]  }}