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

Scrape UK Food Hygiene Ratings from the FSA FHRS API (ratings.food.gov.uk) by postcode, name, council or type. Ideal for restaurant lead generation, compliance checks and market research.

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

## Pricing

from $2.00 / 1,000 result items

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

### What does UK Food Hygiene Ratings (FSA FHRS) Scraper do?

UK Food Hygiene Ratings (FSA FHRS) Scraper pulls **official food hygiene ratings** for restaurants, cafes, takeaways, pubs, shops, schools, hospitals and every other rated food business in the United Kingdom, straight from the Food Standards Agency's public ratings API. You search by business name, address, postcode, local authority (council), business type or rating, and get a clean dataset (JSON, CSV, Excel) or API feed with the rating, inspection date, the three inspection sub-scores, full address and coordinates.

It covers both UK schemes:

- **FHRS** (England, Wales, Northern Ireland): ratings 0 to 5.
- **FHIS** (Scotland): Pass, Improvement Required, Awaiting Inspection, Exempt.

No API key, no login, no proxies. The data is published by the FSA under the Open Government Licence v3, so you can reuse it commercially as long as you keep the attribution (see the licence section below).

The actor **does not** collect personal data. The API's telephone field and the council e-mail address are deliberately dropped and are not available as options.

### Why use it?

- **Hospitality lead lists**: every restaurant, pub or takeaway in a postcode area or council with its rating and address, ready for a CRM.
- **Due diligence** for insurers, lenders, landlords and franchisors: check the current rating, rating date and whether a new rating is pending for a set of premises.
- **Territory and competitor analysis**: count 5-rated versus low-rated businesses by business type in a council area; plot them with the coordinates.
- **Compliance monitoring**: schedule a weekly run for your own sites or your suppliers and get alerted when a rating changes.
- **Data for apps, dashboards and AI agents**: structured, licensed rows without writing any FSA API code.

On Apify you also get scheduling, webhooks, run monitoring and integrations (Google Sheets, Make, Zapier, LangChain, MCP).

### What data does it return?

One row per establishment (mode `search`):

| Field | Type | Description |
|---|---|---|
| `fhrsId` | integer | FSA establishment id, stable across re-inspections |
| `business` | string | Trading name of the establishment |
| `businessType` | string | e.g. `Restaurant/Cafe/Canteen`, `Takeaway/sandwich shop` |
| `businessTypeId` | integer | Id usable as the `businessTypeId` filter |
| `ratingValue` | string | `0`-`5` (FHRS) or `Pass`, `Improvement Required`, `Exempt`, ... (FHIS) |
| `ratingKey` | string | API key of the rating, e.g. `fhrs_5_en-gb` |
| `ratingDate` | string or null | Date of the rating, `YYYY-MM-DD` |
| `newRatingPending` | boolean | A re-inspection result is waiting to be published |
| `schemeType` | string | `FHRS` or `FHIS` |
| `localAuthority` | string | Council that carried out the inspection |
| `localAuthorityCode` | string | Council code printed on FSA records |
| `addressLine1`-`addressLine4` | string or null | Business address |
| `postcode` | string or null | Business postcode |
| `latitude`, `longitude` | number or null | WGS84 coordinates, when the FSA has geocoded the premises |
| `scores.hygiene` | integer or null | Hygienic food handling sub-score (FHRS only, lower is better) |
| `scores.structural` | integer or null | Cleanliness and condition of premises sub-score |
| `scores.confidenceInManagement` | integer or null | Management of food safety sub-score |
| `fsaUrl` | string | Public FSA page for the establishment |
| `meta.sourceUrl` | string | The API request the row came from |
| `meta.licence` | string | `OGL v3` |
| `meta.attribution` | string | Attribution statement to keep when you republish |
| `meta.retrievedAt` | string | UTC timestamp of retrieval |

Lookup modes return short tables instead:

- `localAuthorities`: `localAuthorityId`, `localAuthorityCode`, `localAuthority`, `establishmentCount`, `schemeType` (363 rows).
- `businessTypes`: `businessTypeId`, `businessType` (14 rows).

### How to use it

