# Wikipedia Search

Full-text search over Wikipedia articles. Each result carries title, page id, URL, size in bytes, word count, a plain-text snippet, the HTML snippet with match markers and the last update time. total_hits is exact. Search offsets above 10,000 answer 422. Languages: en, de, fr, es, it, pt, nl, ja, ru, pl, sv and zh. Costs 1 credit per successful request.

- **Documentation:** [https://scrappa.co/docs/wikipedia-api/wikipedia_search](https://scrappa.co/docs/wikipedia-api/wikipedia_search)
- **API group:** Wikipedia API
- **Endpoint:** `GET https://scrappa.co/api/wikipedia/search`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `q` | string | Yes | Search text. |
| `language` | string | No | Wikipedia language code: en, de, fr, es, it, pt, nl, ja, ru, pl, sv or zh. Defaults to en. |
| `page` | integer | No | 1-based page. Defaults to 1. |
| `per_page` | integer | No | Results per page, 1-50. Defaults to 20. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/wikipedia/search?q=Albert+Einstein&language=en"
```

## Example response

```json
{
    "success": true,
    "data": {
        "search_parameters": {
            "q": "Albert Einstein",
            "language": "en"
        },
        "total_hits": 7558,
        "page": 1,
        "per_page": 2,
        "has_more": true,
        "results": [
            {
                "title": "Albert Einstein",
                "page_id": 736,
                "url": "https://en.wikipedia.org/wiki/Albert_Einstein",
                "size_bytes": 240568,
                "word_count": 23869,
                "snippet": "Albert Einstein (14 March 1879 \u2013 18 April 1955) was a German-born theoretical physicist best known for developing the theory of relativity. Einstein a...",
                "snippet_html": "<span class=\"searchmatch\">Albert</span> <span class=\"searchmatch\">Einstein</span> (14 March 1879\u00a0\u2013 18 April 1955) was a German-born theoretical physic...",
                "updated_at": "2026-11-03T19:04:40Z"
            }
        ]
    },
    "meta": {
        "endpoint_family": "search",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 503 | Upstream Unavailable | The source could not be fetched after the attempt budget. Never charged. Safe to retry. |
| 500 | Parser Drift | The source returned a shape this parser does not recognise. The incident is reported. Never charged. |
| 422 | Invalid Parameter | A value in this request is invalid or the requested page is out of range. Never charged. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
