APIs / Apps and media / Wikipedia

1 credit per call2 endpoints8 datapointsChecked working 6 Dec 2026

Wikipedia API

Wikipedia API for article search and article content as JSON in 12 languages, with snippets, word counts and edit dates. 1 credit per successful call.

Wikipedia
GET/v1/wikipedia/search?q=Albert+Einstein&language=en
{
  "success": true,
  "data": {
    "search_parameters": {
      "q": "Albert Einstein",
      "language": "en"
    },
    "total_hits": 7560,
    "page": 1,
    "per_page": 20,
    "has_more": true,
    "results": [
      {
        "title": "Albert Einstein",
        "page_id": 736,
        "url": "https://en.wikipedia.org/wiki/Albert_Einstein",
        "size_bytes": 240550,
        "word_count": 24016,
        "snippet": "Albert Einstein (14 March 1879 – 18 April 1955) was a German-born theoretical physicist best known for developing the theory of relativity. Einstein also",
        "snippet_html": "<span class=\"searchmatch\">Albert</span> <span class=\"searchmatch\">Einstein</span> (14 March 1879 – 18 April 1955) was a German-born theoretical physicist best known for developing the theory of relativity. <span class=\"searchmatch\">Einstein…",
        "updated_at": "2026-11-09T12:38:29Z"
      },
      {
        "title": "Hans Albert Einstein",
        "page_id": 1373258,
        "url": "https://en.wikipedia.org/wiki/Hans_Albert_Einstein",
        "size_bytes": 14413,
        "word_count": 1222,
        "snippet": "Hans Albert Einstein (May 14, 1904 – July 26, 1973) was a Swiss-American engineer, the second child and first son of physicists Albert Einstein and Mileva",
        "snippet_html": "Hans <span class=\"searchmatch\">Albert</span> <span class=\"searchmatch\">Einstein</span> (May 14, 1904 – July 26, 1973) was a Swiss-American engineer, the second child and first son of physicists <span class=\"searchmatch\">Albert</span> <span …",
        "updated_at": "2026-09-01T00:57:53Z"
      },
      {
        "title": "Einstein family",
        "page_id": 18742711,
        "url": "https://en.wikipedia.org/wiki/Einstein_family",
        "size_bytes": 33129,
        "word_count": 3522,
        "snippet": "The Einstein family is the family of physicist Albert Einstein (1879–1955). Einstein's fourth-great-grandfather, Jakob Weil, was his oldest recorded relative",
        "snippet_html": "The <span class=\"searchmatch\">Einstein</span> family is the family of physicist <span class=\"searchmatch\">Albert</span> <span class=\"searchmatch\">Einstein</span> (1879–1955). <span class=\"searchmatch\">Einstein&#039;s</span> fourth-great-gra…",
        "updated_at": "2026-11-08T17:16:17Z"
      }
    ]
  },
  "meta": {
    "endpoint_family": "search",
    "request_id": "req_84b4048f2c8d48f2b88a39e61725f737",
    "credits_charged": 1,
    "credits_remaining": 1775
  }
}
200 OKJSONX-Credits-Used: 1
Recorded from our API and shortened.

Sample data

What one call returns

A recorded run of search: the fields and shapes you will get, shortened to 3 items.

#titlestringpage_idintegerurlurlsize_bytesintegerword_countintegersnippetstringsnippet_htmlstringupdated_atstring
1Albert Einstein736https://en.wikipedia.org/wiki/Albert_Einstein24055024016Albert Einstein (14 March 1879 – 18 April 1955) was a German-born theoretical physicist best known for developing the theory of relativity. Einstein also<span class="searchmatch">Albert</span> <span class="searchmatch">Einstein</span> (14 March 1879 – 18 April 1955) was a German-born theoretical physicist best known for developing the theory of relativity. <span class="searchmatch">Einstein…2026-11-09T12:38:29Z
2Hans Albert Einstein1373258https://en.wikipedia.org/wiki/Hans_Albert_Einstein144131222Hans Albert Einstein (May 14, 1904 – July 26, 1973) was a Swiss-American engineer, the second child and first son of physicists Albert Einstein and MilevaHans <span class="searchmatch">Albert</span> <span class="searchmatch">Einstein</span> (May 14, 1904 – July 26, 1973) was a Swiss-American engineer, the second child and first son of physicists <span class="searchmatch">Albert</span> <span …2026-09-01T00:57:53Z
3Einstein family18742711https://en.wikipedia.org/wiki/Einstein_family331293522The Einstein family is the family of physicist Albert Einstein (1879–1955). Einstein's fourth-great-grandfather, Jakob Weil, was his oldest recorded relativeThe <span class="searchmatch">Einstein</span> family is the family of physicist <span class="searchmatch">Albert</span> <span class="searchmatch">Einstein</span> (1879–1955). <span class="searchmatch">Einstein&#039;s</span> fourth-great-gra…2026-11-08T17:16:17Z

