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), asp (Scotland), anaw (Wales), nia (NI) |
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": { "results": [ { "type": "ukpga", "year": 2025, "number": 8, "title": "Finance Act 2025", "enacted_date": "2025-03-20", "url": "https://www.legislation.gov.uk/ukpga/2025/8" }, { "type": "ukpga", "year": 2025, "number": 15, "title": "Finance (No. 2) Act 2025", "enacted_date": "2025-07-22", "url": "https://www.legislation.gov.uk/ukpga/2025/15" } ], "pagination": { "page": 1, "per_page": 20, "total": 2 } }, "meta": { "api_version": "v1", "licence": "Open Government Licence v3.0", "source": "The National Archives", "source_url": "https://www.legislation.gov.uk" } }
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, uksi, asp, anaw, nia |
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": { "type": "ukpga", "year": 2025, "number": 8, "title": "Finance Act 2025", "enacted_date": "2025-03-20", "url": "https://www.legislation.gov.uk/ukpga/2025/8", "sections": [ { "number": "1", "title": "Income tax charge and rates" }, { "number": "2", "title": "Corporation tax charge and main rate" }, { "number": "3", "title": "Capital gains tax" } ], "schedules_count": 12, "status": "enacted" }, "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 and synced daily. 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 (after backfill) |
| Records | ~50K Acts and Statutory Instruments |
| Updated | Weekly (Sunday) |
| Limitations | UK Public General Acts and Statutory Instruments only. Does not include Welsh, Scottish, or NI-specific legislation. |