Legislation API Reference
Search and retrieve UK legislation from legislation.gov.uk.
Base URL: https://api.govdata.dev/v1
Search Legislation
GET
/v1/legislation/search
response
Waiting for request...
Full-text search across UK legislation. Filter by type and year.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q |
string | Yes | Search query (matches title and content) |
type |
string | No | One of ukpga, uksi, ukla, wsi, ssi, nisi, nisr, asp, asc, or ukdsi |
year |
integer | No | Year of enactment (e.g. 2025) |
page |
integer | No | Page number (default 1, 20 results per page) |
curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.govdata.dev/v1/legislation/search?q=finance&type=ukpga&year=2025"
uri = URI("https://api.govdata.dev/v1/legislation/search?q=finance&type=ukpga&year=2025") req = Net::HTTP::Get.new(uri) req["Authorization"] = "Bearer YOUR_API_KEY" res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |h| h.request(req) }
response = requests.get( "https://api.govdata.dev/v1/legislation/search", headers={"Authorization": "Bearer YOUR_API_KEY"}, params={"q": "finance", "type": "ukpga", "year": 2025} )
const url = new URL("https://api.govdata.dev/v1/legislation/search"); url.searchParams.set("q", "finance"); url.searchParams.set("type", "ukpga"); url.searchParams.set("year", "2025"); const response = await fetch(url, { headers: { "Authorization": "Bearer YOUR_API_KEY" } });
Response
{ "data": [ { "identifier": "ukpga/2025/12", "legislation_type": "ukpga", "type_name": "UK Public General Act", "year": 2025, "number": 12, "title": "Finance Act 2025", "enacted_date": "2025-03-20", "description": "An Act to grant certain duties, to alter other duties, and to amend the law relating to the national debt and the public revenue.", "commencement_date": null, "url": "https://www.legislation.gov.uk/ukpga/2025/12" } ], "meta": { "api_version": "v1", "licence": "Open Government Licence v3.0", "source": "The National Archives", "source_url": "https://www.legislation.gov.uk" }, "pagination": { "page": 1, "per_page": 25, "total": 1, "total_pages": 1 } }
Get Legislation
GET
/v1/legislation/:type/:year/:number
response
Waiting for request...
Retrieve a specific piece of legislation by type, year, and number.
Path parameters
| Parameter | Type | Description |
|---|---|---|
type |
string | Any of the ten type codes listed above |
year |
integer | Year of enactment |
number |
integer | Legislation number within that year |
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://api.govdata.dev/v1/legislation/ukpga/2025/8
uri = URI("https://api.govdata.dev/v1/legislation/ukpga/2025/8") req = Net::HTTP::Get.new(uri) req["Authorization"] = "Bearer YOUR_API_KEY" res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |h| h.request(req) }
response = requests.get( "https://api.govdata.dev/v1/legislation/ukpga/2025/8", headers={"Authorization": "Bearer YOUR_API_KEY"} )
const response = await fetch("https://api.govdata.dev/v1/legislation/ukpga/2025/8", { headers: { "Authorization": "Bearer YOUR_API_KEY" } });
Response
{ "data": { "identifier": "ukpga/2025/12", "legislation_type": "ukpga", "type_name": "UK Public General Act", "year": 2025, "number": 12, "title": "Finance Act 2025", "enacted_date": "2025-03-20", "description": "An Act to grant certain duties, to alter other duties, and to amend the law relating to the national debt and the public revenue.", "commencement_date": null, "url": "https://www.legislation.gov.uk/ukpga/2025/12" }, "meta": { "api_version": "v1", "licence": "Open Government Licence v3.0", "source": "The National Archives", "source_url": "https://www.legislation.gov.uk/ukpga/2025/8" } }
Legislation data is sourced from The National Archives with a sync scheduled every Sunday at 10am. All ten documented series are synchronised for 2000 to the present year. Contains public sector information licensed under the Open Government Licence v3.0.
Data Coverage
| Source | legislation.gov.uk (The National Archives) |
| Date range | 2000–present for all ten series (or the series' later inception) |
| Records | About 96,000 published series/year results through 2026: ukpga 938; uksi 51,969; wsi 6,735; ssi 11,280; nisi 114; nisr 9,050; asp 401; asc 34; ukla 67; ukdsi 5,402 |
| Updated | Weekly; historical backfill is resumable by type and year |
| Limitations | legislation.gov.uk's UKSI browse total includes Welsh SIs, so published series totals overlap. GovData stores each canonical identifier once under its canonical type. Draft instruments (ukdsi) can be withdrawn or replaced; local Acts (ukla) are sparse and some years have no publications. |