1. Pick a **Mode**. `search` is the default.
2. Fill in at least one filter: **Business name**, **Address terms**, **Postcode**, **Local authority id**, **Business type id** or **Rating**. Filters combine with AND. The defaults (local authority `120` = Westminster, rating `5`) give a working search straight away; change or clear them to search elsewhere.
3. Set **Max items** (default 50, maximum 5,000). You pay only for rows actually saved.
4. Start the run. Rows appear in the **Output** tab as pages arrive; download them or read them through the API.

Need a council or business type id? Run the actor once with mode `localAuthorities` or `businessTypes` and copy the id from the result. Note that `localAuthorityId` is the API's own id (Westminster = 120, Manchester = 180, Cardiff = 339), not the three-digit code printed on establishment records.

### Example input

The default input (5-rated businesses in Westminster, first 50 rows):

```json
{
    "mode": "search",
    "localAuthorityId": 120,
    "ratingKey": "5",
    "maxItems": 50
}
```

Every 5-rated restaurant in Westminster:

```json
{
    "mode": "search",
    "localAuthorityId": 120,
    "businessTypeId": 1,
    "ratingKey": "5",
    "maxItems": 500
}
```

Everything in a postcode area:

```json
{
    "mode": "search",
    "postcode": "SW1A",
    "maxItems": 200
}
```

### Example output

```json
[
    {
        "fhrsId": 412156,
        "business": "86 St James Limited",
        "businessType": "Other catering premises",
        "businessTypeId": 7841,
        "ratingValue": "5",
        "ratingKey": "fhrs_5_en-gb",
        "ratingDate": "2025-05-29",
        "newRatingPending": false,
        "schemeType": "FHRS",
        "localAuthority": "Westminster",
        "localAuthorityCode": "533",
        "addressLine1": "86 ST JAMES'S STREET",
        "addressLine2": null,
        "addressLine3": "LONDON",
        "addressLine4": null,
        "postcode": "SW1A 1PL",
        "latitude": 51.5052003,
        "longitude": -0.1386974,
        "scores": { "hygiene": 5, "structural": 0, "confidenceInManagement": 0 },
        "fsaUrl": "https://ratings.food.gov.uk/business/412156",
        "meta": {
            "sourceUrl": "https://api.ratings.food.gov.uk/Establishments?address=SW1A&sortOptionKey=Relevance&pageNumber=1&pageSize=50",
            "licence": "OGL v3",
            "licenceUrl": "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/",
            "attribution": "Contains public sector information licensed under the Open Government Licence v3.0. Source: Food Standards Agency, Food Hygiene Rating Scheme.",
            "retrievedAt": "2026-09-18T10:07:54.151Z"
        }
    }
]
```

### How much does it cost?

The actor uses **pay-per-event** pricing. You pay two things and nothing else:

| Event | Price | When |
|---|---|---|
| Actor start | $0.01 | Once per run, after your input has been validated |
| Result item | $0.002 | Once per row saved to the dataset |

A run that returns 100 establishments costs **$0.21**; 1,000 establishments cost $2.01; the full local authority lookup (363 rows) costs $0.74. Set **Maximum cost per run** in the run options to cap spending: the actor stops cleanly at the cap and you keep every row saved up to that point. There is no charge for runs that fail on input validation. The actor needs very little memory (256 MB is enough), so platform usage on top of the event prices is negligible.

### Limits

- Maximum 5,000 rows per run. Split larger jobs by council, business type or rating (the run log tells you how many establishments matched in total).
- The search covers the FSA API's own filters: name, address/postcode terms, council, business type, rating and scheme. Free-text search is word based, not fuzzy; try a shorter term if you get no results.
- Scottish (FHIS) establishments have no numeric sub-scores; `scores.*` is `null` for them.
- Latitude and longitude are `null` for premises the FSA has not geocoded.
- The FSA data is refreshed by local authorities on their own schedules; `ratingDate` tells you how old a rating is.
- The actor calls the public FSA API sequentially with a short pause between pages. If the API is temporarily unavailable it retries with backoff and then fails with a clear message.

### Data licence and attribution

