GET /subreddit/wiki-export

Subreddit Wiki Export

A subreddit's whole wiki in one call. Reddit Scraper API endpoint /subreddit/wiki-export: parameters, JSON response fields and code examples.

Every page of a community’s wiki in one call, index first, merged into content and listed in pages. Restricted, missing and disabled pages are listed in skipped; pages not read within about 25 seconds in not_attempted (read them with /subreddit/wiki). A community without a readable wiki answers pages: []. Billed 1 request for the page list plus 1 per page read.

HTTP Request

GET /subreddit/wiki-export

Cost (in requests): 1 + 1 per page read. Every successful answer reports its cost in data.billed_requests.

Parameters

ParameterTypeRequiredDefaultDescription
subredditstringYes-Subreddit name (case-insensitive, with or without r/) or its t5_ id.
max_pagesintegerNo50Wiki pages read, 1–100 (default 50), index first, then the order of /subreddit/wiki-pages. Billed 1 request per page read.
max_tokensintegerNo50000Size cap of content in estimated tokens (4 characters per token), 500–100,000 (default 50,000). The wiki is cut at the cap on a page boundary; pages still holds every page read.
formatstringNomarkdownmarkdown (default): one document, each page as # title (the path when the page has no title) followed by its Markdown. jsonl: one JSON object per line and page {type, path, title, revised_at, revised_by, text}.
include_htmlbooleanNofalseAdds body_html (the rendered HTML) to every page. Default: left out; body_markdown carries the same text.

Response

Real response to GET /subreddit/wiki-export?subreddit=python (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
36
37
{
  "status": true,
  "request_id": "9427e84e-b785-0766-0284-c55c6c1b",
  "data": {
    "subreddit": "Python",
    "pages_total": 4,
    "pages_exported": 4,
    "truncated": false,
    "token_count": 4996,
    "char_count": 19982,
    "content": "# index\n\n# Welcome to r/Python  \r\nSubreddit dedicated to news about the dynamic, interpreted, interactive, \r\nobject-oriented, extensible programming language [Python](https://www.python.org/).  \r\nIf you are about to ask a question, please c…",
    "pages": [
      {
        "path": "index",
        "parent": null,
        "depth": 0,
        "revised_at": "2020-10-22T21:39:26.000000+00:00",
        "revised_by": "IAmKindOfCreative",
        "body_markdown": "# Welcome to r/Python  \r\nSubreddit dedicated to news about the dynamic, interpreted, interactive, \r\nobject-oriented, extensible programming language [Python](https://www.python.org/).  \r\nIf you are about to ask a question, please consider […"
      },
      {
        "path": "faq",
        "parent": null,
        "depth": 0,
        "revised_at": "2012-09-11T21:10:04.000000+00:00",
        "revised_by": "reddit",
        "body_markdown": "Other Python FAQs on the web:\n\n\n\n*   [ Should I use Python 2 or Python 3?](http://wiki.python.org/moin/Python2orPython3)\n\n\n\n*   [ General Python FAQ](http://docs.python.org/faq/general.html)\n\n\n\n*   [ Programming FAQ](http://docs.python.org/…"
      }
    ],
    "skipped": [],
    "not_attempted": [],
    "billed_requests": 5
  },
  "request_params": {
    "subreddit": "python"
  }
}

Response Fields

FieldTypeDescription
statusbooleantrue when the request succeeded
request_idstringUnique request identifier
dataobjectThe wiki export; null with error.code = not_found (subreddit).
data.subredditstringSubreddit name.
data.pages_totalintegerPages eligible for export: the pages the wiki has, without tree parents that have no page of their own and without moderator configuration pages (config/*, AutoModerator, Toolbox).
data.pages_exportedintegerPages present in content.
data.truncatedbooleanTrue when content leaves part of the wiki out: the max_tokens cap, the max_pages cap or pages not read in time (not_attempted).
data.token_countintegerEstimated tokens in content (characters ÷ 4).
data.char_countintegerCharacters in content.
data.contentstringEvery readable page merged in the requested format, index first then the wiki’s tree order; empty when the community has no readable wiki.
data.pagesarray of objectsEvery readable page read, in the same order (also the ones max_tokens left out of content); empty when the community has no readable wiki.
data.pages[].pathstringPage path (the wiki_page of /subreddit/wiki).
data.pages[].parentstring / nullParent page path for nested pages.
data.pages[].depthintegerNesting depth (0 = top).
data.pages[].revised_atstringISO-8601 UTC time of the latest revision.
data.pages[].revised_bystringUsername of the latest editor.
data.pages[].body_markdownstringPage as Markdown: Reddit’s source when it serves it, else converted from the HTML; null when the page is empty.
data.skippedarrayPages read but not readable, in the same order; billed (they were read).
data.not_attemptedarrayPage paths not read in time, in the same order; not billed. Read them with /subreddit/wiki.
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

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/wiki-export"

params = {
    "subreddit": "python",
}

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"]

print(data["subreddit"])
print(data["pages_total"])
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/wiki-export";

const params = new URLSearchParams({
  subreddit: "python",
});

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();
console.log(data.subreddit, data.pages_total);
1
2
3
4
curl -G "https://reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com/subreddit/wiki-export" \
  --data-urlencode "subreddit=python" \
  -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