# UK Food Hygiene Ratings Scraper (FSA) (`pohjastudio/uk-food-hygiene-ratings-scraper`) Actor

Scrape UK food hygiene ratings from the Food Standards Agency register: business name, type, address, postcode, rating, inspection scores and coordinates.

- **URL**: https://apify.com/pohjastudio/uk-food-hygiene-ratings-scraper.md
- **Developed by:** [Pohja Studio](https://apify.com/pohjastudio) (community)
- **Categories:** Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## UK Food Hygiene Ratings Scraper (FSA)

Scrape the UK's official food hygiene register, published by the **Food Standards Agency**. Every restaurant, takeaway, pub, shop, school, care home and food producer inspected by a UK council is in here — roughly 600,000 premises across 363 local authorities — with its rating, inspection scores, address and coordinates.

No API key, no account. Open Government Licence data.

### What you get

| Field | Description |
|---|---|
| `businessName`, `businessType`, `businessTypeId` | Premises and what kind it is |
| `ratingValue`, `ratingNumeric`, `ratingScheme`, `ratingDate` | The published rating and when it was given |
| `hygieneScore`, `structuralScore`, `managementScore` | The three inspection components behind the rating |
| `address`, `addressLines`, `postcode` | Full address |
| `latitude`, `longitude` | Coordinates, present on nearly every record |
| `phone` | Where the council publishes one |
| `localAuthority`, `localAuthorityEmail`, `localAuthorityWebsite` | The inspecting council |
| `newRatingPending` | A re-inspection result is on its way |
| `fhrsId`, `url` | Identifier and a direct link to the public listing |

### Use cases

- **Food-safety consultants and training providers** — premises rated 0–2 are businesses with a problem they are legally motivated to fix. Filter by rating band and postcode to get a local prospect list with addresses.
- **Suppliers to hospitality** — EPOS, equipment, packaging, cleaning and insurance sales teams get a segmented list of restaurants, takeaways and pubs by area.
- **Delivery platforms and marketplaces** — onboard or screen merchants against their current rating.
- **Insurers and lenders** — hygiene ratings as a risk signal for food businesses.
- **Property and location analysts** — coordinates on every record make catchment and density analysis straightforward.

### Input

| Option | Description |
|---|---|
| `localAuthorities` | Council names, matched as substrings (`Birmingham`, `City of London`). Empty means all 363. |
| `minRating` / `maxRating` | The 0–5 FHRS band. `maxRating: 2` is the classic prospecting filter. |
| `ratingValues` | Exact labels, for either scheme: `5`, `4`, `Pass`, `Improvement Required`, `Exempt`. |
| `businessTypeIds` | 1 = Restaurant/Cafe/Canteen, 7843 = Takeaway, 7842 = Pub/bar/nightclub, 5 = Caring premises, 4613 = School/college. |
| `postcodePrefix` | e.g. `EC3`. Spacing and case ignored. |
| `ratedAfter` / `ratedBefore` | Inspection date window — new ratings, or stale ones. |
| `maxHygieneScore` | Keep better performers. Higher scores mean worse hygiene in this scheme. |
| `onlyWithPhone`, `excludeScotland` | Trim to contactable premises, or to the 0–5 scheme only. |
| `maxItems`, `pageSize`, `includeRawFields` | Run size, request size, raw payload. |

#### Example: poorly-rated food businesses in central London

```json
{
  "localAuthorities": ["City of London Corporation"],
  "maxRating": 2,
  "excludeScotland": true,
  "maxItems": 500
}
```

#### Example: every takeaway in Birmingham and Manchester

```json
{
  "localAuthorities": ["Birmingham", "Manchester"],
  "businessTypeIds": ["7843"],
  "maxItems": 5000
}
```

### Two rating schemes

England, Wales and Northern Ireland use **FHRS** — a 0–5 score where 5 is best. Scotland uses **FHIS**, which publishes `Pass`, `Improvement Required` or `Exempt` and no number.

Numeric filters (`minRating`, `maxRating`, `maxHygieneScore`) therefore apply to FHRS records only and exclude Scottish ones, rather than inventing an equivalence between the two scales. To include Scotland, filter with `ratingValues` instead.

### How the run works

The FSA API requires at least one filter on every request, so this Actor queries authority by authority. Running without `localAuthorities` walks all 363 — that is the full national dataset and a large run, so set `maxItems` deliberately.

Rating and inspection filters are applied by the Actor over the records it reads, because the API accepts a `ratingKey` parameter and then ignores it.

### Data source and licence

Data comes from the [FSA food hygiene rating API](https://api.ratings.food.gov.uk), published under the Open Government Licence. Ratings are business information about premises, not personal data; phone numbers and emails in the output are the ones the councils publish for the business and for themselves.

### Pricing

Billed per establishment delivered. Records that are read but filtered out, and duplicates, are not charged.

# Actor input Schema

## `localAuthorities` (type: `array`):

Council names to scan, matched as substrings of the FSA's own names (e.g. "Birmingham", "City of London", "Aberdeen"). Leave empty to scan all 363 authorities across the UK.

## `minRating` (type: `integer`):

FHRS scale only. Scottish premises use Pass / Improvement Required and are excluded by any numeric rating filter.

## `maxRating` (type: `integer`):

Use with minRating to target a band. Ratings of 0-2 are the premises that need remedial work.

## `ratingValues` (type: `array`):

Match the rating label exactly. Works for both schemes: "5", "4" … or "Pass", "Improvement Required", "Exempt".

## `businessTypeIds` (type: `array`):

FSA business type IDs. Common ones: 1 = Restaurant/Cafe/Canteen, 5 = Caring premises, 7843 = Takeaway, 7838 = Retailer (other), 7842 = Pub/bar/nightclub, 4613 = School/college.

## `postcodePrefix` (type: `string`):

Keep only premises whose postcode starts with this. Spaces and case are ignored, so "ec3" and "EC3" both work.

## `ratedAfter` (type: `string`):

Only premises inspected on or after this date. Useful for monitoring newly published ratings.

## `ratedBefore` (type: `string`):

Only premises inspected before this date. Useful for finding stale inspections.

## `maxHygieneScore` (type: `integer`):

In this scheme a higher score means worse performance, so this keeps the better performers. Premises with no published score are excluded.

## `onlyWithPhone` (type: `boolean`):

Most records have no phone number, so this trims the list sharply.

## `excludeScotland` (type: `boolean`):

Drop Scottish records, which use Pass / Improvement Required instead of a 0-5 rating.

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

Stop after this many premises. You are charged per premises delivered.

## `pageSize` (type: `integer`):

Records fetched per request (100-5000). Larger pages mean fewer requests per authority.

## `includeRawFields` (type: `boolean`):

Attach the untouched FSA record under `raw`.

## Actor input object example

```json
{
  "localAuthorities": [
    "Birmingham",
    "Manchester"
  ],
  "ratingValues": [
    "Pass",
    "5"
  ],
  "businessTypeIds": [
    "1",
    "7843"
  ],
  "postcodePrefix": "EC3",
  "onlyWithPhone": false,
  "excludeScotland": false,
  "maxItems": 5000,
  "pageSize": 1000,
  "includeRawFields": false
}
```

# Actor output Schema

## `establishments` (type: `string`):

Rated premises with business name and type, full address, postcode, coordinates, hygiene rating and the three inspection scores.

## `establishmentsInConsole` (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 = {
    "localAuthorities": [
        "City of London Corporation"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pohjastudio/uk-food-hygiene-ratings-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 = { "localAuthorities": ["City of London Corporation"] }

# Run the Actor and wait for it to finish
run = client.actor("pohjastudio/uk-food-hygiene-ratings-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 '{
  "localAuthorities": [
    "City of London Corporation"
  ]
}' |
apify call pohjastudio/uk-food-hygiene-ratings-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pohjastudio/uk-food-hygiene-ratings-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/fCRjbIhTxzRjdTZdy/builds/erLOMf8KfOBOFfsdj/openapi.json