Recorded from our API · 3 items shown · 8 datapoints per itemGET /v1/wikipedia/search?q=Albert+Einstein&language=en

8 datapoints

Identity

  • titlestring
  • page_idinteger

Contact

  • urlurl

Other

  • size_bytesinteger
  • word_countinteger
  • snippetstring
  • snippet_htmlstring
  • updated_atstring

Playground

Run this API

cURLshell
curl "https://api.perceptlayer.com/v1/wikipedia/search?q=Albert+Einstein&language=en" \
  -H "X-API-Key: $API_KEY"

Wikipedia · 2 endpoints

Endpoints

Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.

EndpointRequired parametersReturnsCost
GET/v1/wikipedia/article
title+1 optional
JSON1 credit
GET/v1/wikipedia/search
q+3 optional
titlepage_idurlsize_bytesword_countsnippet+2 more
1 credit

Overview

About the Wikipedia API

What you can get

The Wikipedia API returns Wikipedia search results and articles as JSON through 2 endpoints. Both take a language of en, de, fr, es, it, pt, nl, ja, ru, pl, sv or zh.

  • Search: search takes a q, with language, page and per_page.
  • Articles: article takes a title, with language.

The recorded search for "Albert Einstein" in English returns results, each with title, page_id, url, size_bytes, word_count, snippet, snippet_html and updated_at. It also returns search_parameters, total_hits, page, per_page and has_more.

How a call works

Search, then read: GET /v1/wikipedia/search?q=Albert Einstein&language=en, with your key in the X-API-Key header, returns each article's title. Pass a title to article, for example GET /v1/wikipedia/article?title=Albert Einstein&language=en. Check has_more before asking for the next page. Every successful call costs 1 credit; failed calls cost nothing.

Apps and mediaJSONRESTMCP

More apps and media APIs

Use cases

Ground an agent's answers in a Wikipedia article

Use the Wikipedia API to ground an agent's answers in a Wikipedia article

Find articles on a topic in one of 12 languages

Use the Wikipedia API to find articles on a topic in one of 12 languages

Compare how an article is covered across language editions

Use the Wikipedia API to compare how an article is covered across language editions

Build entity pages from article titles, snippets and links

Use the Wikipedia API to build entity pages from article titles, snippets and links

FAQ

Questions

How much does the Wikipedia API cost?

Each successful call costs one credit, and each search page is one call. New accounts get free credits to start, and credit packs bring the price down as you scale.

Which languages are supported?

Pass `language` as en, de, fr, es, it, pt, nl, ja, ru, pl, sv or zh to `search` or `article`.

What format are responses in?

Every endpoint returns JSON, with no HTML parsing on your side.

Is this the official Wikipedia API?

No. Perceptlayer is an independent service and is not affiliated with Wikipedia. It returns Wikipedia data as JSON with a Perceptlayer key, so there is no Wikipedia developer account, app review or partner approval to get first. It only reads data: if Wikipedia has an official API and you need to act on your own Wikipedia account, such as posting, managing orders or reading private data, use that one.

Should I build a Wikipedia scraper instead?

You can, but a Wikipedia scraper is code you maintain: page changes break it, requests get blocked, and Wikipedia's terms govern how you collect data. The Wikipedia API gives you 2 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first.

Try the Wikipedia API with 100 free credits

No credit card. Failed calls are never billed.