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 | ukpga (Act), uksi (SI). Also accepted but not yet loaded — returns no results: ukla, wsi, ssi, nisi, nisr, asp, asc, 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 | ukpga (Act), uksi (SI). Also accepted but not yet loaded — returns no results: ukla, wsi, ssi, nisi, nisr, asp, asc, ukdsi |
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. Imports have landed in sporadic batches, so the corpus backfill remains partial and expanding. Contains public sector information licensed under the Open Government Licence v3.0.
Data Coverage
| Source | legislation.gov.uk (The National Archives) |
| Date range | Partial and expanding |
| Records | ~2,800 UK Public General Acts and Statutory Instruments (coverage expanding) |
| Updated | Sync scheduled every Sunday at 10am; observed imports are sporadic batches |
| Limitations | Backfill is partial and expanding: only ukpga and uksi currently contain data, with roughly 70 SIs per year loaded versus thousands published. |