Fandom wiki page
One page of a Fandom wiki: title, ids, a summary, the infobox as fields (with its image), the text by section as plain text, categories, linked pages, external links, images, other-language versions, the page's license and URL. Also the latest revision (id, time, editor, size), page length, gallery images with captions, data tables as rows of cells, the numbered references, and each infobox's type and image caption. section returns one section, revision_id an older revision, and format=html or format=wikitext adds the page source in that form. On wikis whose license is NonCommercial the section text is left out (headings, infobox facts, categories and links are returned).
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
wikirequired | string | The wiki's name as in its address, or the wiki URL. Example: harrypotter |
title | string | Page title (spaces or underscores). The wiki's main page when neither title nor page_id is given. Example: Hedwig |
page_id | integer | Page id instead of title. |
lang | string | Language edition of the wiki (e.g. de, es, fr). Default English. |
section | integer | One section only, by number: 0 is the lead, 1 the first heading, and so on. |
format | text | html | wikitext | text (default) or also the source: html adds html, wikitext adds wikitext. |
revision_id | integer | An older revision of the page by revision id (alias oldid). |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/fandom/v1/page?wiki=harrypotter" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/fandom/v1/page",
params={"wiki": "harrypotter"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/fandom/v1/page");
url.searchParams.set("wiki", "harrypotter");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).