Wikipedia Search API Documentation
The Wikipedia Search API searches the full text of one Wikipedia edition and returns the pages that match. Each result comes with its page id, title, link, a snippet with the words the search matched, the short description, the Wikidata id, a thumbnail, the time of the last edit and the page's size and word count.
A result can also name the section, the redirect or the categories the search matched, and search_information.did_you_mean carries the spelling Wikipedia suggests. Wikipedia also suggests spellings for some correctly spelled terms, such as alan touring for Alan Turing. In Japanese and Chinese, snippet_highlighted_words lists the parts of words Wikipedia highlights.
Wikipedia's order can change slightly between requests, so a result can appear again on the next page. With num above 50, some results come without a thumbnail. A regular expression Wikipedia cannot read in q returns an error.
API Parameters
Search Query
-
- Name
-
q - Required
- Required
- Description
-
The terms you want to search for, up to 300 characters. Wikipedia's search operators work here, such as
intitle:,incategory:and quoted phrases.
Localization
-
- Name
-
language - Required
- Optional
- Description
-
The default parameter
endefines the Wikipedia edition to search, by the code in its address, such asdefor de.wikipedia.org. Check the full list of supported Wikipedialanguageeditions.
Filters
-
- Name
-
namespace - Required
- Optional
- Description
-
Defines the namespaces to search, as namespace ids comma-separated, or
allfor every namespace. The default0searches articles, and14searches categories. A namespace the edition does not have returns an error naming it.
Sorting
-
- Name
-
sort_by - Required
- Optional
- Description
-
Sorts the results. Options are:
relevance- most relevant first (default)last_edit_desc- most recently edited firstlast_edit_asc- least recently edited firstcreate_timestamp_desc- most recently created firstcreate_timestamp_asc- least recently created firstincoming_links_desc- most linked to firstincoming_links_asc- least linked to firsttitle_natural_asc- by title, A to Ztitle_natural_desc- by title, Z to Arandom- in random order
Engine
-
- Name
-
engine - Required
- Required
- Description
-
Parameter defines an engine that will be used to retrieve real-time data. It must be set to
wikipedia_search.
API key
-
- Name
-
api_key - Required
- Required
- Description
-
The
api_keyauthenticates your requests. Use it as a query parameter (https://www.searchapi.io/api/v1/search?api_key=YOUR_API_KEY) or in the Authorization header (Bearer YOUR_API_KEY).
Zero Data Retention
-
- Name
-
zero_retention - Enterprise Only
- Enterprise Only
- Required
- Optional
- Description
-
Set this parameter to
trueto disable all logging and persistent storage. No request parameters, HTML, or JSON responses are stored or logged. Suitable for high-compliance use cases. Debugging and support may be limited while enabled.
API Examples
Full Response
https://www.searchapi.io/api/v1/search?engine=wikipedia_search&q=quantum+entanglement
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "wikipedia_search",
"q": "quantum entanglement"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_4EyfHsYNJsMWiJv2zy4U65Jo",
"status": "Success",
"created_at": "2026-11-25T13:40:20Z",
"request_time_taken": 2.28,
"parsing_time_taken": 0.0,
"total_time_taken": 2.29,
"request_url": "https://en.wikipedia.org/w/index.php?fulltext=1&limit=20&ns0=1&offset=0&search=quantum+entanglement",
"html_url": "https://www.searchapi.io/api/v1/searches/search_4EyfHsYNJsMWiJv2zy4U65Jo.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_4EyfHsYNJsMWiJv2zy4U65Jo"
},
"search_parameters": {
"engine": "wikipedia_search",
"q": "quantum entanglement",
"language": "en",
"sort_by": "relevance",
"namespace": "0",
"num": 20,
"page": 1
},
"search_information": {
"total_results": 1167
},
"organic_results": [
{
"position": 1,
"page_id": 25336,
"title": "Quantum entanglement",
"link": "https://en.wikipedia.org/wiki/Quantum_entanglement",
"snippet": "Quantum entanglement is the phenomenon in which the quantum state of each particle in a group cannot be described independently of the state of the others",
"snippet_highlighted_words": [
"Quantum",
"entanglement",
"quantum"
],
"description": "Physics phenomenon",
"wikidata_id": "Q215675",
"thumbnail": "https://thumb.wikimedia.org/wikipedia/commons/thumb/2/2d/SPDC_figure.png/330px-SPDC_figure.png?utm_s...",
"updated_at": "2026-11-21T20:11:11Z",
"size_bytes": 118499,
"word_count": 12844,
"matched_section": {
"title": "Meaning of entanglement",
"link": "https://en.wikipedia.org/wiki/Quantum_entanglement#Meaning_of_entanglement"
},
"category_snippet": "Quantum information science",
"namespace": 0
},
{
"position": 8,
"page_id": 25284,
"title": "Qubit",
"link": "https://en.wikipedia.org/wiki/Qubit",
"snippet": "In quantum computing, a qubit (/ˈkjuːbɪt/) or quantum bit is a basic unit of quantum information, the quantum version of the classic binary bit. A qubit",
"snippet_highlighted_words": [
"quantum",
"quantum",
"quantum",
"quantum"
],
"description": "Basic unit of quantum information",
"wikidata_id": "Q378201",
"thumbnail": "https://thumb.wikimedia.org/wikipedia/commons/thumb/4/4e/Simple_qubits.svg/330px-Simple_qubits.svg.p...",
"updated_at": "2026-11-11T17:25:03Z",
"size_bytes": 41713,
"word_count": 4351,
"matched_section": {
"title": "Quantum entanglement",
"link": "https://en.wikipedia.org/wiki/Qubit#Quantum_entanglement"
},
"redirect_title": "Quantum bit",
"category_snippet": "Quantum computing",
"namespace": 0
},
"..."
],
"pagination": {
"current": 1,
"next": "https://en.wikipedia.org/w/index.php?fulltext=1&limit=20&ns0=1&offset=20&search=quantum+entanglement"
}
}
German Edition
https://www.searchapi.io/api/v1/search?engine=wikipedia_search&language=de&q=Merkur
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "wikipedia_search",
"q": "Merkur",
"language": "de"
}
response = requests.get(url, params=params)
print(response.text)
{
"organic_results": [
{
"position": 1,
"page_id": 3291,
"title": "Merkur (Planet)",
"link": "https://de.wikipedia.org/wiki/Merkur_(Planet)",
"snippet": "Der Merkur (IPA: [] ) ist mit einem Durchmesser von knapp 4880 Kilometern der kleinste, mit einer durchschnittlichen Sonnenentfernung von etwa 58 Millionen",
"snippet_highlighted_words": [
"Merkur"
],
"description": "innerster Planet unseres Sonnensystems",
"wikidata_id": "Q308",
"thumbnail": "https://thumb.wikimedia.org/wikipedia/commons/thumb/d/d9/Mercury_in_color_-_Prockter07-edit1.jpg/330...",
"updated_at": "2026-11-22T09:30:01Z",
"size_bytes": 79286,
"word_count": 8465,
"category_snippet": "Merkur (Planet)",
"namespace": 0
},
{
"position": 2,
"page_id": 3292,
"title": "Merkur",
"link": "https://de.wikipedia.org/wiki/Merkur",
"snippet": "Merkur oder Mercur steht für: Merkur, deutsche Namensform für den römischen Gott Mercurius Merkur (Planet), innerster Planet des Sonnensystems (nach dem",
"snippet_highlighted_words": [
"Merkur",
"Merkur",
"Merkur"
],
"description": "Wikimedia-Begriffsklärungsseite",
"wikidata_id": "Q542040",
"updated_at": "2026-10-27T17:29:08Z",
"size_bytes": 3164,
"word_count": 346,
"is_disambiguation": true,
"namespace": 0
},
"..."
]
}
Most Recently Edited
https://www.searchapi.io/api/v1/search?engine=wikipedia_search&q=climate+change&sort_by=last_edit_desc
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "wikipedia_search",
"q": "climate change",
"sort_by": "last_edit_desc"
}
response = requests.get(url, params=params)
print(response.text)
{
"organic_results": [
{
"position": 1,
"page_id": 34932220,
"title": "Assam Pradesh Congress Committee",
"link": "https://en.wikipedia.org/wiki/Assam_Pradesh_Congress_Committee",
"snippet": "India Environment Biogeographic classification Biosphere reserves Climate Climate change Earthquakes Ecoregions Environmental issues Fauna Forests Flora",
"snippet_highlighted_words": [
"Climate",
"Climate",
"change"
],
"description": "Indian political party",
"wikidata_id": "Q4808387",
"thumbnail": "https://thumb.wikimedia.org/wikipedia/commons/thumb/6/6c/Indian_National_Congress_hand_logo.svg/330p...",
"updated_at": "2026-11-25T13:36:12Z",
"size_bytes": 30593,
"word_count": 245,
"namespace": 0
},
"..."
]
}
Categories
https://www.searchapi.io/api/v1/search?engine=wikipedia_search&namespace=14&q=physics
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "wikipedia_search",
"q": "physics",
"namespace": "14"
}
response = requests.get(url, params=params)
print(response.text)
{
"organic_results": [
{
"position": 1,
"page_id": 692318,
"title": "Category:Physics",
"link": "https://en.wikipedia.org/wiki/Category:Physics",
"snippet": "Wikimedia Commons has media related to Physics. Physics portal Pages in this category should be moved to subcategories where applicable. This category",
"snippet_highlighted_words": [
"Physics",
"Physics"
],
"wikidata_id": "Q1457258",
"updated_at": "2026-11-23T11:03:17Z",
"size_bytes": 392,
"word_count": 68,
"namespace": 14
},
"..."
]
}