· 2 min read

Wikipedia summary and infobox as JSON, in any language edition, for RAG and agents

Lead paragraphs as plain text, the thumbnail and the infobox as key/value pairs, in any language edition, from one request. Stored 7 days.

site endpointsrag & agents

In short

  • GET /v1/structured/wikipedia/summary?title=…&lang=en returns title, url, summary (the first paragraph), paragraphs[] (the whole lead section), thumbnail and infobox {}.
  • Reference marks, edit links and hatnotes are stripped, so paragraphs drop straight into a prompt.
  • Any language edition works with lang; the same shape comes back for en, ko, ja, de and the rest.

Most retrieval pipelines need the same thing from Wikipedia: a reliable few paragraphs about a named thing, plus the facts in the box on the right. The official REST summary gives you one paragraph and no box. This endpoint gives you the lead section and the infobox, cleaned, in any edition.

The request

curl "https://api.webscrapingapi.dev/v1/structured/wikipedia/summary?title=Web%20scraping&lang=en" \
  -H "X-API-Key: wsa_your_key"

title is the article title, with spaces or underscores. lang is the edition and defaults to en.

The response

{
  "site": "wikipedia",
  "action": "summary",
  "data": {
    "title": "Web scraping",
    "url": "https://en.wikipedia.org/wiki/Web_scraping",
    "lang": "en",
    "summary": "Web scraping, web harvesting, or web data extraction is data scraping used for extracting data from websites. …",
    "paragraphs": ["Web scraping, web harvesting, or web data extraction is …", "Web scraping a web page involves fetching it and extracting from it. …", "…"],
    "thumbnail": null,
    "infobox": {}
  },
  "source": "cache",
  "age": 3120,
  "credits": 0
}

summary is the first paragraph; paragraphs is the whole lead section in order. Citation marks like [3], the “[edit]” links and hatnotes (“For other uses, see…”) are removed, so the text reads the way a person would read it aloud. thumbnail is the lead image when the article has one. infobox is the box on the right as plain label: value pairs; a country article gives you capital, population and area, a person gives you born, occupation and known for, and an article with no box gives {}.

Other editions

curl "https://api.webscrapingapi.dev/v1/structured/wikipedia/summary?title=%EC%9B%B9%20%EC%8A%A4%ED%81%AC%EB%9E%98%ED%95%91&lang=ko" \
  -H "X-API-Key: wsa_your_key"

The shape is identical across editions. Titles are edition-specific, so ask for the Korean title on ko and the Japanese title on ja; the endpoint does not translate titles.

Freshness and cost

Lead sections change rarely and slowly, so answers are stored for 7 days and shared with everyone. The first request for an article costs 1 credit; the rest of the week costs nothing. If an article is in the news and you want today’s revision, max_age=0 fetches it fresh.

Using it in a pipeline

For an agent that has to answer “what is X” or “who is Y”, the lead section is the right granularity: a few hundred words, written to be read first, in the language your user asked in. Fetch it, put paragraphs in the prompt, and keep url for the citation. When a task genuinely needs the whole article, call /v1/scrape with format=markdown on the url you got back; the sections, tables and links come through as markdown. The reference page has the details.

Questions people ask

How is this different from the Wikipedia REST API's page/summary?
That endpoint returns one extract paragraph. This one returns every paragraph of the lead section plus the infobox as key/value pairs, which the REST summary does not include.
Do I get the whole article?
No, the lead section: everything before the first heading. For a model that needs to identify or describe a thing, the lead is usually the right amount. For full text, use /v1/scrape with format=markdown on the article URL.
What is in infobox?
The right-hand table's rows as { label: value } with plain-text values. Articles without an infobox return an empty object.
Spaces or underscores in the title?
Either. The title is encoded for you; Web scraping and Web_scraping are the same article.