New: the Crawl API. A whole website in one job, priced before it starts. See how it works
Playground Sign in Start free
Government, public data and academic · gov.uk

How to scrape GOV.UK

GOV.UK is a website with public pages available for scraping. Developers typically collect data from its public pages.

Ujeebu scrapes any public website. Not listed here? Try any URL in the Playground or ask us about a site.

Working 5 credits a page, about $0.50 per 1,000 on Pro

7 of 7 of our checks passed in the last 7 days (100%).

Last check 2026-12-03 23:02 UTC · last pass 2026-12-03 23:02 UTC · checked with our own requests, never customer data.

Try it in the Playground

Markdown API one call

GOV.UK pages as Markdown with the Markdown API

5 credits a page
  • markdown
  • fit_markdown
  • markdown_with_citations
  • references
  • metadata
curl -G 'https://api.ujeebu.com/markdown' \
  -H "ApiKey: $UJEEBU_API_KEY" \
  --data-urlencode 'url=https://www.gov.uk/government/news/dvsa-opening-hours-christmas-and-new-year' \
  --data-urlencode 'js=false'

Send any GOV.UK page: a report, a notice, a press release or a guidance page. The answer is JSON with the page as Markdown, headings, lists, tables and links kept, ready for an LLM or a search index. PDF files are not converted. Successful responses cost credits; blocked, timed-out and failed requests are free.

Run the code on this page with your own key: 5,000 free credits for 21 days, no card. Get a free API key →

GOV.UK pages as Markdown: the Markdown API

What you want from gov.uk is usually the text of a page: a report, a notice, a press release, a guidance page. The Markdown API fetches the page and returns it as clean Markdown, with the headings, lists, tables and links kept and the navigation dropped, for an LLM, a search index or a diff between versions.

One call: GET /markdown 5 credits a page

curl -G 'https://api.ujeebu.com/markdown' \
  -H "ApiKey: $UJEEBU_API_KEY" \
  --data-urlencode 'url=https://www.gov.uk/government/news/dvsa-opening-hours-christmas-and-new-year' \
  --data-urlencode 'js=false'

The Ujb-Credits header gives the cost. filter=raw keeps the whole page, filter=bm25 with a query keeps the passages about it. PDF files are not converted: send HTML pages. Try it in the Playground

What the answer holds

FieldTypeExample
markdowntext# DVSA opening hours: Christmas and New Year The Driver and Vehicle Standards Agency (DVSA) will be closed at times duri...
fit_markdowntext# DVSA opening hours: Christmas and New Year The Driver and Vehicle Standards Agency (DVSA) will be closed at times duri...
markdown_with_citationstext# DVSA opening hours: Christmas and New Year The Driver and Vehicle Standards Agency (DVSA) will be closed at times duri...
referencestext## References [1]: /help/cookies "change your cookie settings" [2]: / "GOV.UK" [3]: /browse "Menu" [4]: /browse/benefits...
metadata.markdown_lengthnumber6677
metadata.html_lengthnumber101678
metadata.filtertextfit
urlURLhttps://www.gov.uk/government/news/dvsa-opening-hours-christmas-and-new-year

Sample output (real call on 2026-12-03, trimmed)

{
    "success": true,
    "url": "https://www.gov.uk/government/news/dvsa-opening-hours-christmas-and-new-year",
    "markdown": "# DVSA opening hours: Christmas and New Year\n\nThe Driver and Vehicle Standards Agency (DVSA) will be closed at times during Christmas 2026 and New Year 2027.\n\nDriving test centres, vehicle test stations and DVSA customer service centres will have different opening hours during Christmas and New Year.\n\nDVSA’s online services and information will still be available on GOV.UK. The bank holidays will affect the last date to change or cancel your theory or driving test.\n\n## Driving test centres, vehicle test stations and customer support\n\n| Date | Driving test centres and DVSA vehicle test stations | Customer service centre |\n| --- | --- | --- |\n| Monday 21 December | Most centres and stations wi...",
    "fit_markdown": "# DVSA opening hours: Christmas and New Year\n\nThe Driver and Vehicle Standards Agency (DVSA) will be closed at times during Christmas 2026 and New Year 2027.\n\nDriving test centres, vehicle test stations and DVSA customer service centres will have different opening hours during Christmas and New Year.\n\nDVSA’s online services and information will still be available on GOV.UK. The bank holidays will affect the last date to change or cancel your theory or driving test.\n\n## Driving test centres, vehicle test stations and customer support\n\n| Date | Driving test centres and DVSA vehicle test stations | Customer service centre |\n| --- | --- | --- |\n| Monday 21 December | Most centres and stations wi...",
    "markdown_with_citations": "# DVSA opening hours: Christmas and New Year\n\nThe Driver and Vehicle Standards Agency (DVSA) will be closed at times during Christmas 2026 and New Year 2027.\n\nDriving test centres, vehicle test stations and DVSA customer service centres will have different opening hours during Christmas and New Year.\n\nDVSA’s online services and information will still be available on GOV.UK. The bank holidays will affect the last date to change or cancel your theory or driving test.\n\n## Driving test centres, vehicle test stations and customer support\n\n| Date | Driving test centres and DVSA vehicle test stations | Customer service centre |\n| --- | --- | --- |\n| Monday 21 December | Most centres and stations wi...",
    "references": "\n\n## References\n\n[1]: /help/cookies \"change your cookie settings\"\n[2]: / \"GOV.UK\"\n[3]: /browse \"Menu\"\n[4]: /browse/benefits \"Benefits\"\n[5]: /browse/births-deaths-marriages \"Births, death, marriages and care\"\n[6]: /browse/business \"Business...",
    "metadata": {
        "conversion_time_ms": 32,
        "filter": "fit",
        "html_length": 101678,
        "markdown_length": 6677
    }
}

