The National Archives

legislation.gov.uk — UK legislation

Full text and metadata of UK legislation — Acts, Statutory Instruments and consolidated versions — served as CLML XML and Atom feeds. Append /data.xml to any document URL. No key required.

Official source United Kingdom no key XML (CLML)
GET www.legislation.gov.uk/{type}/{year}/{number}/data.xml

Verified 2026-09

See the documentation →

About this API

legislation.gov.uk is the official service publishing the legislation of the United Kingdom, run by The National Archives. The API returns the text and metadata of any item by appending a format extension to its URL — /data.xml serves the document in CLML (Crown Legislation Markup Language), while /data.rdf, /data.html and Atom feeds (/data.feed) for tracking new publications are also available. URLs follow a readable {type}/{year}/{number} pattern (e.g. ukpga/2015/26 is the Small Business, Enterprise and Employment Act 2015). The data includes consolidated versions (with some limitations on coverage and currency) and is provided without a key under the Open Government Licence v3.0.

Frequently asked questions

Do I need an API key?

No. Access is fully open — no registration or API key is needed. Just send a GET request to the document URL with the /data.xml extension.

What data does this API return?

The full text and metadata of UK legislation — Acts, Statutory Instruments and consolidated versions — including numbering, commencement dates, document structure and revision history, as XML conforming to the CLML schema.

Can this API be called directly from a browser?

Technically yes — the endpoint returns an open CORS header (Access-Control-Allow-Origin: *), so a browser request will succeed. But the response is a large XML (CLML) document, often several megabytes, rather than compact JSON — not suited to a simple demo button, which is why there is no live tester here. In practice you call this API server-side and parse the XML.

Who runs this API?

The National Archives — the UK's national archive institution. Full developer documentation is available at legislation.gov.uk/developer.