# 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/workflows/legislation-gov-uk
- Handle: `@legislation-gov-uk`
- Category: [Legal](https://fous.com/workflows/category/legal)
- Source website: https://legislation.gov.uk
- Last verified: Sep 29, 2026
- Fous is not affiliated with legislation.gov.uk.

## Methods

### Get law section

Operation `get_law_section`, version 1. 1 credit per call.

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 |  |  |
| `contents[].number` | string |  |  |
| `contents[].heading` | string |  |  |
| `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 call.

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

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_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.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

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=120) 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.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_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);
```

Or describe the data in plain language: send `{"api":"@legislation-gov-uk","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## 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

### Is Fous affiliated with legislation.gov.uk?

No. Fous is not affiliated with legislation.gov.uk. This workflow reads the public legislation.gov.uk website and returns its data.

### How much does it cost?

Each run costs 1 credit. 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; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check 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/workflows/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/workflows/find-case-law.md): Search official UK court judgments and tribunal decisions from The National Archives.
- [Congress.gov API](https://fous.com/workflows/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/workflows/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/workflows/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/workflows/federal-register.md): Search United States federal rules, proposed rules, notices, and presidential documents.
- [Companies House API](https://fous.com/workflows/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.
- [Grants.gov API](https://fous.com/workflows/grants-gov.md): U.S. federal grant opportunities and application information.
- [All Legal workflows](https://fous.com/workflows/category/legal)