Code

Complete scripts: set the UJEEBU_API_KEY environment variable and run them as they are. Each one makes the call above and prints the main fields of the answer, and prints the credits the request cost (the Ujb-Credits response header) on stderr. A non-200 answer stops the script with the API's error message.

GOV.UK pages (Markdown API)

One page: prints the length and the start of its Markdown. No SDK has a Markdown call yet, so these scripts call the API directly.

govuk_markdown.py pip install requests
# Get a GOV.UK page as Markdown with the Ujeebu Markdown API.
# GET /markdown with the page URL: the API answers JSON with the page as Markdown (markdown, fit_markdown), the same text with numbered citations and the metadata.
# Run: UJEEBU_API_KEY=your_key python3 govuk_markdown.py   (pip install requests)

import json
import os
import sys

import requests

API_URL = "https://api.ujeebu.com/markdown"
API_KEY = os.environ.get("UJEEBU_API_KEY")
PARAMS = {
    "url": "https://www.gov.uk/government/news/dvsa-opening-hours-christmas-and-new-year",
    "js": "false",
}

if not API_KEY:
    sys.exit("Set the UJEEBU_API_KEY environment variable.")

try:
    response = requests.get(API_URL, headers={"ApiKey": API_KEY}, params=PARAMS, timeout=180)
except requests.RequestException as error:
    sys.exit(f"Request failed: {error}")
if response.status_code != 200:
    try:
        message = response.json().get("message", response.text)
    except ValueError:
        message = response.text
    sys.exit(f"HTTP {response.status_code}: {str(message)[:300]}")
print(f"Ujb-Credits: {response.headers.get('Ujb-Credits')}", file=sys.stderr)
data = response.json()
markdown = data.get("fit_markdown") or data.get("markdown") or ""
print(f"{len(markdown)} characters of Markdown", file=sys.stderr)
print(markdown[:2000])
# every field: print(json.dumps(data, indent=2, ensure_ascii=False))

SDK tabs use the official Ujeebu SDKs (ujeebu-python 0.1.5, @ujeebu-org/ujeebu-sdk 0.1.2, github.com/ujeebu/ujeebu-go v0.1.8); there is no PHP SDK, so the PHP tab calls the API with curl. For agents and scripts, the same status and settings are at /scrape/govuk.json.

Try it yourself

Run this on GOV.UK with your own key

Get a free API key, set UJEEBU_API_KEY and run any script above as it is. 5,000 free credits for 21 days, no card.

Settings that work today

From our health checks over the last 7 days: the cheapest settings that return the real page most of the time.

Endpoint/markdown
jstrue
Costup to 30 credits a request (only HTTP 200 and 404 are billed; blocked, timed-out and failed requests are free)

Each public page is one request: change the path in the URL to fetch another one. Our checks run with JavaScript rendering on (js=true): keep it on.

Try it in the Playground

What people build with GOV.UK data

  • Research datasetsBuild datasets of public pages for analysis, search or LLM pipelines.More on this use case

Limits and etiquette

  • Public pages only. Pages behind a login, and data shown only to signed-in users, are out of scope.
  • Keep the rate modest: fetch pages one after another or with low concurrency, and cache what you already have.
  • robots.txt of www.gov.uk (read 2026-12-03): public pages allowed for generic crawlers; no crawl delay set.
  • Read GOV.UK's terms of service before you collect data at scale, and do not collect personal data you have no basis to process. This guide is not legal advice.

Questions

Can you scrape GOV.UK with Ujeebu?

Yes. 7 of 7 checks of public GOV.UK pages passed in the last 7 days with the settings on this page.

Which settings work for GOV.UK?

Call /markdown with js=true.

How many credits does a GOV.UK request cost?

With these settings a request costs up to 30 credits. Only responses with HTTP 200 or 404 are billed: a blocked or timed-out request is free.

How do I get GOV.UK pages as clean text for an LLM?

Send the page URL to the Markdown API (GET /markdown?url=<page>). It returns the page as Markdown with its headings, lists, tables and links, without the navigation and boilerplate, plus the same text with numbered citations: 5 credits a page, no rules to write. PDF files are not converted. Only successful responses are billed.

Is it allowed to scrape GOV.UK?

Its robots.txt allows generic crawlers on the page types in this guide. Collect public pages only, read GOV.UK's terms of service, keep your request rate modest and do not collect personal data you have no basis to process. This is not legal advice.

How fresh is this page?

The status and settings come from our own health checks of gov.uk, which run around the clock. Last check: 2026-12-03 23:02:43 UTC; last pass: 2026-12-03 23:02:43 UTC.