Wikipedia API & Scraper
The Wikipedia API returns encyclopedia data as clean JSON.
🤖 Using an AI assistant? Copy this link into ChatGPT / Claude / Cursor — it reads every endpoint and parameter instantly and tells you if this API fits your use case.
The primary summary endpoint returns a page's title, extract, description, thumbnail, coordinates, Wikidata QID and content URL, and you can pull a full page, search, entity_facts, pageviews, related pages and autocomplete. It is built for knowledge apps, RAG pipelines and research that need Wikipedia and Wikidata content without a scraper. One ReefAPI key, one shared credit pool, the standard envelope.
Three ways to name the same subject, and only one of them travels
A Wikipedia record carries several identifiers and they are not interchangeable. Picking the wrong one is why a stored reference breaks after an article is renamed, or points at something unrelated the moment you switch languages. Values measured on the Ada Lovelace article.
| Identifier | Measured value | What it survives |
|---|---|---|
| title | "Ada Lovelace" | nothing — it changes when editors rename the article, and it is different in every language |
| pageid | 974 | renames, but NOT languages. Page 974 on en.wikipedia is an entirely unrelated article on de.wikipedia. |
| wikibase_item / qid | Q7259 | both. The Wikidata QID is the same subject in all 360+ language editions — this is the one to store. |
| url / mobile_url | https://en.wikipedia.org/wiki/Ada_Lovelace | nothing — it is built from the current title, underscores and all |
| thumbnail | 330 × 427 | a pre-scaled image for lists |
| originalimage | 957 × 1239 | the full-resolution file — do not load it into a grid |
Two different licences ship in the same API and both arrive in an attribution object on the response. Article text and geosearch are Wikipedia content under CC-BY-SA 4.0, which obliges you to attribute and to share alike. Pageview traffic comes from the Wikimedia Analytics API under CC0 1.0, with no obligation at all. Keep the attribution object with the data; it is the record of which rule applies to which field.
Real request and response JSON
Captured from the indexed primary action, search, on .
{
"method": "POST",
"url": "https://api.reefapi.com/wikipedia/v1/search",
"headers": {
"x-api-key": "$REEF_KEY",
"content-type": "application/json"
},
"body": {
"query": "quantum computing"
}
}{
"ok": true,
"meta": {
"api": "wikipedia",
"endpoint": "search",
"mode": "live",
"latency_ms": 513.2,
"record_count": 10,
"bytes": 4896,
"cache_hit": false,
"completeness_pct": 100,
"requests": 1,
"lang": "en",
"total": 5988
},
"data": {
"results": [
{
"title": "Quantum computing",
"pageid": 25220,
"snippet": "quantum computing (abbreviated 'n.quantum computing') is an unconventional process of computing that uses neuromorphic computing to perform quantum operations",
"snippet_html": "<span class=\"searchmatch\">quantum</span> <span class=\"searchmatch\">computing</span> (abbreviated 'n.<span class=\"searchmatch\">quantum</span> <span class=\"searchmatch\">computing</span>') is an unconventional process of <span class=\"searchmatch\">computing</span> that uses neuromorphic <span class=\"searchmatch\">computing</span> to perform <span class=\"searchmatch\">quantum</span> operations",
"wordcount": 14328,
"size": 133478,
"timestamp": "[redacted-phone]T23:00:54Z"
},
{
"title": "Superconducting quantum computing",
"pageid": 1730328,
"snippet": "quantum computing is a branch of quantum computing and solid-state physics that implements superconducting electronic circuits as qubits in a quantum",
"snippet_html": "<span class=\"searchmatch\">quantum</span> <span class=\"searchmatch\">computing</span> is a branch of <span class=\"searchmatch\">quantum</span> <span class=\"searchmatch\">computing</span> and solid-state physics that implements superconducting electronic circuits as qubits in a <span class=\"searchmatch\">quantum</span>",
"wordcount": 10506,
"size": 98879,
"timestamp": "[redacted-phone]T06:38:04Z"
},
{
"title": "Timeline of quantum computing and communication",
"pageid": 191911,
"snippet": "timeline of quantum computing and communication. Erwin Schrödinger publishes a theorem setting the basis for quantum steering and the limits of quantum state",
"snippet_html": "timeline of <span class=\"searchmatch\">quantum</span> <span class=\"searchmatch\">computing</span> and communication. Erwin Schrödinger publishes a theorem setting the basis for <span class=\"searchmatch\">quantum</span> steering and the limits of <span class=\"searchmatch\">quantum</span> state",
"wordcount": 23262,
"size": 245064,
"timestamp": "[redacted-phone]T16:37:54Z"
}
],
"total": 5988,
"query": "quantum computing",
"suggestion": null,
"next_offset": 10,
"attribution": {
"source": "Wikipedia",
"license": "CC-BY-SA 4.0",
"note": "Text from Wikipedia, the free encyclopedia (wikipedia.org)"
}
}
}What the Wikipedia API does
| Action | Description | Concrete use case | Key params |
|---|---|---|---|
| summary | page summary: extract, description, thumbnail, coordinates, wikibase QID, urls (lang= any of 360+ editions) | Content platforms call summary to get page summary. | title, lang |
| page | full article: plain-text body + internal links + image list + categories + external links (content=false → structure only) | Research tools call page to get full article. | title, lang, content, links_limit, images_limit |
| search | full-text search → ranked pages (snippet/pageid/wordcount) + totalhits; enrich= adds extract/thumbnail/QID | Community analysts call search to get full-text search → ranked pages (snippet/pageid/wordcount) + totalhits; enrich= adds extract/…. | query, lang, limit, offset, enrich |
| entity_facts | Wikidata facts for a QID or title: label/description/aliases + resolved human-readable facts{prop:value} + key_facts + identifiers + image/coords | Media monitors call entity_facts to get wikidata facts for a QID or title. | id, qid, title, query, lang, ... |
| pageviews | daily/monthly traffic for an article over a date range → series + total + average | Content platforms call pageviews to get daily/monthly traffic for an article over a date range → series + total + average. | title, lang, start, end, days, ... |
| related | pages related to a title; enrich= adds extract/thumbnail | Research tools call related to get pages related to a title; enrich= adds extract/thumbnail. | title, lang, limit, enrich |
| autocomplete | typeahead title suggestions | Community analysts call autocomplete to get typeahead title suggestions. | q, lang, limit |
| geosearch | Wikipedia pages near a coordinate or around a title | Media monitors call geosearch to get wikipedia pages near a coordinate or around a title. | lat, lon, coord, title, radius, ... |
| on_this_day | historical events/births/deaths/holidays for a month-day (kind=all|selected|events|births|deaths|holidays) | Content platforms call on_this_day to get historical events/births/deaths/holidays for a month-day (kind=all|selected|events|births|dea…. | month, day, date, kind, limit, ... |
| top_articles | most-viewed articles for a given date (trending) | Research tools call top_articles to get most-viewed articles for a given date (trending). | date, limit, access, include_special, lang |
| category_members | list the pages, sub-categories or files that belong to a Wikipedia category (cmtype=page|subcat|file); paginate with meta.next/cmcontinue | Community analysts call category_members to list the pages, sub-categories or files that belong to a Wikipedia category (cmtype=page|subc…. | category, lang, limit, cmtype, cmcontinue |
| langlinks | full cross-language map for a title: every edition's {lang, title, url, langname, autonym} plus a langmap{lang:title} lookup (the page action only returns the count) | Media monitors call langlinks to get full cross-language map for a title. | title, lang, limit |
| random | one or more random articles; enrich= adds extract/thumbnail/QID | Content platforms call random to get one or more random articles; enrich= adds extract/thumbnail/QID. | lang, limit, enrich |
| revisions | edit history of an article: revid, parentid, timestamp, user, comment, size, tags; from/to window the range | Research tools call revisions to get edit history of an article. | title, lang, limit, from, to |
| html | rendered article HTML (REST Parsoid) — or raw wiki markup with format=wikitext | Community analysts call html to get rendered article HTML (REST Parsoid). | title, lang, format |
| featured | Wikimedia featured-content feed for a date: tfa (today's featured article), image-of-the-day, in-the-news, most-read and on-this-day (blocks vary by language/date) | Media monitors call featured to get wikimedia featured-content feed for a date. | date, lang |
Call search from your stack
curl -X POST https://api.reefapi.com/wikipedia/v1/search \
-H "x-api-key: $REEF_KEY" \
-H "content-type: application/json" \
-d '{"query":"quantum computing"}'import requests
r = requests.post(
"https://api.reefapi.com/wikipedia/v1/search",
headers={"x-api-key": REEF_KEY},
json={
"query": "quantum computing"
},
)
print(r.json()["data"])const res = await fetch("https://api.reefapi.com/wikipedia/v1/search", {
method: "POST",
headers: {
"x-api-key": process.env.REEF_KEY,
"content-type": "application/json",
},
body: JSON.stringify({
"query": "quantum computing"
}),
});
const { ok, data, meta, error } = await res.json();Ask your MCP-connected assistant: call reefapi.wikipedia.search with {"query":"quantum computing"}.Who uses this API and why
- RAG pipelines call summary to ground an AI assistant in encyclopedic facts.
- Knowledge apps use entity_facts and related to build topic pages.
- Research tools use pageviews to measure public attention on a subject.
Questions developers ask before integrating
Which identifier should I store in my database?
The QID. A measured summary of Ada Lovelace returned title "Ada Lovelace", pageid 974 and wikibase_item "Q7259" side by side. Titles get renamed by editors and differ per language. pageids survive renames but are scoped to one language edition, so 974 means something completely different on the German wiki. Q7259 is the same human on every one of the 360+ editions, which is what makes it the only safe join key — and langlinks turns it back into whatever title you need.
Why does entity_facts return the same information twice?
Because the two shapes serve different code. key_facts is a normalized set with predictable snake_case keys — instance_of, born, died, birthplace, deathplace, citizenship, occupation, spouse, father, mother, children — which is what you bind to a UI. facts is the raw Wikidata property set with human labels and spaces in the keys: "birth name", "place of birth", "field of work", "Commons category". Measured, both were present in one response. Use key_facts unless you need a property the normalized set does not cover, then fall back to facts.
Are the values in key_facts strings?
Sometimes. In a single measured response, sex_or_gender was the string "female" while occupation was an array of eight entries and children was an array of three. The type follows the underlying Wikidata property's cardinality, so a person with one occupation and a person with eight do not return the same shape. Normalize every value to an array on the way in, or your renderer will print a string character by character the first time it meets a single-valued field. value_cap limits how many entries a multi-valued property returns.
How accurate are the entity facts?
They are Wikidata statements passed through unchanged, which means they are as good as Wikidata is — and Wikidata contains contested, outdated and occasionally plainly wrong claims, especially for historical figures where statements get attached loosely. We do not correct or filter them, because a silent correction would leave you unable to tell our guess from the source. If a fact matters, the QID gives you the Wikidata item to check the statement's own references.
What date format does pageviews use?
Two, in the same response, so read carefully. A measured 7-day pull returned start "20260819" and end "20260826" — compact YYYYMMDD with no separators — while every entry inside daily[] used ISO "2026-08-19". Alongside the series you get total 26637 and average 3805.3 precomputed. The response also echoes project, granularity, access and agent, which matters because the default agent is all-agents: that figure includes bot traffic, and filtering to human users gives a materially lower and usually more honest number.
What does country "XX" mean in geosearch results?
It is a placeholder for a location Wikipedia could not attribute to a country, not a real ISO code. A measured search around Istanbul returned three results within 41 metres: a landmark with country "TR", an event page with country "XX", and a third with country null. Filter on it and you will silently drop historical events, undersea features and disputed places. dist_m is a float in metres and is reliable — a result at dist_m 0 sits exactly on the coordinate you passed.
Why is coordinates null on an article?
Because the subject is not a place. Measured, the summary and the entity record for a person both returned coordinates null, while geosearch results carry lat and lon directly. Only articles about a physical location have coordinates, so treat null as the normal case and use type to tell what kind of article you are looking at — the measured summary reported type "standard", and disambiguation pages and redirects report their own values.
How do I read the same article in another language?
Pass lang on any action for a direct read, and use langlinks when you want to know which editions exist for a subject before you ask. The QID from a summary is the reliable bridge: get Q7259 once, then resolve it wherever you need it rather than translating the title yourself. Coverage depth varies enormously between editions — an article that is comprehensive in English can be two sentences elsewhere — so check the extract length before you treat a translation as equivalent content.
What is the Wikipedia API?
Wikipedia API is a ReefAPI endpoint group for article summaries, search and structured facts. It returns live JSON through POST requests under /wikipedia/v1.
Is the Wikipedia API free to try?
Yes. ReefAPI starts with 1,000 free credits, no card required. Wikipedia calls use the same shared credit balance as every other ReefAPI engine.
Do I need a Wikipedia login or account?
No login to Wikipedia is needed for the API response. You call ReefAPI with your x-api-key header, and the playground can run live examples before you create a production key.
How fresh is the Wikipedia data?
The page example is captured from a live summary call, and production requests fetch live data through ReefAPI rather than a static sample.
How many credits does the Wikipedia API use?
Wikipedia actions currently cost 1-2 credits per successful call. Failed or blocked calls are free, and all APIs draw from one credit pool.
Can I call Wikipedia from an AI assistant or MCP client?
Yes. Connect ReefAPI once through MCP and your assistant can call wikipedia actions with the same key, credit pool and JSON envelope used by normal REST requests.