# GOV.UK Guidance to Markdown with Citations (`landlordtools/govuk-guidance-fetcher`) Actor

Any GOV.UK page as clean Markdown for AI agents and RAG, from GOV.UK’s official Content API: title, last-updated date, change history, organisation, withdrawn status, attachments and a ready-made citation. Follows GOV.UK redirects and guide parts. No scraping, no key.

- **URL**: https://apify.com/landlordtools/govuk-guidance-fetcher.md
- **Developed by:** [LandlordTools](https://apify.com/landlordtools) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## GOV.UK Guidance to Markdown with Citations

AI agents asked about UK rules too often answer from memory. This Actor gives them the current GOV.UK page instead, as clean Markdown with what a citation needs: title, publishing organisation, last-updated date, change history, withdrawn status and a ready-made citation line. It reads GOV.UK's official Content API [1][2], which anyone may use for any purpose with no key [1], so there's no scraping and nothing to break when the page design changes.

### What you get for each page

- **Markdown**:
  - headings, lists, tables (as Markdown tables), and callout boxes as quotes;
  - links made absolute, so they work outside GOV.UK;
  - no navigation, cookie banners or feedback forms.
- **Citation**: `Title. Organisation, GOV.UK. Last updated 10 October 2024. URL (accessed 3 October 2026).` Dates are in UK time, as GOV.UK shows them.
- **Status**:
  - `ok`;
  - `withdrawn`, with the date and GOV.UK's explanation (often a link to what replaced it);
  - `not-found` (404) or `gone` (410) [2];
  - `redirected-elsewhere`;
  - `invalid`: not a www.gov.uk page, since subdomains and attachments aren't in the API [1].
- **Redirects**: GOV.UK's own redirects are followed (exact and prefix rules), and the old URLs are listed.
- **Guides**: a link to one part of a multi-page guide returns just that part, or every part with `wholeGuide`.
- **Also**: attachments (HTML and PDF links), the change history, `description`, `documentType` and `locale`.
- **Long pages**: `maxCharacters` cuts at a paragraph break and says so.
- **Rate limit**: requests stay under the API's limit of 10 a second [1].
- **Licence**: the `OUTPUT` record carries the Open Government Licence v3.0 attribution statement [3] to include when you reuse the text.

**Checking**:

- Unit tests replay real Content API responses recorded on 3 October 2026: an answer, a guide part, a redirect, a withdrawn publication with attachments, and a 404.
- `tests/check_live.py` compares the Markdown with the pages as people see them on www.gov.uk, using Python only. On 3 October 2026, 7 pages agreed:
  - 97% to 100% of the Markdown's 5-word sequences were on the rendered page;
  - titles matched the page headings;
  - "Last updated" dates matched where the page shows one.

### Input

```json
{
  "urls": [
    "https://www.gov.uk/vat-rates",
    "https://www.gov.uk/register-for-vat/how-register-for-vat",
    "https://www.gov.uk/vat-registration",
    "https://www.gov.uk/government/publications/covid-19-stay-at-home-guidance"
  ],
  "maxCharacters": 3000
}
```

### Example output

One dataset row per page:

```json
{
  "input": "https://www.gov.uk/vat-rates",
  "url": "https://www.gov.uk/vat-rates",
  "status": "ok",
  "title": "VAT rates",
  "partTitle": null,
  "description": "Current VAT rates - standard 20% and rates for reduced rate and zero-rated items",
  "documentType": "answer",
  "organisations": [
    "HM Revenue & Customs"
  ],
  "firstPublished": "2011-09-12",
  "lastUpdated": "2014-12-12",
  "withdrawn": false,
  "withdrawnAt": null,
  "withdrawnExplanation": null,
  "locale": "en",
  "redirectedFrom": [],
  "markdown": "The standard VAT rate is *20%*\n\n> This guide is also available [in Welsh (Cymraeg)](https://www.gov.uk/cyfraddau-taw).\n\n## VAT rates for goods and services\n\n|  | % of VAT | What the rate applies to |\n| --- | --- | --- |\n| Standard rate | 20% | Most goods and services |\n| Reduced rate | 5% | Some goods and services, for example, children’s car seats and home energy |\n| Zero rate | 0% | Zero-rated goods and services, for example, most food and children’s clothes |\n\nThe standard rate of VAT increased to 20% on 4 January 2011 (from 17.5%).\n\nSome things are exempt from VAT, such as postage stamps, financial and property transactions.\n\nThe [VAT rate businesses charge](https://www.gov.uk/vat-businesses/vat-rates) depends on their goods and services.\n\nCheck the [rates of VAT](https://www.gov.uk/rates-of-vat-on-different-goods-and-services) on different goods and services.",
  "characters": 876,
  "attachments": [],
  "changeHistory": [],
  "citation": "VAT rates. HM Revenue & Customs, GOV.UK. Last updated 12 December 2014. https://www.gov.uk/vat-rates (accessed 3 October 2026).",
  "note": null,
  "error": null
}
```

### Integrations

Ready-made files in [`integrations/`](integrations/README.md): a **Microsoft Power Platform custom connector**, **OpenAPI 3** (AI agents, n8n, Postman), an **Excel / Power BI Power Query** script, a **Google Sheets** function, and curl, Python and JavaScript examples.

### Pricing

Pay per event: $2 per 1,000 results ($0.002 each), plus Apify's minimal start fee. A result is one row in the dataset: one GOV.UK page fetched. The run stops at your spending limit.

### Sources

1. [GOV.UK Content API: about (anyone may use it for any purpose, no authentication, 10 requests a second per client, www.gov.uk pages only)](https://content-api.publishing.service.gov.uk/). Accessed 3 October 2026.
2. [GOV.UK Content API: reference (GET /api/content/{path}, 404 and 410 responses, withdrawn_notice, public_updated_at)](https://content-api.publishing.service.gov.uk/reference.html). Accessed 3 October 2026.
3. [Open Government Licence v3.0 (attribution statement)](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/). Accessed 3 October 2026.
4. [Turndown (HTML to Markdown, MIT) with turndown-plugin-gfm for tables](https://www.npmjs.com/package/turndown). Accessed 3 October 2026.

[1]: https://content-api.publishing.service.gov.uk/

[2]: https://content-api.publishing.service.gov.uk/reference.html

[3]: https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/

[4]: https://www.npmjs.com/package/turndown

# Actor input Schema

## `urls` (type: `array`):

www.gov.uk URLs or paths, for example https://www.gov.uk/vat-rates or /register-for-vat/how-register-for-vat.

## `wholeGuide` (type: `boolean`):

For a link to one part of a multi-page guide, return every part instead of just that one.

## `maxCharacters` (type: `integer`):

Cut long pages at a paragraph break (optional).

## `maxConcurrency` (type: `integer`):

Default 4; requests always stay under the API's 10 a second.

## Actor input object example

```json
{
  "urls": [
    "https://www.gov.uk/vat-rates",
    "https://www.gov.uk/register-for-vat/how-register-for-vat",
    "https://www.gov.uk/vat-registration",
    "https://www.gov.uk/government/publications/covid-19-stay-at-home-guidance"
  ],
  "maxCharacters": 3000
}
```

# Actor output Schema

## `result` (type: `string`):

No description

## `output` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://www.gov.uk/vat-rates",
        "https://www.gov.uk/register-for-vat/how-register-for-vat",
        "https://www.gov.uk/vat-registration",
        "https://www.gov.uk/government/publications/covid-19-stay-at-home-guidance"
    ],
    "maxCharacters": 3000
};

// Run the Actor and wait for it to finish
const run = await client.actor("landlordtools/govuk-guidance-fetcher").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "urls": [
        "https://www.gov.uk/vat-rates",
        "https://www.gov.uk/register-for-vat/how-register-for-vat",
        "https://www.gov.uk/vat-registration",
        "https://www.gov.uk/government/publications/covid-19-stay-at-home-guidance",
    ],
    "maxCharacters": 3000,
}

# Run the Actor and wait for it to finish
run = client.actor("landlordtools/govuk-guidance-fetcher").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://www.gov.uk/vat-rates",
    "https://www.gov.uk/register-for-vat/how-register-for-vat",
    "https://www.gov.uk/vat-registration",
    "https://www.gov.uk/government/publications/covid-19-stay-at-home-guidance"
  ],
  "maxCharacters": 3000
}' |
apify call landlordtools/govuk-guidance-fetcher --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,landlordtools/govuk-guidance-fetcher"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/inqh3YnOC7bgArG4c/builds/Z0xbPVTgwXgd5HXzG/openapi.json
