Wikipedia has two APIs: the REST API (/api/rest_v1/) for clean JSON about a page, and the older Action API (/w/api.php) for search and everything else. Every example below runs as-is.
None for reading. Wikimedia asks automated clients to send a descriptive User-Agent with contact info; from a browser, use the Api-User-Agent header instead. The Action API needs origin=* to answer cross-site requests from a browser.
Full reference: https://www.mediawiki.org/wiki/API:REST_API
Title, one-line description, and the lead paragraph as plain text — what Wikipedia uses for link previews.
curl https://en.wikipedia.org/api/rest_v1/page/summary/HTTP
{
"type": "standard",
"title": "HTTP",
"description": "Application layer protocol",
"extract": "HTTP is an application layer protocol in the Internet protocol suite for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, where hypertext documents include hyperlinks to other resources that the user can easily access, for example by a mouse click or by tapping the screen in a web browser.",
"content_urls": {
"desktop": {
"page": "https://en.wikipedia.org/wiki/HTTP"
}
}
}
The Action API's search. snippet is HTML with matches wrapped in searchmatch spans.
curl "https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=REST%20API&srlimit=3&format=json&origin=*"
{
"query": {
"searchinfo": {
"totalhits": 6068,
"suggestion": "rest ai",
"suggestionsnippet": "rest ai"
},
"search": [
{
"title": "REST",
"pageid": 907222,
"size": 17796,
"wordcount": 1889,
"snippet": "<span class=\"searchmatch\">APIs</span> and what are widely considered best practices regarding the "verbs" (HTTP methods) a resource responds to, while having little to do with <span class=\"searchmatch\">REST</span> as",
"timestamp": "2026-09-18T10:27:06Z"
},
{
"title": "API",
"pageid": 27697009,
"size": 49771,
"wordcount": 5492,
"snippet": "An application programming interface (<span class=\"searchmatch\">API</span>) is a connection between computers or between computer programs. It is a type of software interface, offering",
"timestamp": "2026-09-10T22:28:28Z"
}
]
}
}
Historical events for a month and day (here, July 20 — 69 events). Also births, deaths, holidays.
curl https://en.wikipedia.org/api/rest_v1/feed/onthisday/events/07/20
{
"events": [
{
"text": "American businessman Jeff Bezos flies to space aboard New Shepard NS-16 operated by his private spaceflight company Blue Origin.",
"year": 2021,
"pages": [
{
"title": "Jeff_Bezos"
}
]
},
{
"text": "Soyuz MS-13 is launched to the International Space Station on the 50th anniversary of the Apollo 11 moon landing.",
"year": 2019,
"pages": [
{
"title": "Soyuz_MS-13"
}
]
}
]
}
Daily human views of an article from the Wikimedia metrics API. Dates are YYYYMMDD.
curl https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia/all-access/user/HTTP/daily/20250701/20250703
{
"items": [
{
"project": "en.wikipedia",
"article": "HTTP",
"granularity": "daily",
"timestamp": "2025070100",
"access": "all-access",
"agent": "user",
"views": 945
},
{
"project": "en.wikipedia",
"article": "HTTP",
"granularity": "daily",
"timestamp": "2025070200",
"access": "all-access",
"agent": "user",
"views": 1077
},
{
"project": "en.wikipedia",
"article": "HTTP",
"granularity": "daily",
"timestamp": "2025070300",
"access": "all-access",
"agent": "user",
"views": 950
}
]
}