GET /subreddit/directory

Subreddit Directory

Reddit's community directory: popular communities. Reddit Scraper API endpoint /subreddit/directory: parameters, JSON response fields and code examples.

Reddit’s popular communities (about 250, sort=popular) in Reddit’s order with a 1-based position: name, id, description, weekly visitors, icon; with_stats=true adds the counts and 18+ flag, with_details=true the /subreddit/details fields (at most 20 per page). Billed 1 request per page, +1 with with_stats=true, +3 per community detailed. For smaller communities use /subreddit/search or /topic/subreddits.

HTTP Request

GET /subreddit/directory

Cost (in requests): 1 per page; +1 with_stats; +3 per detailed. Every successful answer reports its cost in data.billed_requests.

Parameters

ParameterTypeRequiredDefaultDescription
sortstringNopopularpopular (default and only value): Reddit’s ranked list of its most-visited communities (about 250). The new list is no longer available (400): use /subreddit/search or /topic/subreddits.
page_tokenstringNo-Opaque page token from a previous response’s next_page_token. Omit for the first page.
per_pageintegerNo25Communities per page, 1–100 (default 25; at most 25 with with_stats).
include_nsfwbooleanNotrueDefault true: adult content included; pass false to exclude it (18+ communities are dropped from the page, so a page can hold fewer rows; their positions stay Reddit’s; is_nsfw is then shown).
with_statsbooleanNofalseAdds subscribers_count, weekly_contributions and is_nsfw, and exact weekly_visitors, per community (at most 25 communities per page).
with_detailsbooleanNofalseAdds the /subreddit/details fields (rules, sidebar widgets, menu links, flair settings, banner, colours, created time, type, topics, apps; with the counts the list lacks) to each community; per_page then defaults to 20 and can be at most 20: banner_url, primary_color, key_color, background_color, created_at, state, topics, related_subreddits, flair_settings, is_chat_enabled, rules, widgets, menu_links, devvit_apps (left out without it). Billed +3 per community detailed.

Response

Real response to GET /subreddit/directory (arrays trimmed to 2 items, long texts cut with …).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
  "status": true,
  "request_id": "303fa630-2f07-477d-205d-8af660e5",
  "data": {
    "items": [
      {
        "name": "AskReddit",
        "subreddit_id": "t5_2qh1i",
        "description": "The go-to subreddit to ask and answer thought-provoking questions.",
        "weekly_visitors": 13732702,
        "icon_url": "https://styles.redditmedia.com/t5_2qh1i/styles/communityIcon_p6kb2m6b185b1.png?width=96&height=96&frame=1&auto=webp&s=544475440a67c91431172272a57ccd1be3eca8dc",
        "position": 1
      },
      {
        "name": "whatisit",
        "subreddit_id": "t5_2r397",
        "description": "A community dedicated to identifying mysterious objects, plants, animals, and more.",
        "weekly_visitors": 13964958,
        "icon_url": "https://styles.redditmedia.com/t5_2r397/styles/communityIcon_ds28lp4dy5rg1.png?width=96&height=96&frame=1&auto=webp&s=e4f1bbace79758475b67c3a4a0ad90cb9f1e46ab",
        "position": 2
      }
    ],
    "total": 250,
    "has_next_page": true,
    "next_page_token": "eyJ2IjoxLCJraW5kIjoib2Zmc2V0Iiwic2siOiJkaXJlY3Rvcnk6cG9wdWxhciIsIm8iOjI1LCJxIjpudWxsLCJ0cyI6MTc5NTU1Mzg1OH0",
    "resolved_filters": {
      "sort": {
        "input": null,
        "resolved": "popular",
        "source": "default"
      }
    },
    "billed_requests": 1
  }
}

Response Fields

FieldTypeDescription
statusbooleantrue when the request succeeded
request_idstringUnique request identifier
dataobjectDirectory page.
data.itemsarray of objectsCommunities in Reddit’s order, one page.
data.items[].namestringSubreddit name without r/.
data.items[].subreddit_idstringSubreddit id (t5_…).
data.items[].descriptionstringPublic description. Left out on /subreddit/rising (without with_details), the /subreddit/related same_topic rows and /answers.
data.items[].weekly_visitorsintegerWeekly visitors (Reddit’s periodic count, not live). Left out on /user/subreddits, /subreddit/posting-guide, /subreddit/rule-check and /answers.
data.items[].icon_urlstringCommunity icon URL. Left out on /subreddit/rising (without with_details), /subreddit/posting-guide and /subreddit/rule-check.
data.items[].positionintegerRank in the list, 1-based across pages.
data.totalintegerSize of the whole list (about 250).
data.has_next_pagebooleanMore communities available.
data.next_page_tokenstringToken for the next page; null at the end.
data.resolved_filtersobjectFilters as applied (directory only).
data.resolved_filters.sortobjectDirectory order as applied (popular); null on the most-visited list.
data.resolved_filters.sort.inputstring / nullWhat the caller sent.
data.resolved_filters.sort.resolvedstringWhat was applied on Reddit (null when not applied).
data.resolved_filters.sort.sourcestringparam (applied as given), default, not_found (the value does not exist on Reddit), private / banned / quarantined (a community in the scope that cannot be read: skipped), or not_available (translate_to only: Reddit had no translated listing, the rows are served in their original language).
data.billed_requestsintegerRequests billed for this call (also sent as Requests in the X-RapidAPI-Billing header when it is not RapidAPI’s default of 1).
request_paramsobjectEcho of the parameters you sent

Error Responses

Invalid input returns HTTP 400, not billed. error is a plain string that names the parameter:

1
{ "status": false, "request_id": "99a1e6cd-2e57-9e8f-4e44-2dea7f6d", "error": "Invalid parameter 'post_id': must be a post id such as z1c9z or t3_z1c9z", "request_params": { "post_id": "!!" } }
Status CodeCauseDescription
400Invalid or missing parameterPlain-English message per field. Not billed
200 with status: falseItem not availableerror.code is not_found, banned, private, quarantined. data is null. Billed 1 request
503Reddit temporarily unreachable"error": "Service temporarily unavailable". Not billed, retry later
200 with status: falseBad page tokenerror.code is invalid_page_token: pass next_page_token from the previous answer unchanged

Code Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import requests

url = "https://reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com/subreddit/directory"

params = {

}

headers = {
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=params)
data = response.json()["data"]

for item in data["items"]:
    print(item["name"])
print("Billed requests:", data["billed_requests"])
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
const url = "https://reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com/subreddit/directory";

const params = new URLSearchParams({

});

const response = await fetch(`${url}?${params}`, {
  headers: {
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com"
  }
});

const { data } = await response.json();
data.items.forEach((item) => console.log(item.name));
1
2
3
curl -G "https://reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com/subreddit/directory" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com"
Start building today

Get your API key and make your first request in under a minute.

Get Your API Key on RapidAPI