# data.gov.uk Datasets Scraper (`parseforge/data-gov-uk-scraper`) Actor

Scrapes dataset listings from data.gov.uk by search query, topic, publisher, or format. Returns each dataset as a flat row with title, description, publisher, licence, and file URLs.

- **URL**: https://apify.com/parseforge/data-gov-uk-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Travel
- **Features:** Limited permissions
- **Stats:** 11 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.20 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner-v4.webp)](https://apify.com/parseforge?fpr=vmoqkp)

### data.gov.uk Datasets Scraper

**Scrape UK government datasets from data.gov.uk by search term, topic, publisher, or format, up to a million per run.** Every dataset comes with its title, description, publisher, licence, and direct file links. No API key or registration. Export to CSV, JSON, Excel, or XML.

Finding open data from the UK government means browsing data.gov.uk page by page, or writing code against the CKAN API. This Actor reads the public dataset listings directly. Feed it a search term, a topic like Health or Transport, a publisher name, or a file format, and it returns matching datasets in one fixed schema.

| Who uses it | What they scrape data.gov.uk for |
|---|---|
| Open data researchers | Build a catalogue of all CSV datasets published by a specific government department. |
| Policy analysts | Monitor newly published datasets on a topic like Crime and justice for weekly reports. |
| Data journalists | Find machine-readable data on government spending to support an investigation. |
| Commercial data teams | Pull all GEOJSON mapping files from UK public bodies into a single inventory. |

### What it does

This Actor collects dataset listings from data.gov.uk by search query, topic, publisher, format, or direct URL, and returns each one as a flat row.

- 🔍 **Search by keyword:** Filter datasets with a free-text search term like 'economics' or 'air quality'.
- 🏛️ **Filter by publisher:** Narrow results to a specific organisation, such as 'Office for National Statistics'.
- 📂 **Filter by topic:** Select from official categories including Health, Education, Environment, and Transport.
- 📄 **Filter by format:** Request only CSV, JSON, GEOJSON, ZIP, or other specific file types.
- 📜 **Licence filter:** Restrict results to datasets with an Open Government Licence (OGL) only.
- 🔄 **Sort order:** Retrieve results by relevance or by most recently updated.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with data.gov.uk data

**📊 Build a departmental data inventory.**

A government analyst runs the Actor with publisher set to 'Department for Transport' and format set to 'CSV' to list every machine-readable dataset their department offers.

**📰 Feed a newsroom data pipeline.**

A data journalist scrapes all datasets under the 'Government spending' topic weekly, sorted by recency, to spot new transparency releases.

**🗺️ Collect UK geospatial data.**

A GIS specialist filters by format 'GEOJSON' and 'SHP' across all topics to maintain a master index of UK public mapping data.

**📈 Track open data publication trends.**

A researcher runs the Actor monthly with no filters, capturing the full catalogue to measure how many datasets each publisher adds over time.

### Why choose this scraper

|  | What you get |
|---|---|
| **No API key needed** | Reads the public data.gov.uk search pages, no registration or OAuth. |
| **Fixed flat schema** | Every dataset row has the same columns, ready for analysis or a database. |
| **Bulk extraction** | Pull up to a million datasets in one run on a paid plan. |
| **OGL-aware** | Option to keep only datasets with the permissive Open Government Licence. |

### How it compares

This Actor focuses on data.gov.uk with native topic, publisher, and format filters, while the alternatives below either target different sources or offer broader CKAN portal support.

| Feature | ParseForge | Data.gov.uk Scraper - Low-cost | CKAN Open Data Scraper |
|---|---|---|---|
| Native data.gov.uk topic filter | Yes, 11 official topics | Not listed | Not listed |
| Publisher name filter | Yes | Not listed | Not listed |
| File format filter (CSV, JSON, GEOJSON, etc.) | Yes, 14 formats | Not listed | Not listed |
| Open Government Licence (OGL) filter | Yes | Not listed | Not listed |
| Scrapes any CKAN portal beyond data.gov.uk | No, data.gov.uk only | Not listed | Yes |
| Direct dataset URL input | Yes | Not listed | Not listed |

### Configure the run

Drive the Actor from a direct data.gov.uk URL or from search filters like topic, publisher, and format, and filters run as each dataset is read so only matches reach your dataset. The Input tab lists every parameter.

A first run with the defaults:

```json
{
  "maxItems": 10,
  "searchQuery": "economics",
  "sort": "best"
}
```

A larger pull:

```json
{
  "maxItems": 200,
  "searchQuery": "economics",
  "sort": "best"
}
```

### Pricing

Pay-per-result: **$0.0018 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $0.18 |
| 1,000 results | $1.80 |
| 10,000 results | $18.00 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [data.gov.uk Datasets Scraper](https://apify.com/parseforge/data-gov-uk-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to data.gov.uk through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/data-gov-uk-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check that your search term or publisher name is spelled exactly as it appears on data.gov.uk. Also, try broadening your filters: remove the format or topic filter to see if any datasets match the remaining criteria.

**The Actor stops after 10 datasets but I need more.**

Free Apify accounts have a limit of 10 items per run. Upgrade to a paid plan and increase the maxItems setting to continue scraping up to 1,000,000 datasets.

**I pasted a startUrl but the Actor is ignoring my search filters.**

The startUrl and the search filters are mutually exclusive. If you provide a startUrl, the Actor scrapes that URL directly and ignores searchQuery, publisher, topic, and format. Clear the startUrl field to use filters.

**The OGL filter is not returning any datasets.**

Not all datasets on data.gov.uk carry the Open Government Licence. Try running without the OGL filter first to see what licences are available, then re-run with the filter if OGL datasets exist for your query.

**Some datasets show a format I did not filter for.**

A single dataset listing can contain multiple resources in different formats. The Actor returns the dataset if any of its resources match your format filter.

### FAQ

| Question | Answer |
|---|---|
| Do I need an API key for data.gov.uk? | No. This Actor reads the public search and listing pages. You do not need to register an application or obtain a key. |
| Can I scrape a specific publisher's datasets? | Yes. Use the Publisher filter and enter the exact name, for example 'Office for National Statistics'. The Actor will return only datasets from that organisation. |
| What file formats can I filter by? | You can filter by CSV, ESRI REST, GEOJSON, HTML, JSON, KML, PDF, SHP, WFS, WMS, XLS, XML, ZIP, or Other. Leave the filter empty to get all formats. |
| How do I get only datasets with an Open Government Licence? | Check the 'Open Government Licence (OGL) Only' box in the input. The Actor will drop any dataset that does not carry the OGL. |
| Can I scrape a single dataset page instead of search results? | Yes. Paste the full data.gov.uk dataset URL into the startUrl field. The Actor will extract that one dataset's metadata. |
| What is the maximum number of datasets I can scrape? | Free Apify users are limited to 10 datasets per run. Paid users can set maxItems up to 1,000,000. |
| Does this Actor download the actual data files? | No. It scrapes the dataset listings and returns the metadata plus the direct download URLs. You can use those URLs in another step to fetch the files. |
| Can I sort results by the most recently updated datasets? | Yes. Set the Sort By option to 'recent'. The default is 'best', which sorts by relevance to your search term. |
| What topics are available in the filter? | The full list is Business and economy, Crime and justice, Education, Environment, Government, Government spending, Health, Mapping, Society, Towns and cities, and Transport. |
| Can I combine a search term with a topic filter? | Yes. You can set a searchQuery and a topic at the same time. The Actor will return datasets that match both conditions. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by data.gov.uk. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `startUrl` (type: `string`):

Direct URL to scrape from data.gov.uk. Use this OR search filters below, not both. Example: https://www.data.gov.uk/search?q=economics

## `maxItems` (type: `integer`):

Free users: Limited to 100. Paid users: Optional, max 1,000,000

## `searchQuery` (type: `string`):

Search term to filter datasets. Use this OR startUrl above, not both. Example: 'economics'

## `publisher` (type: `string`):

Filter by publisher name. Example: 'Office for National Statistics'

## `topic` (type: `string`):

Filter by topic. Available: Business and economy, Crime and justice, Education, Environment, Government, Government spending, Health, Mapping, Society, Towns and cities, Transport

## `format` (type: `string`):

Filter by data format. Available: CSV, ESRI REST, GEOJSON, HTML, JSON, KML, PDF, SHP, WFS, WMS, XLS, XML, ZIP, Other

## `oglOnly` (type: `boolean`):

Only include datasets with Open Government Licence

## `sort` (type: `string`):

Sort results by relevance or date

## Actor input object example

```json
{
  "maxItems": 10,
  "searchQuery": "economics",
  "oglOnly": false,
  "sort": "best"
}
```

# Actor output Schema

## `datasets` (type: `string`):

Complete dataset with all scraped dataset information including titles, publishers, formats, topics, and metadata

## `overview` (type: `string`):

Overview view of datasets with key fields displayed in a table format

# 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 = {
    "maxItems": 10,
    "searchQuery": "economics",
    "sort": "best"
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/data-gov-uk-scraper").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 = {
    "maxItems": 10,
    "searchQuery": "economics",
    "sort": "best",
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/data-gov-uk-scraper").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 '{
  "maxItems": 10,
  "searchQuery": "economics",
  "sort": "best"
}' |
apify call parseforge/data-gov-uk-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/data-gov-uk-scraper"
        }
    }
}
```

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/N7yvHz3Uc9Brz5M8P/builds/ybraMlkOvUpNkLwWX/openapi.json
