Wikipedia
Query Wikipedia's free API for summaries, full articles, and search.
Quick Summary
Get a brief summary of any topic:
curl -s "https://en.wikipedia.org/api/rest_v1/page/summary/Python_(programming_language)" | jq '{title, extract}'
Search Articles
Find articles matching a query:
curl -s "https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=artificial+intelligence&format=json" | jq '.query.search[] | {title, snippet}'
Full Article Content
Get full article as HTML:
curl -s "https://en.wikipedia.org/api/rest_v1/page/html/Linux" | head -100
Get as mobile-friendly HTML:
curl -s "https://en.wikipedia.org/api/rest_v1/page/mobile-html/Linux"
Random Article
curl -s "https://en.wikipedia.org/api/rest_v1/page/random/summary" | jq '{title, extract}'
Article Sections
Get table of contents:
curl -s "https://en.wikipedia.org/api/rest_v1/page/mobile-sections/Python_(programming_language)" | jq '.lead.sections[] | {id, line}'
Other Languages
Replace en.wikipedia.org with language code:
# French
curl -s "https://fr.wikipedia.org/api/rest_v1/page/summary/Paris" | jq '{title, extract}'
# German
curl -s "https://de.wikipedia.org/api/rest_v1/page/summary/Berlin" | jq '{title, extract}'
# Japanese
curl -s "https://ja.wikipedia.org/api/rest_v1/page/summary/東京" | jq '{title, extract}'
Related Pages
Get pages that link to an article:
curl -s "https://en.wikipedia.org/w/api.php?action=query&titles=Python_(programming_language)&prop=links&pllimit=20&format=json" | jq '.query.pages[].links[].title'
Tips
- URL-encode spaces as
_or%20 - Article titles are case-sensitive (first letter capitalized)
- No API key required
- Rate limit: be reasonable (no explicit limit for read operations)
