> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webrouter.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Wikipedia

> Keyless Wikipedia search, plain-text article extracts, page source and HTML, revision history, language links and file info through the MediaWiki APIs.

![](https://mintcdn.com/webrouter/8QP9EZc8V07Kl-0I/logo/data-apis/wikipedia.webp?fit=max\&auto=format\&n=8QP9EZc8V07Kl-0I\&q=85\&s=1b306edc754e192ff797295225932131)

[Web Catalog · Search](https://docs.webrouter.net/data-apis.md?category=search)

No key needed

Endpoints

9

Auth

None

[Vendor docs](https://www.mediawiki.org/wiki/API:Main_page) · Serves `wikipedia.org`

## Setup

| Variable | | What it is |
| - | - | - |
| `WIKIPEDIA_LANGUAGE` | optional | Which language edition to call (the subdomain). Default `en`. One of `en`, `de`, `fr`, `es`, `it`, `ja`, `ru`, `pt`, `zh`, `pl`, `nl`, `ar`, `sv`, `uk`, `fa`, `he`, `ko`, `id`, `tr`, `vi`, `cs`, `fi`, `no`, `hu`, `ro`, `simple`. |
| `WIKIPEDIA_USER_AGENT` | optional | A descriptive User-Agent with contact details, e.g. 'MyAgent/1.0 ([you@example.com](mailto:you@example.com))'; clients without one may be IP-blocked; the default names WebRouter, so set your own with contact details for heavy use. Default `WebRouter (+https://github.com/Nimbleway/webrouter)`. |

Put them in your environment or `.env`; [Data APIs](https://docs.webrouter.net/vendors.md) covers the other ways.

## Notes

* Keyless, but Wikimedia requires an informative User-Agent with contact information; set WIKIPEDIA\_USER\_AGENT.
* No fixed read limit: send requests one at a time, batch titles with | where a call accepts several, and back off on a ratelimited error.
* Action API calls (/w/api.php) need action and format=json; the REST calls (/w/rest.php/v1) answer JSON already.

## Endpoints

GET

Search articles

Pages matching a full-text query, with snippets, word counts and total hits.

[Open](#wikipedia-search)

GET

Get article text extracts

Plain-text or limited-HTML extracts of one or more pages, whole or intro only.

[Open](#wikipedia-extracts)

GET

Search pages (REST)

Pages matching a search query.

[Open](#wikipedia-pages-search)

GET

Autocomplete page titles

Pages whose titles start with the given text.

[Open](#wikipedia-titles-suggest)

GET

Get page source

Latest revision of a page with its wikitext source.

[Open](#wikipedia-pages-source)

GET

Get page HTML

Rendered HTML of the latest revision of a page.

[Open](#wikipedia-pages-html)

GET

Get page history

Revisions of a page in segments of 20, with links to older and newer segments.

[Open](#wikipedia-pages-history)

GET

Get page in other languages

The same article's titles in other language editions.

[Open](#wikipedia-pages-languages)

GET

Get file info

Download URLs and sizes (original, preferred, thumbnail) of a media file.

[Open](#wikipedia-files-get)

### Search articles

GET

`/w/api.php`

`wikipedia.search`

Pages matching a full-text query, with snippets, word counts and total hits.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`action` required</td><td>string</td><td>query</td><td>Must be query. One of `query` Example `query`</td></tr>
    <tr><td>`list` required</td><td>string</td><td>query</td><td>Must be search. One of `search` Example `search`</td></tr>
    <tr><td>`srsearch` required</td><td>string</td><td>query</td><td>Search string. Example `large language model`</td></tr>

    <tr>
      <td>
        `srlimit`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Results per call, 1 to 500 or max, default 10.
      </td>
    </tr>

    <tr>
      <td>
        `sroffset`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Offset for continuing, default 0.
      </td>
    </tr>

    <tr>
      <td>
        `srnamespace`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Namespaces, default 0 (articles); \* for all.
      </td>
    </tr>

    <tr><td>`srwhat`</td><td>string</td><td>query</td><td>nearmatch, text or title. One of `nearmatch`, `text`, `title`</td></tr>

    <tr>
      <td>
        `srprop`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        \|-separated properties: size, wordcount, timestamp, snippet, titlesnippet, redirecttitle.
      </td>
    </tr>

    <tr>
      <td>
        `srinfo`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        \|-separated metadata: totalhits, suggestion, rewrittenquery.
      </td>
    </tr>

    <tr>
      <td>
        `srsort`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        relevance (default), last\_edit\_desc, create\_timestamp\_desc, random and others.
      </td>
    </tr>

    <tr><td>`format`</td><td>string</td><td>query</td><td>Response format. One of `json` Example `json`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.mediawiki.org/wiki/API:Search) · Same job: [Andi AI Search](https://docs.webrouter.net/data-apis/andi.md#andi-search), [Apify](https://docs.webrouter.net/data-apis/apify.md#apify-store-search), [Context.dev](https://docs.webrouter.net/data-apis/branddev.md#branddev-web-search), [Brave Search](https://docs.webrouter.net/data-apis/bravesearch.md#bravesearch-videos-search), [BytePlus Searchinfinity](https://docs.webrouter.net/data-apis/byteplus-search.md#byteplus-search-web-search), [Crawl4AI Cloud](https://docs.webrouter.net/data-apis/crawl4ai.md#crawl4ai-search)

```python Python theme={null}
router.call_data_api("wikipedia.search", {'action': 'query', 'list': 'search', 'srsearch': 'large language model', 'format': 'json'})
```

```text MCP theme={null}
call_data_api(endpoint="wikipedia.search", params={"action": "query", "list": "search", "srsearch": "large language model", "format": "json"})
```

### Get article text extracts

GET

`/w/api.php`

`wikipedia.extracts`

Plain-text or limited-HTML extracts of one or more pages, whole or intro only.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`action` required</td><td>string</td><td>query</td><td>Must be query. One of `query` Example `query`</td></tr>
    <tr><td>`prop` required</td><td>string</td><td>query</td><td>Must be extracts. One of `extracts` Example `extracts`</td></tr>
    <tr><td>`titles` required</td><td>string</td><td>query</td><td>Page titles, |-separated. Example `Earth`</td></tr>
    <tr><td>`explaintext`</td><td>boolean</td><td>query</td><td>Set (any value) for plain text instead of HTML. Example `true`</td></tr>

    <tr>
      <td>
        `exintro`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        Set for only the content before the first section.
      </td>
    </tr>

    <tr>
      <td>
        `exchars`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Approximate characters to return, 1 to 1,200.
      </td>
    </tr>

    <tr>
      <td>
        `exsentences`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Sentences to return, 1 to 10.
      </td>
    </tr>

    <tr>
      <td>
        `exlimit`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Extracts to return, 1 to 20 or max; more than one only with exintro.
      </td>
    </tr>

    <tr><td>`exsectionformat`</td><td>string</td><td>query</td><td>Section headings in plain text: wiki (default), plain or raw. One of `wiki`, `plain`, `raw`</td></tr>

    <tr>
      <td>
        `excontinue`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Continue value from a previous response.
      </td>
    </tr>

    <tr><td>`format`</td><td>string</td><td>query</td><td>Response format. One of `json` Example `json`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.mediawiki.org/wiki/Extension:TextExtracts) · Same job: [Andi AI Search](https://docs.webrouter.net/data-apis/andi.md#andi-fetch), [Context.dev](https://docs.webrouter.net/data-apis/branddev.md#branddev-web-scrape), [Brave Search](https://docs.webrouter.net/data-apis/bravesearch.md#bravesearch-llm-context), [BytePlus Searchinfinity](https://docs.webrouter.net/data-apis/byteplus-search.md#byteplus-search-fetch), [cloro](https://docs.webrouter.net/data-apis/cloro.md#cloro-google-product), [Context7](https://docs.webrouter.net/data-apis/context7.md#context7-page-fetch)

```python Python theme={null}
router.call_data_api("wikipedia.extracts", {'action': 'query', 'prop': 'extracts', 'titles': 'Earth', 'explaintext': True, 'format': 'json'})
```

```text MCP theme={null}
call_data_api(endpoint="wikipedia.extracts", params={"action": "query", "prop": "extracts", "titles": "Earth", "explaintext": true, "format": "json"})
```

### Search pages (REST)

GET

`/w/rest.php/v1/search/page`

`wikipedia.pages.search`

Pages matching a search query.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`q` required</td><td>string</td><td>query</td><td>Search terms. Example `earth`</td></tr>

    <tr>
      <td>
        `limit`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Results, 1 to 100, default 50.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://www.mediawiki.org/wiki/API:REST_API/Reference) · Same job: [Andi AI Search](https://docs.webrouter.net/data-apis/andi.md#andi-search), [Apify](https://docs.webrouter.net/data-apis/apify.md#apify-store-search), [Context.dev](https://docs.webrouter.net/data-apis/branddev.md#branddev-web-search), [Brave Search](https://docs.webrouter.net/data-apis/bravesearch.md#bravesearch-videos-search), [BytePlus Searchinfinity](https://docs.webrouter.net/data-apis/byteplus-search.md#byteplus-search-web-search), [Crawl4AI Cloud](https://docs.webrouter.net/data-apis/crawl4ai.md#crawl4ai-search)

```python Python theme={null}
router.call_data_api("wikipedia.pages.search", {'q': 'earth'})
```

```text MCP theme={null}
call_data_api(endpoint="wikipedia.pages.search", params={"q": "earth"})
```

### Autocomplete page titles

GET

`/w/rest.php/v1/search/title`

`wikipedia.titles.suggest`

Pages whose titles start with the given text.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`q` required</td><td>string</td><td>query</td><td>Title prefix. Example `ear`</td></tr>

    <tr>
      <td>
        `limit`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Results, 1 to 100, default 50.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://www.mediawiki.org/wiki/API:REST_API/Reference) · Same job: [Brave Search](https://docs.webrouter.net/data-apis/bravesearch.md#bravesearch-suggest-search), [Listen Notes](https://docs.webrouter.net/data-apis/listennotes.md#listennotes-typeahead)

```python Python theme={null}
router.call_data_api("wikipedia.titles.suggest", {'q': 'ear'})
```

```text MCP theme={null}
call_data_api(endpoint="wikipedia.titles.suggest", params={"q": "ear"})
```

### Get page source

GET

`/w/rest.php/v1/page/{title}`

`wikipedia.pages.source`

Latest revision of a page with its wikitext source.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`title` required</td><td>string</td><td>path</td><td>Page title, spaces as underscores; encode a subpage slash as %2F. Example `Earth`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.mediawiki.org/wiki/API:REST_API/Reference) · Same job: [Andi AI Search](https://docs.webrouter.net/data-apis/andi.md#andi-fetch), [Context.dev](https://docs.webrouter.net/data-apis/branddev.md#branddev-web-scrape), [Brave Search](https://docs.webrouter.net/data-apis/bravesearch.md#bravesearch-llm-context), [BytePlus Searchinfinity](https://docs.webrouter.net/data-apis/byteplus-search.md#byteplus-search-fetch), [cloro](https://docs.webrouter.net/data-apis/cloro.md#cloro-google-product), [Context7](https://docs.webrouter.net/data-apis/context7.md#context7-page-fetch)

```python Python theme={null}
router.call_data_api("wikipedia.pages.source", {'title': 'Earth'})
```

```text MCP theme={null}
call_data_api(endpoint="wikipedia.pages.source", params={"title": "Earth"})
```

### Get page HTML

GET

`/w/rest.php/v1/page/{title}/html`

`wikipedia.pages.html`

Rendered HTML of the latest revision of a page.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`title` required</td><td>string</td><td>path</td><td>Page title, spaces as underscores; encode a subpage slash as %2F. Example `Earth`</td></tr>
    <tr><td>`redirect`</td><td>string</td><td>query</td><td>no to not follow redirects. One of `no`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.mediawiki.org/wiki/API:REST_API/Reference) · Same job: [Andi AI Search](https://docs.webrouter.net/data-apis/andi.md#andi-fetch), [Context.dev](https://docs.webrouter.net/data-apis/branddev.md#branddev-web-scrape), [Brave Search](https://docs.webrouter.net/data-apis/bravesearch.md#bravesearch-llm-context), [BytePlus Searchinfinity](https://docs.webrouter.net/data-apis/byteplus-search.md#byteplus-search-fetch), [cloro](https://docs.webrouter.net/data-apis/cloro.md#cloro-google-product), [Context7](https://docs.webrouter.net/data-apis/context7.md#context7-page-fetch)

```python Python theme={null}
router.call_data_api("wikipedia.pages.html", {'title': 'Earth'})
```

```text MCP theme={null}
call_data_api(endpoint="wikipedia.pages.html", params={"title": "Earth"})
```

> [!NOTE]
>
> * Returns text/html, not JSON.

### Get page history

GET

`/w/rest.php/v1/page/{title}/history`

`wikipedia.pages.history`

Revisions of a page in segments of 20, with links to older and newer segments.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`title` required</td><td>string</td><td>path</td><td>Page title, spaces as underscores; encode a subpage slash as %2F. Example `Earth`</td></tr>

    <tr>
      <td>
        `older_than`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Revisions older than this revision id.
      </td>
    </tr>

    <tr>
      <td>
        `newer_than`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Revisions newer than this revision id.
      </td>
    </tr>

    <tr><td>`filter`</td><td>string</td><td>query</td><td>Only one kind: reverted, anonymous, bot or minor. One of `reverted`, `anonymous`, `bot`, `minor`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.mediawiki.org/wiki/API:REST_API/Reference)

```python Python theme={null}
router.call_data_api("wikipedia.pages.history", {'title': 'Earth'})
```

```text MCP theme={null}
call_data_api(endpoint="wikipedia.pages.history", params={"title": "Earth"})
```

### Get page in other languages

GET

`/w/rest.php/v1/page/{title}/links/language`

`wikipedia.pages.languages`

The same article's titles in other language editions.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`title` required</td><td>string</td><td>path</td><td>Page title, spaces as underscores; encode a subpage slash as %2F. Example `Earth`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.mediawiki.org/wiki/API:REST_API/Reference)

```python Python theme={null}
router.call_data_api("wikipedia.pages.languages", {'title': 'Earth'})
```

```text MCP theme={null}
call_data_api(endpoint="wikipedia.pages.languages", params={"title": "Earth"})
```

### Get file info

GET

`/w/rest.php/v1/file/{title}`

`wikipedia.files.get`

Download URLs and sizes (original, preferred, thumbnail) of a media file.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`title` required</td><td>string</td><td>path</td><td>File page title, with the File: prefix. Example `File:The_Blue_Marble.jpg`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.mediawiki.org/wiki/API:REST_API/Reference)

```python Python theme={null}
router.call_data_api("wikipedia.files.get", {'title': 'File:The_Blue_Marble.jpg'})
```

```text MCP theme={null}
call_data_api(endpoint="wikipedia.files.get", params={"title": "File:The_Blue_Marble.jpg"})
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.