The output contains public sector information licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/). Source: Food Standards Agency, Food Hygiene Rating Scheme (FHRS) and Food Hygiene Information Scheme (FHIS), retrieved via the [FSA ratings API](https://api.ratings.food.gov.uk/help). When you publish or redistribute the data, keep this attribution:

> Contains public sector information licensed under the Open Government Licence v3.0. Source: Food Standards Agency.

The FSA is not affiliated with this actor and does not endorse it.

### FAQ and support

**Is the data personal data?** The rows describe businesses and premises, not people. The actor never outputs the telephone field or e-mail addresses. Some sole traders trade under their own name; if you build lists from the output, you remain responsible for using them lawfully (UK GDPR and PECR apply to marketing).

**Why does a filter return zero rows?** The most common cause is using the council code (e.g. `533`) as `localAuthorityId`; use the API id from mode `localAuthorities` instead (Westminster is `120`). Rating keys are exact: `5`, not `5 stars`.

**Something looks wrong?** Open a report in the **Issues** tab with your input and the run id. Issues are answered within one working day.

**Need programmatic access?** See the **API** tab for ready-made snippets in JavaScript, Python and curl.

# Actor input Schema

## `mode` (type: `string`):

"search" returns establishments matching your filters. "localAuthorities" returns the list of councils with their localAuthorityId. "businessTypes" returns the business type list with businessTypeId. Use the two lookup modes to find ids for the search filters.

## `name` (type: `string`):

Words to look for in the business name, e.g. "Greggs" or "Pizza Express".

## `address` (type: `string`):

Words to look for in the address, e.g. a street or town name ("High Street Oxford").

## `postcode` (type: `string`):

Full or partial UK postcode, e.g. "SW1A" or "M1 1AE". Partial postcodes match every address that starts with them.

## `localAuthorityId` (type: `integer`):

Restrict to one council. This is the API id (Westminster = 120, Manchester = 180, Cardiff = 339), not the code printed on records. Run mode "localAuthorities" to get the full list.

## `businessTypeId` (type: `integer`):

Restrict to one business type (e.g. 1 = Restaurant/Cafe/Canteen, 7843 = Pub/bar/nightclub, 7846 = Takeaway/sandwich shop). Run mode "businessTypes" to get the full list.

## `ratingKey` (type: `string`):

Only establishments with exactly this rating. England, Wales and Northern Ireland (FHRS): "0" to "5". Scotland (FHIS): "Pass", "ImprovementRequired", "AwaitingPublication", "AwaitingInspection", "Exempt".

## `schemeTypeKey` (type: `string`):

Optional. "FHRS" = England, Wales and Northern Ireland (0-5 ratings). "FHIS" = Scotland (Pass / Improvement Required).

## `sortOptionKey` (type: `string`):

How the API orders results before paging.

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

Stop after this many rows have been saved. You are charged only for rows actually saved.

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

Rows requested per API call (search mode). Larger pages mean fewer calls; the API caps the value itself. Lower it only if the API returns errors.

## `requestDelayMs` (type: `integer`):

Pause between successive API calls, to stay polite to the public FSA service.

## Actor input object example

```json
{
  "mode": "search",
  "localAuthorityId": 120,
  "ratingKey": "5",
  "schemeTypeKey": "",
  "sortOptionKey": "Relevance",
  "maxItems": 50,
  "pageSize": 200,
  "requestDelayMs": 250
}
```

# Actor output Schema

## `items` (type: `string`):

No description

## `itemsCsv` (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 = {
    "name": "",
    "address": "",
    "postcode": "",
    "localAuthorityId": 120
};

// Run the Actor and wait for it to finish
const run = await client.actor("lafabbricallc/uk-food-hygiene-ratings").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 = {
    "name": "",
    "address": "",
    "postcode": "",
    "localAuthorityId": 120,
}

# Run the Actor and wait for it to finish
run = client.actor("lafabbricallc/uk-food-hygiene-ratings").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 '{
  "name": "",
  "address": "",
  "postcode": "",
  "localAuthorityId": 120
}' |
apify call lafabbricallc/uk-food-hygiene-ratings --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lafabbricallc/uk-food-hygiene-ratings"
        }
    }
}
```

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/hwkXrewO8XlazrMLe/builds/tLonemeAAVWDykIXs/openapi.json
