
Wikisource API
Open library texts and page-aligned scans for AI, OCR, and HTR pipelines
Wikisource is a Wikimedia project dedicated to collecting and preserving previously published source texts, with over 6.6 million articles across 80+ language editions. Built and maintained by more than 3,000 active editors since 2003, Wikisource is the free online library of public domain works.
Access Wikisource data through Wikimedia Enterprise APIs to train LLMs, build OCR and Handwritten Text Recognition (HTR) pipelines, and power research across millions of digitized works.
Structured source texts, preserved by people
Wikisource functions differently from a standard wiki, in that most of its data isn't sourced from the community of editors. Its goal is the faithful reproduction of previously published texts. The data provides a deep human-verified corpus that is ideal for models requiring high-quality literary and historical input.
- Page-aligned scans for OCR and HTR ground truth: Most Wikisource works pair machine-readable plain text with the specific page of the original scan (PDF or DjVu). This image-to-text alignment is exactly the structure OCR and Handwritten Text Recognition models need for training and validation. Few public datasets offer this at Wikisource's scale and language coverage.
- A published-only standard: Wikisource strictly hosts previously published works. It contains no vanity press or self-published content. The result is a dataset that reflects professional editorial standards in structure, grammar, and provenance.
- Faithful reproduction: Wikisource transcribes texts exactly as they appeared in the original, with no editorializing or modernization. This preserves historical biases as part of the record, making Wikisource a reliable source for historical and linguistic research.
Specialized data not found elsewhere
Source texts on Wikisource are in the public domain by policy. Wikisource transcriptions and contributor edits are dual-licensed under CC BY-SA and the GNU Free Documentation License. License information is included in every Wikimedia Enterprise API response.
- Multilingual and parallel texts: The multilingual edition of Wikisource is dedicated entirely to hosting texts that appear in multiple languages simultaneously. This includes parallel texts, where a source text and its translation are presented side by side. This is an invaluable dataset for training machine translation engines and linguistic alignment models.
- Rare and constructed languages: Beyond standard global languages, Wikisource preserves texts in classical and historical languages, as well as constructed languages (conlangs). This offers a rare, structured corpus for researchers working on historical languages or linguistic evolution.
- Deep metadata categorization: Wikisource texts are clearly categorized. Both texts and authors can be browsed by era (time period), genre, nationality, and topic, so you can carve out a period or a subject without writing a classifier first.

Source: Alice's Adventures in Wonderland on English Wikisource
What subjects does Wikisource cover?
A Wikisource entry focuses on the primary text. While annotations and translations exist, the original source text is the core of the dataset. The library is massive, including works of Nobel Prize winners, seminal scientific papers, and government archives.
The content is organized into comprehensive categories:
- Law and politics: the texts of constitutions, treaties, and laws from many nations. This includes historical political documents, revolutionary manifestos, and declaration papers.
- Science and academia: historical documents critical to the history of science, covering disciplines such as astronomy, physics, zoology, anatomy, geology, and botany. Many famous seminal texts like Darwin's On the Origin of Species are included.
- Literature: a vast collection of general literature, including modern novels, short stories, horror, children's literature, and science fiction.
- Poetry and drama: extensive collections of poetry from various eras and nations, such as Shakespeare's sonnets and the works of Edgar Allan Poe, alongside dramatic plays.
- Religion and philosophy: the fundamental texts of major world religions, theological commentaries, and philosophical treatises. Often, multiple translations and interpretations of religious texts are included.
- Other media: beyond text, Wikisource also houses collections of comics, films, and audiobooks.
What is the difference between Wikisource and Wikibooks?
Wikibooks is focused on educational material, crowdsourced and curated by its own community. Wikisource puts published primary texts at its core. While Wikibooks also hosts published educational material that is free of copyright, this content is often editorialized to fit the structure and educational goals of Wikibooks. Wikisource aims to provide access to published texts that stay true to the source material, without alterations.
Annotations and translations of published texts exist in both Wikibooks and Wikisource, but in Wikibooks these annotations are the primary focus of the dataset, while they are secondary in Wikisource.
How to access Wikisource data
Access Wikisource data in over 80 languages through the Wikimedia Enterprise APIs. Use the Snapshot API for complete library downloads, or the On-demand API to retrieve specific documents.
Example call to download all of English Wikisource:
curl -L 'https://api.enterprise.wikimedia.com/v2/snapshots/enwikisource_namespace_0/download' \ -H 'Authorization: Bearer ACCESS_TOKEN'Example call to get a specific historical document, the Gettysburg Address:
curl -L 'https://api.enterprise.wikimedia.com/v2/articles/Gettysburg_Address' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ACCESS_TOKEN' \ -d '{"filters":[{"field":"is_part_of.identifier","value":"enwikisource"}]}'Getting a 403: Forbidden error? Sign up for a free Wikimedia Enterprise account and use the Login endpoint to get an access token.
What comes back in a Wikisource response
Every Wikisource text arrives in the same JSON envelope as any other Wikimedia page, so the parser you write once works across every project and every language edition:
article_body.wikitextandarticle_body.htmlhold the transcription, in source markup and rendered form.main_entityandadditional_entitieslink the work to its Wikidata item, which is how you join it to catalog records elsewhere.categoriescarries the era, genre, nationality, and topic classifications the community maintains.versionrecords the revision, its editor, and its size, andlicensestates the terms the text ships under.
The Data Dictionary documents every field, and the API reference has the full schema alongside a live example response.
Frequently Asked Questions
Is there a Wikisource API?
Yes. Wikisource data is available through the Wikimedia Enterprise APIs, built and run by the Wikimedia Foundation. The same access token that reads English Wikisource reads every other language edition, and every other Wikimedia project, through one consistent JSON schema. A free account covers the Snapshot API and the On-demand API.
Is the Wikisource API free?
Yes. A free Wikimedia Enterprise account includes Snapshot downloads and a monthly allowance of On-demand requests, with no credit card. Paid accounts add higher volume, hourly and real-time updates, and production support. See pricing for current limits.
How do I download all of Wikisource?
Use the Snapshot API. Each language edition is published as a bundle named on the pattern enwikisource_namespace_0, refreshed on a schedule, and larger bundles are split into chunks you can pull in parallel. Identifiers explains how a snapshot name is composed.
Can I use Wikisource texts to train an AI model?
Yes. Source texts on Wikisource are in the public domain by policy, and the transcriptions layered on top are dual-licensed under CC BY-SA 4.0 and the GNU Free Documentation License. Both permit commercial use, including model training, provided attribution is preserved and derivative works carry the same license. The license block is part of every API response, so it travels with the data.
Does Wikisource include the original page scans?
Wikisource links its transcribed text to the page of the scanned original it came from, which is what makes it usable as OCR and HTR ground truth. The Wikimedia Enterprise API returns the transcribed text and its metadata; the scans themselves live on Wikimedia Commons and are reachable from the work's own pages.
How is Wikisource different from Project Gutenberg?
Both publish public domain texts. Wikisource additionally keeps the transcription tied to the scanned source page, records a full public edit history for every change, and exposes the whole library through the same API and schema as Wikipedia, Wikidata, and the other Wikimedia projects, so one integration reaches all of them.
Get Started
Access Wikisource, Wikipedia, and the rest of the Wikimedia project data through one unified API with consistent JSON output. Scale your research, OCR, and training pipelines on high-availability infrastructure, and get started with free instant access today.