legislation.gov.uk API · Research
Whole text of an Act or instrument with the legislation.gov.uk API
The whole current text of one Act or instrument as Legislation XML. You call it with one looot token, no legislation.gov.uk account needed. It takes type, year, number as required input. Each call is free on looot. Over the last 30 days looot ran it 19 times: 100% finished without an error, median answer 244 ms.
- Price
- free
- Success rate, 30 days
- 100%
- Runs, 30 days
- 19
- Access
- looot token only
Whole text of an Act or instrument: call it from code
One POST to /v1/runs with your looot token, the endpoint id legislation-gov-uk-act and an input. Values come from the stored input schema; a value in <angle brackets> is a placeholder the schema gives no example for.
| Input | Type | Value shown |
|---|---|---|
| type | one of: ukpga | uksi | asp | ... | placeholder |
| year | integer | placeholder |
| number | integer | placeholder |
POST /v1/runs
curl -X POST 'https://api.looot.ai/v1/runs?wait=true' \
-H 'Authorization: Bearer YOUR_LOOOT_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"endpointId":"legislation-gov-uk-act","input":{"type":"<one of: ukpga | uksi | asp | ...>","year":"<integer>","number":"<integer>"},"idempotencyKey":"<unique-idempotency-key>"}'import uuid
import requests
response = requests.post(
"https://api.looot.ai/v1/runs?wait=true",
headers={"Authorization": "Bearer YOUR_LOOOT_TOKEN"},
json={
"endpointId": "legislation-gov-uk-act",
"input": {
"type": "<one of: ukpga | uksi | asp | ...>",
"year": "<integer>",
"number": "<integer>",
},
"idempotencyKey": str(uuid.uuid4()),
},
)
print(response.json())const response = await fetch("https://api.looot.ai/v1/runs?wait=true", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_LOOOT_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
endpointId: "legislation-gov-uk-act",
input: {
"type": "<one of: ukpga | uksi | asp | ...>",
"year": "<integer>",
"number": "<integer>"
},
idempotencyKey: crypto.randomUUID(),
}),
});
console.log(await response.json());Price and reliability
- Price formula
- free
- Most one run can cost
- free
- Success rate, 30 days
- 100%
- Runs, 30 days
- 19
- Median answer time
- 244 ms
- Last success
- Nov 24, 2026
Run numbers are looot's own runs of each endpoint over the last 30 days: the share that completed without an error, and the median time to answer. An endpoint with fewer than 10 runs in that window shows "not enough runs to rank" and is never ranked. Prices are what looot charges per call or per result, fee included, read from the live catalog; you prepay credit and each call is charged when it runs.
More legislation.gov.uk endpoints
- Search UK legislation by title, text, year
free
not enough runs to rank
- Text of one section, regulation, article or schedule
free
not enough runs to rank
Questions about the legislation.gov.uk API on looot
Give your agent every data provider, one key.
Everyone gets $2 in free credits once after sign-in and workspace selection. Then pay only for what you use.