# GOV.UK Publications Search (`zeiphr/govuk-search`) Actor

Search every publication on GOV.UK (guidance, news, consultations, statistics) by words, organisation, type and date. One clean row per document, paid per row.

- **URL**: https://apify.com/zeiphr/govuk-search.md
- **Developed by:** [Zeiphr](https://apify.com/zeiphr) (community)
- **Categories:** News, Business
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 result rows

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 Publications Search

Search everything published on GOV.UK, the UK Government's official website: guidance, news and press releases, consultations, statistics and more. You get one clean row per document with its title, link, short description, type, dates and the government bodies behind it. No coding and no account with GOV.UK is needed: choose what you want and press Start.

### Who it is for

- **Journalists and researchers** following what a department has announced or changed.
- **Compliance, policy and public affairs teams** who need to know when new guidance or a consultation appears on their topic.
- **Anyone** who wants a spreadsheet of recent government publications instead of clicking through search pages.

### What you can set

| Field | What it does |
| --- | --- |
| Words to search for | Words to look for, for example `flood warning`. Wrap words in double quotes to match the exact phrase, for example `"flood warning"`. Optional. |
| Government organisation | One government body, written as its short web name, for example `hm-revenue-customs`. Optional. |
| Type of document | One kind of document, for example `press_release`. Optional. |
| From date / To date | Exact dates written YYYY-MM-DD. If you fill in "From date", "Days to look back" is ignored. Leaving "To date" empty means today. |
| Days to look back | How many days back from today to look, by the date each document was last updated. Default 7. |
| Order of results | `newest` (most recently updated first, the default) or `relevance` (best word matches first). |
| Maximum documents to return | The most rows you want back. Default 100, up to 10,000. It also caps what you pay. |

If you leave "Words", "Organisation" and "Type" all empty, the date window must be 31 days or less, so a run cannot try to list the whole of GOV.UK. If you give any of the three, the window can be as long as you like.

### What you get

One row per document, with these fields in this order: `title`, `url`, `description`, `documentType`, `updatedAt` (when GOV.UK last published or updated the page; always present), `organisations` (names), `organisationSlugs` (short web names), `topicalEvents`, `worldLocations`, `isHistoric` (true for documents from an earlier government), `government` (the government in power when it was published) and `sourceUrl` (the exact GOV.UK request that returned the row). Anything GOV.UK did not provide is `null`, and empty lists are `[]`. Each document appears only once.

Sample row (from a real run on 4 November 2026, long address shortened):

```json
{
  "title": "PM meeting with Prime Minister Mottley of Barbados: 2 November 2026",
  "url": "https://www.gov.uk/government/news/pm-meeting-with-prime-minister-mottley-of-barbados-2-november-2026",
  "description": "The Prime Minister met the Prime Minister of Barbados Mia Mottley ahead of the Commonwealth Heads of Government Meeting in Antigua.",
  "documentType": "press_release",
  "updatedAt": "2026-11-03T07:47:43Z",
  "organisations": ["Prime Minister's Office, 10 Downing Street"],
  "organisationSlugs": ["prime-ministers-office-10-downing-street"],
  "topicalEvents": [],
  "worldLocations": ["antigua-and-barbuda"],
  "isHistoric": false,
  "government": "2026 Burnham Labour government",
  "sourceUrl": "https://www.gov.uk/api/search.json?count=100&order=-public_timestamp&fields=...&start=0"
}
```

### Pricing

You pay US$0.002 per document returned, and nothing when there are no matches.

### Limits and tips

- **Finding an organisation's short name:** open the organisation's page on GOV.UK. The short name is the last part of the address. For `https://www.gov.uk/government/organisations/hm-revenue-customs` it is `hm-revenue-customs`.
- **Common document types:** `guidance`, `press_release`, `news_story`, `consultation`, `statistics`, `policy_paper`, `research`, `transparency`.
- **Word searches match any of your words** by default, so `flood warning` also finds documents that only mention "warning" (about 36,800 matches on one test). Wrapping the words in double quotes, `"flood warning"`, narrows that to the exact phrase (about 860 matches on the same test). Choosing "relevance" order puts the best matches first.
- **Dates:** the date window and the order both use `updatedAt`, the date a document was last published or updated. World locations come back as short web names such as `antigua-and-barbuda`.
- **Speed:** the actor reads 100 documents per request with a short pause between requests, so 10,000 rows takes a few minutes. If GOV.UK is busy it waits and retries a few times before stopping with a clear message.

Contains public sector information licensed under the Open Government Licence v3.0. Data comes from the GOV.UK Search API; this actor is not affiliated with the UK Government or GOV.UK.

# Actor input Schema

## `query` (type: `string`):

Words or a phrase to look for, for example flood warning or energy bills. Leave empty to get everything that matches your other choices.

## `organisation` (type: `string`):

Only return documents from one government body. Use its short web name: open the organisation's page on GOV.UK and copy the last part of the address. For example https://www.gov.uk/government/organisations/hm-revenue-customs gives hm-revenue-customs.

## `documentType` (type: `string`):

Only return one kind of document. Common choices: guidance, press_release, news_story, consultation, statistics, policy_paper, research, transparency. Leave empty for all types.

## `dateFrom` (type: `string`):

Earliest date to include, written YYYY-MM-DD (for example 2026-10-01). If you set this, 'Days to look back' is ignored.

## `dateTo` (type: `string`):

Latest date to include, written YYYY-MM-DD (for example 2026-10-31). Leave empty to mean today.

## `days` (type: `integer`):

How many days back from today to look, based on the date each document was last updated. Ignored if you fill in 'From date'. If you give no words, organisation or type, this must be 31 or less so the run stays a sensible size.

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

newest puts the most recently updated documents first. relevance puts the best word matches first (only useful when you enter words to search for).

## `maxResults` (type: `integer`):

The most documents you want back. You are charged per document returned, so this also caps your cost.

## Actor input object example

```json
{
  "days": 7,
  "sort": "newest",
  "maxResults": 100
}
```

# Actor output Schema

## `results` (type: `string`):

Every GOV.UK document found, one per row, as a table.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("zeiphr/govuk-search").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("zeiphr/govuk-search").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 '{}' |
apify call zeiphr/govuk-search --silent --output-dataset

```

## MCP server setup

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

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/5lZM49euq0htq76a6/builds/2NNtMyOxzWsSPDhKE/openapi.json
