# legislation.gov.uk API

> legislation.gov.uk returns UK law search results and Act text as a workflow and API.

legislation.gov.uk returns revised Act section text or Act contents; Get law section needs an Act title or identifier and optionally a section number. Search legislation returns laws matching topic or title words, with optional legislation type and year filters.

- Page: https://fous.com/tools/legislation-gov-uk
- Handle: `@legislation-gov-uk`
- Category: [Legal](https://fous.com/tools/category/legal)
- Source website: https://legislation.gov.uk
- Last verified: Sep 29, 2026

## Methods

### Get law section

Operation `get_law_section`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Get the latest available revised text of a section of a UK Act, or its section contents when no section is given. The outstanding-changes flag describes the Act and may include changes outside the selected section. Some older Acts are not available as structured text.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `act` | string | yes | `"Equality Act 2010"` | Act title, with year if known; for example, Equality Act 2010. A legislation.gov.uk Act link or ID also works. |
| `section` | string | no | `"13"` | Section number, such as 13. Leave blank to get the Act contents. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "act"
  ],
  "properties": {
    "act": {
      "type": "string",
      "description": "Act title, with year if known; for example, Equality Act 2010. A legislation.gov.uk Act link or ID also works.",
      "examples": [
        "Equality Act 2010",
        "Employment Rights Act 1996"
      ]
    },
    "section": {
      "type": "string",
      "default": "",
      "description": "Section number, such as 13. Leave blank to get the Act contents.",
      "examples": [
        "13",
        "94",
        "14"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "act": "Equality Act 2010",
      "section": "13"
    },
    {
      "act": "Equality Act 2010"
    },
    {
      "act": "Employment Rights Act 1996",
      "section": "94"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `link` | string | `"https://www.legislation.gov.uk/ukpga/2010/15/section/13"` |  |
| `text` | string or null | `"(1) An employee has the right not to be unfairly dismissed by his employer.\n(2) Subsection (1) has effect subject to t` |  |
| `year` | integer | `2010` |  |
| `title` | string | `"Equality Act 2010"` |  |
| `extent` | string or null | `"England, Wales, Scotland"` |  |
| `heading` | string or null | `"Direct discrimination"` |  |
| `contents` | array or null |  |  |
| `contents[].link` | string | `"https://www.legislation.gov.uk/ukpga/2010/15/section/1"` |  |
| `contents[].number` | string | `"1"` |  |
| `contents[].heading` | string | `"Public sector duty regarding socio-economic inequalities"` |  |
| `in_force` | boolean or null | `true` |  |
| `version_date` | string or null | `"2024-01-01"` |  |
| `chapter_number` | integer | `15` |  |
| `section_number` | string or null | `"13"` |  |
| `prospective_note` | string or null | `"Prospective provision; not yet in force."` |  |
| `changes_still_to_be_applied` | boolean or null | `true` |  |

**Example input**

```json
{
  "act": "Equality Act 2010",
  "section": "13"
}
```

**Example output**

```json
{
  "link": "https://www.legislation.gov.uk/ukpga/2010/15/section/13",
  "text": "(1) A person (A) discriminates against another (B) if, because of a protected characteristic, A treats B less favourably than A treats or would treat others.\n(2) If the protected characteristic is age…",
  "year": 2010,
  "title": "Equality Act 2010",
  "extent": "England, Wales, Scotland",
  "heading": "Direct discrimination",
  "contents": null,
  "in_force": true,
  "version_date": "2024-01-01",
  "chapter_number": 15,
  "section_number": "13",
  "prospective_note": null,
  "changes_still_to_be_applied": true
}
```

### Search legislation

Operation `search_legislation`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Search UK legislation by topic or title, with optional type and year filters. Closest title matches appear first; broader text matches fill remaining places.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `type` | string | no | `"uk_act"` | Kind of legislation, for example uk_act; any searches every kind. |
| `year` | integer | no | `2018` | Year of enactment or making, for example 2018. |
| `query` | string | yes | `"minimum wage"` | Topic or title words to search, for example data protection. |
| `max_results` | integer | no | `5` | Maximum laws to return, for example 20. |

**Input schema**

```json
{
  "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.",
      "examples": [
        "uk_act",
        "welsh_act"
      ]
    },
    "year": {
      "type": "integer",
      "maximum": 9999,
      "minimum": 1000,
      "description": "Year of enactment or making, for example 2018.",
      "examples": [
        2018
      ]
    },
    "query": {
      "type": "string",
      "minLength": 1,
      "description": "Topic or title words to search, for example data protection.",
      "examples": [
        "minimum wage",
        "data protection",
        "education"
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 20,
      "maximum": 100,
      "minimum": 1,
      "description": "Maximum laws to return, for example 20.",
      "x-fous-developer": true,
      "examples": [
        5,
        3
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "query": "minimum wage"
    },
    {
      "type": "uk_act",
      "year": 2018,
      "query": "data protection"
    },
    {
      "type": "welsh_act",
      "query": "education",
      "max_results": 5
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `laws` | array |  | Matching laws, closest title first. |
| `laws[].link` | string | `"https://www.legislation.gov.uk/ukpga/1998/39"` | Legislation page link. |
| `laws[].type` | string | `"UK Public General Act"` | Legislation type in words. |
| `laws[].year` | integer | `1998` | Year of the law. |
| `laws[].title` | string | `"National Minimum Wage Act 1998"` | Name of the law. |
| `laws[].number` | string | `"1998 c. 39"` | Number as cited. |
| `laws[].enacted_or_made_date` | string or null | `"1998-07-31"` | Date enacted or made, if provided. |

**Example input**

```json
{
  "query": "minimum wage"
}
```

**Example output**

```json
{
  "laws": [
    {
      "link": "https://www.legislation.gov.uk/ukpga/1998/39",
      "type": "UK Public General Act",
      "year": 1998,
      "title": "National Minimum Wage Act 1998",
      "number": "1998 c. 39",
      "enacted_or_made_date": "1998-07-31"
    },
    {
      "link": "https://www.legislation.gov.uk/uksi/2015/621",
      "type": "UK Statutory Instrument",
      "year": 2015,
      "title": "The National Minimum Wage Regulations 2015",
      "number": "S.I. 2015/621",
      "enacted_or_made_date": "2015-03-09"
    },
    {
      "link": "https://www.legislation.gov.uk/uksi/2026/357",
      "type": "UK Statutory Instrument",
      "year": 2026,
      "title": "The National Minimum Wage (Amendment) Regulations 2026",
      "number": "S.I. 2026/357",
      "enacted_or_made_date": "2026-03-19"
    }
  ]
}
```

## Quick start

Replace `YOUR_API_KEY` with a Fous API key. To create one, open Developers at the bottom of Fous Studio, turn on Developer mode, then go to API keys (https://app.fous.com/keys). Change the values in `input` to run the same tool on new data.

```bash
curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 180 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@legislation-gov-uk",
  "visibility": "public",
  "operation": "get_law_section",
  "version": 1,
  "input": {
    "act": "Equality Act 2010",
    "section": "13"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
import json
import urllib.error
import urllib.request

api_key = "YOUR_API_KEY"

body = json.loads("{\n  \"api\": \"@legislation-gov-uk\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_law_section\",\n  \"version\": 1,\n  \"input\": {\n    \"act\": \"Equality Act 2010\",\n    \"section\": \"13\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=180) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
const apiKey = "YOUR_API_KEY";

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(180_000),
  body: JSON.stringify({
  "api": "@legislation-gov-uk",
  "visibility": "public",
  "operation": "get_law_section",
  "version": 1,
  "input": {
    "act": "Equality Act 2010",
    "section": "13"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

## Use from an AI assistant

Connect this tool to Claude Code, Claude Desktop, Cursor, VS Code, Codex and any MCP client as its own MCP server. Each method is a typed tool whose arguments are the method’s input.

- Server URL: `https://api.fous.com/mcp/tools/legislation-gov-uk`
- Authorization: `Authorization: Bearer <Fous API key>`

**Tools**

- `get_law_section`: Get law section. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `search_legislation`: Search legislation. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `fous_get_run`: the result of a run that was still going, by its `request_id`. Free.

Claude Code:

```bash
claude mcp add --scope user --transport http fous-legislation-gov-uk https://api.fous.com/mcp/tools/legislation-gov-uk --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"
```

To give the assistant every tool, connect `https://api.fous.com/mcp`: it finds one with `fous_search_tools` and runs it with `fous_run_tool`. Setup for other clients: https://fous.com/llms-full.txt.

## Use cases

- Find laws by topic or title
- Filter law searches by year or type
- Retrieve revised text for an Act section
- Review an Act’s contents without choosing a section

## FAQ

### Can I run it with my own inputs?

Yes. Change the inputs in Studio and press Run, or send new inputs from your code, or ask a connected AI assistant.

### Can I call this legislation.gov.uk tool as an API?

Yes. Send a POST request to /v1/query with your Fous API key and the inputs, and get JSON back.

### How much does it cost?

Each completed run costs 1 credit. Failed runs without a completed receipt are free; completed work can remain charged if delivery is interrupted. With pay as you go, a credit costs 1¢. Monthly plans cost less per credit.

### Do I need a legislation.gov.uk account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from legislation.gov.uk when you run it. Some results are reused for up to 24 hours, and results that use your account or key are never reused. It was last verified on Sep 29, 2026.

### How can I find legislation by topic or title?

Use Search legislation with topic or title words, and optionally filter by type or year.

### How can I retrieve an Act section?

Use Get law section with an Act title or identifier and a section number.

### Can I get Act contents without a section number?

Yes. Use Get law section with an Act title or identifier and leave the section number blank.

## Related

- [EUR-Lex API](https://fous.com/tools/eur-lex.md): EUR-Lex provides official EU legislation, relevance-ranked filtered searches, and article text from the latest consolidation when available, with stated general application dates.
- [Find Case Law API](https://fous.com/tools/find-case-law.md): Search official UK court judgments and tribunal decisions from The National Archives.
- [Congress.gov API](https://fous.com/tools/congress-gov.md): Congress.gov returns federal bills and resolutions matching topic, Congress, status, or chamber, and provides an individual bill’s status, summary, titles, actions, and related bills; summaries may be unavailable.
- [GOV.UK API](https://fous.com/tools/gov-uk.md): GOV.UK provides summarized current travel advice with linked details, published regional holidays (none for unpublished years), and possible matches on the current UK Sanctions List.
- [BBC News API](https://fous.com/tools/bbc-news.md): BBC News returns section-ordered headlines, searchable articles with dates, authors and sections (filters/newest sorting cover 180 matches), and article text with available latest live entries.
- [Federal Register API](https://fous.com/tools/federal-register.md): Search United States federal rules, proposed rules, notices, and presidential documents.
- [Companies House API](https://fous.com/tools/companies-house.md): Companies House returns UK public-register company details, officers, people with significant control and recent filings; records may be incomplete, and ceased entries are optional.
- [eCFR API](https://fous.com/tools/ecfr.md): Official continuously updated Code of Federal Regulations.
- [All Legal tools](https://fous.com/tools/category/legal)
