> **For coding agents and LLMs:** This is one Social Fetch marketing page (markdown export). For API orientation start with [`/llms.txt`](https://www.socialfetch.dev/llms.txt); for auth and crawl rules use [`/agents.txt`](https://www.socialfetch.dev/agents.txt); for every operation use [`/llms-endpoints.txt`](https://www.socialfetch.dev/llms-endpoints.txt).

## This page

- **On-site (HTML):** <https://www.socialfetch.dev/platforms/wikipedia/search>
- **Markdown (.mdx) URL:** <https://www.socialfetch.dev/platforms/wikipedia/search.mdx>

---

# Wikipedia Search API

Full-text search with snippets, match ranges and totals on any edition.

`GET /v1/wikipedia/search?query=einstein&lang=en` returns `data.results`, one row per hit. Each row has `pageId`, `ns`, `title`, `size`, `wordCount`, `timestamp`, `snippet`, `matches`, `titleSnippet`, `sectionTitle`, `redirectTitle` and `categorySnippet`. `snippet` is plain text, and `matches` gives the `start`, `end` and `text` of each query match, so you can highlight the hit without parsing markup.

The response also has `totalHits`, `suggestion`, `rewrittenQuery`, `offset`, `limitReached` and the `page` cursor block. The response echoes `query`, and `empty` is true when there are no matches.

`limit` accepts 1 to 500. `offset` accepts 0 to 9999, and `limitReached` is true when a walk stopped at that ceiling instead of at the last result. `sort` accepts relevance (the default), create_timestamp, incoming_links, last_edit, title_natural, just_match, none or random, with an optional `_asc` or `_desc` suffix. `namespace` limits the search to one namespace. Rankings can shift between pages, so a title can repeat at a page boundary; de-duplicate by `pageId`.

## Request

- **Endpoint:** `GET /v1/wikipedia/search`
- **Credits:** 1 credit
Failed requests are free
- **Input:** by query
- **Full reference:** [docs](https://www.socialfetch.dev/docs/api/v1/wikipedia/search/get)
- **Platform page:** [/platforms/wikipedia](https://www.socialfetch.dev/platforms/wikipedia)

## FAQ

### How do I highlight the matched words?

Use data.results[].matches. Each match gives start and end offsets into snippet and the matched text. The snippet is already plain text, so offsets are safe to slice.

### How do I page through results?

Use the cursor from data.page.nextCursor while data.page.hasMore is true. offset is also available for a direct jump, up to 9999. limitReached is true when a walk hit that ceiling.

### Does the query support search operators?

Yes. Operators such as insource:, incategory: and intitle: work. A regular-expression insource:/.../ query can be slow and may time out, so prefer words or insource:"...". query is limited to 300 characters and is required.

### How is search paging billed?

Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged: that field is the billing source of truth. Each paginated page is a separate billed request.
