legislation.gov.uk API: Search UK legislation
Search UK legislation by topic or title, with optional type and year filters. Closest title matches appear first; broader text matches fill remaining places.
Unofficial. Not affiliated with or endorsed by legislation.gov.uk.
Inputs
Values from the run on Oct 31, 2026, shown under Output.
- Type optional
type Kind of legislation, for example uk_act; any searches every kind.
northern_ireland_act
One of
any,uk_act,statutory_instrument,scottish_act,welsh_act,northern_ireland_act. Defaultany.- Year optional
year Year of enactment or making, for example 2018.
Not set
Whole number from 1000 to 9999.
- Query, required
query Topic or title words to search, for example data protection.
education
- Max Results optional
max_results Maximum laws to return, for example 20.
3
Whole number from 1 to 100. Default
20.
Input as JSON
{ "type": "northern_ireland_act", "query": "education", "max_results": 3}Output
{ "laws": [ { "link": "https://www.legislation.gov.uk/nia/2014/12" , "type": "Northern Ireland Act", "year": 2014, "title": "Education Act (Northern Ireland) 2014", "number": "2014 c. 12 (N.I.)", "enacted_or_made_date": "2014-12-11" }, { "link": "https://www.legislation.gov.uk/nia/2022/15" , "type": "Northern Ireland Act", "year": 2022, "title": "Integrated Education Act (Northern Ireland) 2022", "number": "2022 c. 15 (N.I.)", "enacted_or_made_date": "2022-04-26" }, { "link": "https://www.legislation.gov.uk/nia/2016/20" , "type": "Northern Ireland Act", "year": 2016, "title": "Shared Education Act (Northern Ireland) 2016", "number": "2016 c. 20 (N.I.)", "enacted_or_made_date": "2016-05-09" } ]}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"legislation.gov.uk/search_legislation","input":{"type":"northern_ireland_act","query":"education","max_results":3}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "legislation.gov.uk/search_legislation" , "input": { "type": "northern_ireland_act", "query": "education", "max_results": 3 }})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "legislation.gov.uk/search_legislation" , "input": { "type": "northern_ireland_act", "query": "education", "max_results": 3 } }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run legislation.gov.uk/search_legislation# with {"type":"northern_ireland_act","query":"education","max_results":3}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "required": [ "query" ], "properties": { "type": { "enum": [ "any", "uk_act", "statutory_instrument", "scottish_act", "welsh_act", "northern_ireland_act" ], "type": "string", "default": "any", "description": "Kind of legislation, for example uk_act; any searches every kind." }, "year": { "type": "integer", "maximum": 9999, "minimum": 1000, "description": "Year of enactment or making, for example 2018." }, "query": { "type": "string", "minLength": 1, "description": "Topic or title words to search, for example data protection." }, "max_results": { "type": "integer", "default": 20, "maximum": 100, "minimum": 1, "description": "Maximum laws to return, for example 20." } }}Output schema
{ "type": "object", "required": [ "laws" ], "properties": { "laws": { "type": "array", "items": { "type": "object", "required": [ "title", "year", "type", "number", "enacted_or_made_date", "link" ], "properties": { "link": { "type": "string", "description": "Legislation page link." }, "type": { "type": "string", "description": "Legislation type in words." }, "year": { "type": "integer", "description": "Year of the law." }, "title": { "type": "string", "description": "Name of the law." }, "number": { "type": "string", "description": "Number as cited." }, "enacted_or_made_date": { "type": [ "string", "null" ], "format": "date", "description": "Date enacted or made, if provided." } }, "additionalProperties": false }, "description": "Matching laws, closest title first." } }, "additionalProperties": false}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
legislation.gov.uk/search_legislation- Returns
- title, year, type, number as cited, date enacted or made, link
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method legislation.gov.uk/search_legislation with the inputs above.
Ask your agent
- Find UK Acts of Parliament about modern slavery, with their citation numbers and dates of enactment
- Which statutory instruments made in 2020 relate to coronavirus restrictions? Give me up to 50 with links.
- Search legislation.gov.uk for Scottish Acts on land reform
- I need a list of Welsh laws about the environment from 2016, including the date each was made
- Look up Northern Ireland Acts concerning pensions on legislation.gov.uk and show the top 10 matches
See more
All legislation.gov.uk methodsGets the latest available revised text of a section of a UK Act from legislation.gov.uk, or the Act's section contents when no section is given. The outstanding-changes flag describes the Act and may include changes outside the selected section.
legislation.gov.uk/get_law_sectionSearches EUR-Lex legal acts by topic, ranked by the site's relevance, filtered by document type, year of adoption and in-force status. Short names and ELI links are included when shown in the results.
eur-lex.europa.eu/search_eu_lawSearches UK court judgments and tribunal decisions on Find Case Law by keywords or party names. Results can be filtered by court and by judgment date.
caselaw.nationalarchives.gov.uk/search_judgmentsChecks a name against the current UK Sanctions List and returns possible matches in the site's best-match order, with designation details. Results may include entries that only mention the name in their reasons, so check each entry before identifying anyone.
gov.uk/check_sanctionsLists a UK company's Companies House filings, newest first, with date, form code, type, description, page count and PDF link. Finds the company by name, company number or Companies House link; a category picks accounts, confirmation statements, officers, address, capital, charges or incorporation filings.
find-and-update.company-information.service.gov.uk/list_filing_historySearches the UK Companies House register by company name and returns each company's status, type, incorporation date and registered office address, in result order.
find-and-update.company-information.service.gov.uk/search_companiesGets the official text and key dates of one article of an EU regulation or directive from EUR-Lex, in the latest consolidated version when there is one, in any official EU language.
eur-lex.europa.eu/get_law_articleFind Federal Register rules, proposed rules, notices, and presidential documents by topic, agency, publication dates, and comment status. Significant means designated significant by the source; documents without that designation show no.
federalregister.gov/search_rules