Wikiquote API
Free Wikiquote MediaWiki API with no key: sourced quotations by person, work or topic, with attribution. Random pages and full-text search. Tested example.
Endpoint tested and returned HTTP 200 on 2026-08-20
What is the Wikiquote API?
The Wikiquote API is a free, key-free MediaWiki API providing access to Wikiquote's collection of sourced quotations organised by person, literary work and topic, with citations and attribution.
What distinguishes Wikiquote from novelty quote APIs is sourcing. Quotations carry citations to where they were actually said or written, and misattributed quotes are explicitly flagged in a dedicated section — which matters, because a great many circulating quotes are misattributed.
It uses the standard MediaWiki action API rather than a purpose-built REST interface, so queries are built from `action`, `list` and `prop` parameters. That is more verbose than a bespoke quotes API but far more powerful.
Quick facts
- Base URL
https://en.wikiquote.org/w/api.php- Authentication
- No API key. A descriptive User-Agent is requested by Wikimedia policy.
- Rate limit
- Reasonable use; Wikimedia asks that you cache and identify your client.
- Pricing
- Free. Content is CC BY-SA, so attribution is required.
- CORS
- Not enabled — call it from your server
- Official docs
- Read the docs
How to use the Wikiquote API
Every request below was executed against the live API on 2026-08-20, and the response shown is the real body it returned — not an illustration.
1. Fetch a random Wikiquote page
GET https://en.wikiquote.org/w/api.php?action=query&format=json&list=random&rnnamespace=0&rnlimit=1
curl 'https://en.wikiquote.org/w/api.php?action=query&format=json&list=random&rnnamespace=0&rnlimit=1'const res = await fetch("https://en.wikiquote.org/w/api.php?action=query&format=json&list=random&rnnamespace=0&rnlimit=1");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://en.wikiquote.org/w/api.php?action=query&format=json&list=random&rnnamespace=0&rnlimit=1", timeout=20)
res.raise_for_status()
print(res.json()){
"batchcomplete": "",
"continue": {
"rncontinue": "0.612078488514|0.612124395773|274721|0",
"continue": "-||"
},
"query": {
"random": [
{
"id": 217670,
"ns": 0,
"title": "A Treatise on the Art of Brewing"
}
]
}
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | Required | MediaWiki action, usually `query`. query |
format | string | Required | Set to json. json |
list | string | Optional | random, search or categorymembers. random |
prop | string | Optional | extracts, revisions and similar for page content. extracts |
titles | string | Optional | Page titles to fetch. Albert Einstein |
rnnamespace | integer | Optional | 0 restricts random pages to articles. 0 |
Response fields
query.randomarray- Random page results with id and title.
query.searcharray- Search results with snippets.
query.pagesobject- Page content keyed by page id.
continueobject- Continuation token for paging through results.
batchcompletestring- Present when the batch finished.
What you can build with the Wikiquote API
- Build a sourced quotations feature with proper attribution
- Find verified quotes by a specific person
- Check whether a famous quote is actually misattributed
- Create literature and history teaching resources
Common errors and how to fix them
Content is wikitext, not plain text
MediaWiki returns markup.
Fix: Use prop=extracts with explaintext=1 for plain text, or parse the wikitext.
Random page is not a quotation page
Namespace not restricted.
Fix: Pass rnnamespace=0 to get articles rather than talk or template pages.
Quote may be misattributed
Wikiquote flags disputed attributions.
Fix: Check for a Misattributed section before presenting a quote as genuine — many circulating quotes are wrong.
Wikiquote API — frequently asked questions
Is the Wikiquote API free?
Yes, free with no API key. Content is CC BY-SA, so attribution is required, and Wikimedia asks for a descriptive User-Agent.
Why use Wikiquote over a simple quotes API?
Sourcing. Wikiquote cites where a quote actually appeared and explicitly flags misattributed ones, which matters because a large share of circulating quotes are wrongly attributed.
How do I get plain text instead of wikitext?
Use prop=extracts with explaintext=1, which strips MediaWiki markup and returns readable text.
Can I get quotes for a specific person?
Yes, query their page title directly, or use list=search to find the right page first.
Tools that pair with this API
Word Counter
Count words, characters, sentences, paragraphs and estimated reading time instantly. Free online word counter for essays, blogs and social media.
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
Wikiquote is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-20; always check the official documentation before relying on this API in production, as terms and limits can change.