# UK Food Hygiene Ratings — FSA by Council, Postcode & Type (`alauddinburki/uk-food-hygiene`) Actor

Every food business the UK Food Standards Agency rates, by council, postcode or distance: rating, inspection date, hygiene scores, coordinates, and new or changed ratings since the last run. Official open data, no key.

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

## Pricing

from $0.50 / 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?

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

## UK Food Hygiene Ratings — FSA by Council, Postcode & Type

Every food business the **UK Food Standards Agency** rates — restaurants, takeaways, pubs, hotels, shops, caterers,
manufacturers — by **council, postcode, name or distance**, filtered by business type and rating. Each row has the
rating, inspection date, the three inspection scores, coordinates and the official rating page. Run it on a schedule
and get only the **new, re-inspected or re-rated** businesses. Open Government Licence data, no key.

### Use it for

- **Food-safety, pest-control and training suppliers:** every takeaway in a council rated 0–2.
- **Delivery platforms and wholesalers:** new food businesses opening in your area (`onlyChanges`).
- **Landlords, investors, journalists:** ratings and changes across a city.

### Input

| Field | Example |
|---|---|
| `localAuthorities` | `["Manchester", "Westminster"]` — names are matched tolerantly; unknown ones are reported |
| `postcodes` | `["M1", "SW1A"]` |
| `latitude`, `longitude`, `radiusMiles` | around a point |
| `businessTypes` | `["Takeaway/sandwich shop"]` |
| `ratings` | `["0", "1", "2"]`, or Scotland's `["Improvement Required"]` |
| `onlyChanges` | only new or changed since the last run |

### Output

| Field | Example |
|---|---|
| `businessName`, `businessType` | A$AP Coffee · Restaurant/Cafe/Canteen |
| `rating`, `ratingDate`, `newRatingPending` | 4 · 2023-08-30 · false |
| `hygieneScore`, `structuralScore`, `managementScore` | 0 · 5 · 10 (lower is better) |
| `address`, `postcode`, `localAuthority`, `latitude`, `longitude` | |
| `change`, `previousRating` | rating changed · 5 (from the second run) |
| `ratingUrl` | the official FSA page |

### Pricing

Pay per result: **$0.0005 per row**. Plus a start fee of $0.0001 per GB of allocated memory (minimum one event).
One row is one establishment.

### Good to know

- Businesses run from a private home have no published address; the FSA withholds it, and this Actor skips them.
- Ratings are filtered by the Actor itself (the API's own rating operator did not behave as documented in testing).
- The SUMMARY counts rows by rating and lists councils it could not match.

### Verification status (2026-11-11, local)

- ✅ 6 unit tests on live fixtures: council matching (363 authorities), query building, row mapping, home-address
  skip, rating filter, change detection.
- ✅ Live: all 765 Manchester takeaways (ratings counted, unknown council reported); a rerun with `onlyChanges`
  returned 0; ratings 0–1 → 31 rows, 0 schema mismatches.

# Actor input Schema

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

Names as the FSA lists them, e.g. Manchester, Westminster, Leeds, Glasgow City.

## `postcodes` (type: `array`):

Full or partial, e.g. M1, SW1A 1AA.

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

Part of the business name.

## `latitude` (type: `number`):

Search around a point (with longitude and radius).

## `longitude` (type: `number`):

Search around a point.

## `radiusMiles` (type: `number`):

Around the point.

## `businessTypes` (type: `array`):

Empty = all.

## `ratings` (type: `array`):

England/Wales/NI: "0"–"5", "AwaitingInspection", "Exempt". Scotland: "Pass", "Improvement Required". Empty = all.

## `onlyChanges` (type: `boolean`):

Return only establishments that are new, re-inspected or re-rated since the previous run with the same state key.

## `stateKey` (type: `string`):

Separate keys keep separate watch lists.

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

Stop after this many.

## Actor input object example

```json
{
  "localAuthorities": [
    "Manchester"
  ],
  "radiusMiles": 1,
  "businessTypes": [
    "Takeaway/sandwich shop"
  ],
  "onlyChanges": false,
  "stateKey": "FSA_RATINGS",
  "maxItems": 100
}
```

# Actor output Schema

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

Every row of the run, in the dataset (fields as listed under Output in the README).

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

Counts, items not found and other notes for the run.

# 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": [
        "Manchester"
    ],
    "businessTypes": [
        "Takeaway/sandwich shop"
    ],
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("alauddinburki/uk-food-hygiene").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": ["Manchester"],
    "businessTypes": ["Takeaway/sandwich shop"],
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("alauddinburki/uk-food-hygiene").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": [
    "Manchester"
  ],
  "businessTypes": [
    "Takeaway/sandwich shop"
  ],
  "maxItems": 100
}' |
apify call alauddinburki/uk-food-hygiene --silent --output-dataset

```

## MCP server setup

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

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/SQadW4reryKTxfZCB/builds/gPkKFTgr1f9KAIPfZ/openapi.json
