> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webrouter.net/llms.txt
> Use this file to discover all available pages before exploring further.

# legislation.gov.uk

> UK legislation (Acts, statutory instruments, devolved legislation) as revised and as enacted, in XML or Atom, from The National Archives' free Legislation API.

![](https://mintcdn.com/webrouter/JBFYvcRI1PVnd4YX/logo/data-apis/legislation-gov-uk.webp?fit=max\&auto=format\&n=JBFYvcRI1PVnd4YX\&q=85\&s=ac1ad57993abb13d770147365e1e7dae)

[Web Catalog · Government](https://docs.webrouter.net/data-apis.md?category=government)

No key needed

Endpoints

5

Auth

None

[Vendor docs](https://www.legislation.gov.uk/developer) · Serves `legislation.gov.uk`

## Notes

* Keyless; reuse is under the Open Government Licence v3.0 with exceptions the site lists, and a fair use policy applies.
* Items are addressed as /\{type}/\{year}/\{number}: type is a code such as ukpga (UK Public General Acts), uksi (UK Statutory Instruments), asp, ssi, wsi, nia, nisr; all, primary and secondary work in listings.
* The format is picked by a data.ext suffix (data.xml, data.rdf, data.feed) or by content negotiation on the Accept header; without either you get the HTML page.
* With no version the current revised text is returned; a date (YYYY-MM-DD) gives the text in force then, enacted or made the original. Dates before 1991-02-01 redirect to the base-date version.
* Lists are Atom feeds paged by first/previous/next/last links, with opensearch:totalResults and leg:morePages.

## Endpoints

GET

Get a piece of legislation

Metadata and full text of one Act or instrument, current revised version, as Legislation Schema XML.

[Open](#legislation-gov-uk-legislation-get)

GET

Get legislation as at a date

One Act or instrument as in force on a date, or as enacted/made, or with prospective changes, as XML.

[Open](#legislation-gov-uk-legislation-version)

GET

Get one provision

One section, article, regulation, rule or schedule of an Act or instrument, as XML.

[Open](#legislation-gov-uk-legislation-section)

GET

List legislation by type and year

Atom feed of the legislation of one type (or all, primary, secondary) in a year or year range.

[Open](#legislation-gov-uk-legislation-list)

GET

Search legislation by title

Atom feed of legislation whose title matches, optionally by type, year range and number range.

[Open](#legislation-gov-uk-legislation-search)

### Get a piece of legislation

GET

`/{type}/{year}/{number}/data.xml`

`legislation-gov-uk.legislation.get`

Metadata and full text of one Act or instrument, current revised version, as Legislation Schema XML.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`type` required</td><td>string</td><td>path</td><td>Legislation type code, e.g. ukpga, uksi, asp, ssi, wsi, nia. Example `ukpga`</td></tr>
    <tr><td>`year` required</td><td>string</td><td>path</td><td>Year (or regnal year for older Acts). Example `1985`</td></tr>
    <tr><td>`number` required</td><td>string</td><td>path</td><td>Chapter or instrument number. Example `67`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.legislation.gov.uk/developer/uris) · Same job: [Legistar Web API](https://docs.webrouter.net/data-apis/legistar.md#legistar-matters-get)

```python Python theme={null}
router.call_data_api("legislation-gov-uk.legislation.get", {'type': 'ukpga', 'year': '1985', 'number': '67'})
```

```text MCP theme={null}
call_data_api(endpoint="legislation-gov-uk.legislation.get", params={"type": "ukpga", "year": "1985", "number": "67"})
```

> [!NOTE]
>
> * A whole large Act can be big; use legislation.section for one provision.

### Get legislation as at a date

GET

`/{type}/{year}/{number}/{version}/data.xml`

`legislation-gov-uk.legislation.version`

One Act or instrument as in force on a date, or as enacted/made, or with prospective changes, as XML.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`type` required</td><td>string</td><td>path</td><td>Legislation type code. Example `ukpga`</td></tr>
    <tr><td>`year` required</td><td>string</td><td>path</td><td>Year. Example `1985`</td></tr>
    <tr><td>`number` required</td><td>string</td><td>path</td><td>Chapter or instrument number. Example `67`</td></tr>
    <tr><td>`version` required</td><td>string</td><td>path</td><td>A date YYYY-MM-DD, or enacted (Acts), made or created (instruments), or prospective. Example `1997-06-01`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.legislation.gov.uk/developer/uris) · Same job: [Legistar Web API](https://docs.webrouter.net/data-apis/legistar.md#legistar-matters-get)

```python Python theme={null}
router.call_data_api("legislation-gov-uk.legislation.version", {'type': 'ukpga', 'year': '1985', 'number': '67', 'version': '1997-06-01'})
```

```text MCP theme={null}
call_data_api(endpoint="legislation-gov-uk.legislation.version", params={"type": "ukpga", "year": "1985", "number": "67", "version": "1997-06-01"})
```

### Get one provision

GET

`/{type}/{year}/{number}/{division}/{section}/data.xml`

`legislation-gov-uk.legislation.section`

One section, article, regulation, rule or schedule of an Act or instrument, as XML.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`type` required</td><td>string</td><td>path</td><td>Legislation type code. Example `ukpga`</td></tr>
    <tr><td>`year` required</td><td>string</td><td>path</td><td>Year. Example `1984`</td></tr>
    <tr><td>`number` required</td><td>string</td><td>path</td><td>Chapter or instrument number. Example `27`</td></tr>
    <tr><td>`division` required</td><td>string</td><td>path</td><td>Division name for the type: section (Acts), article (Orders), regulation (Regulations), rule (Rules), schedule. One of `section`, `article`, `regulation`, `rule`, `schedule` Example `section`</td></tr>
    <tr><td>`section` required</td><td>string</td><td>path</td><td>Number (or schedule letter) of the provision. Example `6`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.legislation.gov.uk/developer/uris) · Same job: [Legistar Web API](https://docs.webrouter.net/data-apis/legistar.md#legistar-matters-get)

```python Python theme={null}
router.call_data_api("legislation-gov-uk.legislation.section", {'type': 'ukpga', 'year': '1984', 'number': '27', 'division': 'section', 'section': '6'})
```

```text MCP theme={null}
call_data_api(endpoint="legislation-gov-uk.legislation.section", params={"type": "ukpga", "year": "1984", "number": "27", "division": "section", "section": "6"})
```

### List legislation by type and year

GET

`/{type}/{years}`

`legislation-gov-uk.legislation.list`

Atom feed of the legislation of one type (or all, primary, secondary) in a year or year range.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`type` required</td><td>string</td><td>path</td><td>Legislation type code, or all, primary or secondary. Example `ukpga`</td></tr>
    <tr><td>`years` required</td><td>string</td><td>path</td><td>A year, or a range start-end, with \* for an open end (2000-\*, \*-1990). Example `2020`</td></tr>
    <tr><td>`accept` required</td><td>string</td><td>header</td><td>application/atom+xml for the Atom feed; without it the HTML page comes back. Example `application/atom+xml`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.legislation.gov.uk/developer/searching)

```python Python theme={null}
router.call_data_api("legislation-gov-uk.legislation.list", {'type': 'ukpga', 'years': '2020', 'accept': 'application/atom+xml'})
```

```text MCP theme={null}
call_data_api(endpoint="legislation-gov-uk.legislation.list", params={"type": "ukpga", "years": "2020", "accept": "application/atom+xml"})
```

### Search legislation by title

GET

`/all`

`legislation-gov-uk.legislation.search`

Atom feed of legislation whose title matches, optionally by type, year range and number range.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`title`</td><td>string</td><td>query</td><td>Title words; case-insensitive, supports + (and), - (not) and "phrases". Example `Transport`</td></tr>

    <tr>
      <td>
        `type`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Legislation type code; join several with +, or \* for all.
      </td>
    </tr>

    <tr>
      <td>
        `start_year`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        First year.
      </td>
    </tr>

    <tr>
      <td>
        `end_year`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Last year.
      </td>
    </tr>

    <tr>
      <td>
        `start_number`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        First number.
      </td>
    </tr>

    <tr>
      <td>
        `end_number`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Last number.
      </td>
    </tr>

    <tr>
      <td>
        `version`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Point-in-time version, e.g. a date YYYY-MM-DD.
      </td>
    </tr>

    <tr><td>`accept` required</td><td>string</td><td>header</td><td>application/atom+xml for the Atom feed. Example `application/atom+xml`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.legislation.gov.uk/developer/searching)

```python Python theme={null}
router.call_data_api("legislation-gov-uk.legislation.search", {'title': 'Transport', 'accept': 'application/atom+xml'})
```

```text MCP theme={null}
call_data_api(endpoint="legislation-gov-uk.legislation.search", params={"title": "Transport", "accept": "application/atom+xml"})
```

> [!NOTE]
>
> * Calls the /all listing, which takes the same filters: /search only answers with a 301 to a listing, and redirects are never followed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.