Skip to main content
The Search API provides two endpoints for finding pages: full-text search across page bodies and titles, and title prefix completion for autocomplete-style queries. Both endpoints are served under /w/rest.php/v1/search/.

GET /v1/search/page

Performs a full-text search across page bodies and titles. Results are ranked by relevance and deduplicated — if a search result is a redirect, the response returns the redirect target page instead.
curl "https://en.wikipedia.org/w/rest.php/v1/search/page?q=solar+system"

Query parameters

q
string
required
The search query string. Supports the same syntax as the wiki’s standard search (boolean operators, phrase matching, and field-specific queries when the search backend supports them).
limit
number
default:"50"
The maximum number of results to return. Minimum: 1. Maximum: 100.

Response

pages
array
required
An array of matching page objects.
curl "https://en.wikipedia.org/w/rest.php/v1/search/page?q=solar+system"

GET /v1/search/title

Performs a title prefix completion search — returns pages whose titles begin with or closely match the query. This endpoint is optimized for autocomplete use cases and uses the search engine’s completion (suggestion) mode.
curl "https://en.wikipedia.org/w/rest.php/v1/search/title?q=Earth"

Query parameters

q
string
required
The title prefix or partial title to match against. The search engine may also return fuzzy or variant matches depending on backend configuration.
limit
number
default:"50"
The maximum number of suggestions to return. Minimum: 1. Maximum: 100.

Response

Same structure as GET /v1/search/page — a pages array of page objects. The excerpt field contains the suggestion text from the completion engine rather than a body snippet.
curl "https://en.wikipedia.org/w/rest.php/v1/search/title?q=Earth"

Caching

Completion search responses (/v1/search/title) are cached by the server when the wiki allows public reading. The Cache-Control header reflects the $wgSearchSuggestCacheExpiry configuration value. Full-text search responses (/v1/search/page) follow standard REST API caching behavior.

Search backends

The search results returned by both endpoints depend on the wiki’s configured search backend.
When no external search engine is configured, MediaWiki uses its built-in SQL-based search engine. Full-text search queries the searchindex table using the database’s native full-text search capabilities. Title completion uses simple prefix matching against page titles. Result quality is limited compared to dedicated search engines.
Wikimedia wikis and many large installations use the CirrusSearch extension, which indexes pages in Elasticsearch or OpenSearch. CirrusSearch provides significantly better relevance ranking, support for complex query syntax, fuzzy matching, language-aware stemming, and cross-namespace search. The description and thumbnail fields in search results are populated when CirrusSearch is combined with extensions like Wikidata and PageImages.
For type-ahead search widgets, prefer GET /v1/search/title over GET /v1/search/page. Title completion is faster, more cache-friendly, and purpose-built for suggesting page titles as the user types.

Build docs developers (and LLMs) love