Wikipedia API

⭐ Beginner's Pick Open Data / No Auth Required Beginner HTTPS
Free to Use Varies (check documentation)

Overview

The Wikipedia API (MediaWiki API) gives you programmatic access to Wikipedia articles, search functionality, page metadata, and revision history—completely free with no authentication required for read operations. It supports JSON responses and is easy to call from any language with a simple HTTP GET request. Whether you want to fetch article summaries, search for pages, or retrieve full wikitext, this API makes it straightforward.

💡

Beginner Tip

Use the REST API endpoint https://en.wikipedia.org/api/rest_v1/page/summary/{title} for the simplest way to get a plain-text article summary—no OAuth or query parameters needed, just replace {title} with the article name.

Available Data

Use case: Integrate mediawiki encyclopedia data into web and mobile applications
Wikipedia data via REST API
JSON-formatted response data
Freely accessible without authentication

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from Wikipedia",
    "description": "Mediawiki Encyclopedia",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

title The canonical title of the Wikipedia article.
extract Plain-text summary of the article, typically the first paragraph.
pageid Unique numeric identifier for the Wikipedia page, stable across title changes.
thumbnail URL and dimensions of the article's lead image thumbnail, if available.
content_urls URLs to the full article on desktop and mobile Wikipedia, and to the API endpoint.
lang Language code of the Wikipedia edition, e.g., en for English, fr for French.

Implementation Example

const url = "https://www.mediawiki.org/wiki/API:Main_page";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

404 Not Found The article title is misspelled or uses incorrect capitalization (Wikipedia titles are case-sensitive after the first character).
Use the search endpoint first (?action=query&list=search&srsearch=your+term) to find the exact title, then fetch the article.
Disambiguation page returned instead of article The title matches a disambiguation page that lists multiple possible articles.
Append the topic in parentheses to disambiguate, e.g., Mercury_(planet) instead of Mercury, or parse the disambiguation list to present options to the user.
Rate limiting or blocks on high-volume requests Sending many requests rapidly without a proper User-Agent header.
Always include a descriptive User-Agent header identifying your app (e.g., MyApp/1.0 ([email protected]))—this is required by Wikipedia's API policy.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 20/20
🔒 Security 15/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 169ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Open Data
Difficulty Beginner
Verified: 2026-04-04

Similar APIs

View All →