# UK Food Hygiene Ratings Scraper (`wakey7dev/fsa-food-hygiene-scraper`) Actor

Scrape Food Standards Agency hygiene ratings for UK restaurants, pubs, takeaways. Search by name, location, local authority. Free API, no key required. Estate agents, delivery apps, councils.

- **URL**: https://apify.com/wakey7dev/fsa-food-hygiene-scraper.md
- **Developed by:** [Chris Wakefield](https://apify.com/wakey7dev) (community)
- **Categories:** Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 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.

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

## 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

![Chris The Dev](https://raw.githubusercontent.com/chriswakefield87/appstore-screenshot-translator/main/assets/actor-banner.png)

## 🍽️ FSA Food Hygiene Ratings Scraper

Extract and normalize UK Food Standards Agency (FSA) food hygiene ratings for any business. Search by name, location, local authority, or business type — get clean, structured data with normalized ratings, business categories, and inspector scores.

**Data source:** [Food Standards Agency](https://ratings.food.gov.uk/) — official UK government data, free and open.

### ✨ Features

- 🔍 **Search by name** — find any food business (restaurants, cafes, takeaways, retailers)
- 📍 **Location filter** — narrow results by city or postcode area
- 🏛️ **Local authority filter** — search within a specific council area
- 🏷️ **Business type filter** — filter by restaurant, takeaway, school, retailer, etc.
- ⭐ **Minimum rating filter** — only show businesses rated 5, 4, 3+
- 📊 **Normalized output** — clean ratings, business categories, and addresses
- 📈 **Statistics** — rating distribution, business type breakdown, top authorities

### 📥 Input

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `searchTerm` | string | \* | Business name or keyword (e.g. "pizza", "tesco", "cafe") |
| `location` | string | no | Filter by city/address (e.g. "London", "Manchester") |
| `localAuthorityId` | integer | no | Filter by local authority ID |
| `businessTypeId` | integer | no | Filter by business type (1=Restaurant, 5=Takeaway, etc.) |
| `minRating` | string | no | Minimum rating: "5", "4", "3", "2", "1", "0" |
| `sortOption` | string | no | Sort: "relevance", "rating", "distance", "name" |
| `maxResults` | integer | no | Max results to return (1-500, default 20) |

\*At least one of `searchTerm`, `location`, or `localAuthorityId` must be provided.

### 📤 Output

The actor produces three outputs:

1. **Dataset** — full normalized results with all fields
2. **OUTPUT** — human-readable summary table with rating distribution
3. **STATS** — machine-readable statistics

#### Example dataset item:

```json
{
  "fhrsId": 1892428,
  "businessName": "553 London",
  "businessType": "Restaurant / Cafe / Canteen",
  "businessCategory": "Hospitality",
  "rating": {
    "value": 5,
    "label": "Very Good",
    "score": 5
  },
  "address": "The Cauliflower, 553 High Road",
  "city": "Ilford",
  "postcode": "IG1 1TZ",
  "localAuthority": "Redbridge",
  "ratingDate": "2025-11-19T00:00:00",
  "latitude": 51.559,
  "longitude": 0.072,
  "hygieneScore": 0,
  "structuralScore": 0,
  "confidenceInManagementScore": 0,
  "detailUrl": "https://ratings.food.gov.uk/business/1892428"
}
```

### 🎯 Use Cases

- **Food delivery platforms** — verify restaurant hygiene ratings before onboarding
- **Insurance companies** — assess food business risk profiles
- **Compliance firms** — monitor rating changes across authorities
- **Restaurant chains** — benchmark competitor ratings
- **Real estate** — evaluate area food safety for commercial investments
- **Consumer apps** — build "find safe places to eat" features

### 🔢 Business Type IDs

| ID | Type |
|----|------|
| 1 | Restaurant/Cafe/Canteen |
| 5 | Takeaway/Sandwich Shop |
| 7 | Hotel/B\&B/Guest House |
| 14 | School/College/University |
| 4613 | Hospitals/Childcare/Caring |
| 7844 | Retailers — Supermarkets |
| 7845 | Retailers — Other |

### 📋 Example Input

```json
{
  "searchTerm": "pizza",
  "location": "London",
  "minRating": "4",
  "maxResults": 10,
  "sortOption": "rating"
}
```

### 📝 License

Data sourced from the UK Food Standards Agency under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/).

# Actor input Schema

## `searchTerm` (type: `string`):

Business name or keyword to search for (e.g. 'pizza', 'london cafe', 'tesco'). Leave empty to search by location or authority only.

## `location` (type: `string`):

Filter by address/city (e.g. 'London', 'Manchester', 'Leeds'). Leave empty to search all locations.

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

Filter by local authority ID. Use the separate Authorities endpoint to find IDs. Leave empty for all authorities.

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

Filter by business type. 1=Restaurant/Cafe/Canteen, 5=Takeaway, 7=Hotel, 14=Schools/Colleges, 4613=Hospitals/Childcare, 7844=Retailers. Leave empty for all types.

## `minRating` (type: `string`):

Only show businesses with at least this rating. 0=Exempt, 1-5=Pass scores.

## `sortOption` (type: `string`):

How to sort results.

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

Maximum number of results to return (1-500).

## Actor input object example

```json
{
  "searchTerm": "pizza",
  "minRating": "",
  "sortOption": "relevance",
  "maxResults": 20
}
```

# Actor output Schema

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

Complete dataset items with all business details and normalized fields.

## `summary` (type: `string`):

Human-readable summary table for the Console Output tab.

## `stats` (type: `string`):

Machine-readable statistics including rating distribution and business type breakdown.

# 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 = {
    "searchTerm": "pizza",
    "location": "",
    "maxResults": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("wakey7dev/fsa-food-hygiene-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 = {
    "searchTerm": "pizza",
    "location": "",
    "maxResults": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("wakey7dev/fsa-food-hygiene-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 '{
  "searchTerm": "pizza",
  "location": "",
  "maxResults": 20
}' |
apify call wakey7dev/fsa-food-hygiene-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,wakey7dev/fsa-food-hygiene-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/jE0DRhvBroCBOVBIJ/builds/Bap9bR4RFyEokngOQ/openapi.json
