Legislation.gov.uk
Legislation.gov.uk is the official home of the UK statute book, managed by The National Archives. It publishes primary legislation (Acts of the UK Parliament and the devolved legislatures in Scotland, Wales, and Northern Ireland) alongside secondary legislation (statutory instruments), stretching from medieval statutes still in force through to laws passed this year. Crucially, many items exist in more than one version: the law as originally enacted, and the current consolidated text with later amendments folded in.
Everything is available as structured XML built on the Crown Legislation Markup Language, and as linked data, where every Act, section, and subsection has its own stable web address. Add "/data.xml" to almost any page URL and you get the machine-readable version of that provision back. A documented interface lets you pull content in bulk, so you can load whole Acts, or just the sections you need, rather than scraping HTML pages one at a time.
This structure is a gift for RAG. Because each provision is individually addressable, you can chunk at the section level and cite the exact clause a model relied on, rather than pointing at a whole document. The point-in-time feature lets you retrieve the law as it stood on a given date, which matters when you are reasoning about events that happened under an earlier version of a statute.
Two caveats. Coverage of the fully up-to-date consolidated text is not complete: some amendments are still being applied, and pages flag outstanding changes, so do not assume the "current" version is always fully revised. Revised text is also mostly limited to legislation from 1991 onward. On licence, the content sits under the Open Government Licence v3.0, which lets you copy, adapt, and reuse it commercially, provided you credit the source and link to the licence. For UK legal RAG this is the primary source; add a case law service such as the National Archives' Find Case Law for court judgments alongside it.
Related sources
AustLII
A free resource of medium-neutral case law and unreported judgments for all Australian jurisdictions, covering the whole country since 1995.
Awesome LegalTech
A curated list of legal technology resources: open-source platforms, AI models, companies, datasets, and tools spanning the global legal ecosystem. Useful for tracking new entrants in a fast-moving space.
BAILII (British and Irish Legal Information Institute)
Free access to British and Irish primary legal materials, covering UK and Ireland case law and legislation. Alongside the National Archives, one of the main free sources for reading UK judgments.
Cambridge Law Corpus
A research dataset of more than 250,000 UK court cases, mostly from the 21st century but with some reaching back to the 16th century. Built by the University of Cambridge for legal natural language processing work, it is available under restricted access for research use.