Search UK legislation
uklaw_search_legislationRead-onlyIdempotent
Search the UK statute book on legislation.gov.uk by full text or title, or list legislation by type and year, filtered by geographical extent and point in time. Full-text search ranks by relevance; title searches and type/year listings run newest year first and carry type and year counts (facets) to narrow with. Each result gives the item path to pass to uklaw_get_document. For a known citation or short title, uklaw_lookup_citation is cheaper and exact.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (1–10,000). | |
| text | No | Full-text query. Supports AND/OR, "quoted phrases", and stemming. Omit for a title search or a listing. | |
| year | No | Calendar year (also for pre-1963 Acts numbered by regnal year). Not combinable with year_from/year_to. | |
| as_of | No | Point in time YYYY-MM-DD: only legislation as it stood on that date (items not yet enacted or made are excluded). Omit for current law. Cannot combine with extent. | |
| limit | No | Results per page (1–50). | |
| title | No | Words that must all occur in the title. For a known short title or citation, uklaw_lookup_citation is exact. | |
| types | No | Type codes (ukpga, uksi, asp, eur, …) and/or groups (all, primary, secondary, eu-origin, draft). "all" covers UK and EU-origin legislation, excluding drafts, and absorbs any other value. uklaw_list_reference topic types lists the codes. | |
| extent | No | Geographical extent: england, wales, scotland, ni. An item matches when one of its provisions extends there. Cannot combine with as_of. legislation.gov.uk has not recorded provision-level extent for many recent items, so an empty result does not prove nothing extends there. | |
| year_to | No | Latest calendar year of a range; the other bound may be omitted. | |
| year_from | No | Earliest calendar year of a range; the other bound may be omitted. | |
| extent_match | No | Used only with extent. applicable: a provision extends to any given extent; exact: a provision extends to exactly that set. | applicable |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | Page size that capped the list. | |
| page | No | Page returned. | |
| error | No | Present when the call failed. Absent on success. | |
| limit | No | Page size applied. | |
| scope | No | The scope applied, defaults included. | |
| shown | No | Results on this page. | |
| total | No | Total matches; present only when legislation.gov.uk reports it (often absent on large result sets). | |
| facets | No | Type and year counts — title searches and listings only; absent on full-text searches and on a page past the last page. | |
| notice | No | Guidance when nothing matched, or how to fetch the next page. | |
| results | No | Matching items on this page. | |
| has_more | No | True when a further page exists (call again with page + 1). | |
| truncated | No | True when more results exist beyond this page. | |
| attribution | No | Attribution lines the returned content requires (OGL always; EU and Westlaw credits when applicable). |