# UK Food Hygiene Ratings - FSA Business Data (`onescriptfix/uk-food-hygiene-ratings`) Actor

Search official UK food hygiene ratings by business name, area, council or business type. Export flat business records with inspection dates, scores, coordinates and source links. No source account or API key required.

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

## Pricing

$2.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?

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 Business Data

Export food-business ratings from the Food Standards Agency's public API. Search by business name, town, address, postcode, local authority or business type, and download a flat dataset in JSON, CSV or Excel.

Use it to maintain restaurant directories, check supplier records, compare branches and prepare hospitality market research. Each result includes the inspection date, source extraction timestamp and a link to the original business record.

### Start a run

The default input searches for Pret A Manger in London and returns up to 20 businesses. Click **Start** without changing the input to try it.

```json
{
  "name": "Pret A Manger",
  "address": "London",
  "maxItems": 20,
  "proxyConfiguration": { "useApifyProxy": false }
}
```

Clear `name` or `address` with an empty string to remove that filter. A supplied `localAuthorityId` or `businessTypeId` is combined with the other filters.

### Input

| Field | Default | Meaning |
| --- | --- | --- |
| `name` | `Pret A Manger` | Business-name search. Empty means any name. |
| `address` | `London` | Town, address or postcode search. Empty means any area. |
| `localAuthorityId` | `0` | Optional FSA authority ID; zero disables this filter. This differs from an authority's published code. |
| `businessTypeId` | `0` | Optional FSA business-type ID. Restaurant/Cafe/Canteen is `1`. |
| `maxItems` | `20` | Maximum unique output records, 1–10,000. |
| `pageSize` | `100` | Records per source request, 1–100; also capped by `maxItems`. |
| `maxPages` | `100` | Maximum source pages, 1–500. May return fewer than `maxItems`. |
| `requestDelaySeconds` | `1.2` | Minimum request interval, 1–60 seconds. |
| `proxyConfiguration` | Proxy off | Optional Apify/custom proxy. A proxy is not required by the source. |

Authority and business-type identifiers are listed in the [official API index](https://api.ratings.food.gov.uk/Help/Index/). Searches use the FSA's own matching behavior; an address term is not a geographic boundary.

### Output

One row represents one establishment, identified by the string `fhrsId`. Optional unavailable fields are `null`. Ratings stay strings so values such as `Pass`, `Exempt` and `AwaitingInspection` retain their meaning. Scores and coordinates are numeric; zero scores are preserved. The dataset contains no email or telephone fields.

The following is one complete record from the small live test. It is a dated example, not a statement of the business's current rating. The full three-record sample is in `sample-output.json`.

```json
{
  "fhrsId": "902473",
  "businessName": "Pret A Manger",
  "businessType": "Takeaway/sandwich shop",
  "businessTypeId": 7844,
  "address": "London City Airport, London",
  "postcode": "E16 2PX",
  "rating": "4",
  "ratingDate": "2026-03-24",
  "ratingKey": "fhrs_4_en-gb",
  "schemeType": "FHRS",
  "newRatingPending": false,
  "hygieneScore": 10,
  "structuralScore": 5,
  "managementScore": 5,
  "localAuthorityName": "City of London Corporation",
  "localAuthorityCode": "508",
  "latitude": null,
  "longitude": null,
  "sourceUrl": "https://ratings.food.gov.uk/business/902473",
  "sourceExtractedAt": "2026-09-28T23:50:27.8192558+01:00",
  "fetchedAt": "2026-09-28T22:50:30Z",
  "dataSource": "Food Standards Agency",
  "licenseUrl": "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
}
```

### Pricing

**Free during launch:** you only pay Apify's normal platform usage, which is a fraction of a cent for a typical run. Paid pricing may be introduced later (about $0.80 per 1,000 saved businesses); Apify announces any change on the Store pricing tab at least 14 days in advance.

Duplicate records are discarded before saving.

### FAQ and limitations

**Do I need an FSA account or API key?** No. The [official API](https://api.ratings.food.gov.uk/help) currently provides access without registration.

**Does a rating describe the business today?** It describes the recorded inspection. Keep `ratingDate`, `sourceExtractedAt` and `fetchedAt` with downstream copies, and consult `sourceUrl` for current information.

**Why are some ratings text rather than numbers?** The API includes different schemes and non-numeric statuses. Read `schemeType` and `rating` together; do not compare an FHIS label numerically with an FHRS rating.

**Why are fewer rows returned?** The search may have fewer matches, `maxPages` or the Apify spending limit may be reached, or malformed source records may be skipped. `RUN_STATS` in the key-value store records counts and the stopping reason. A changed response format or repeated page fails visibly rather than pretending the result is complete.

**Can I export the whole country every day?** This actor is for bounded searches. The FSA recommends its [nightly open-data files](https://api.ratings.food.gov.uk/Help/BestPractices) for regular full downloads. This actor uses one request at a time and pages of at most 100. Offset pagination over a changing source cannot guarantee a complete point-in-time snapshot.

**Does it track changes between runs?** Each run is a fresh snapshot. Join successive exports on `fhrsId` in your own workflow. Deduplication applies within one uninterrupted run; automatic resume after a restart is not provided.

### Responsible use and attribution

Contains Food Standards Agency information licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/). Preserve source attribution and dates when sharing data. This actor is independent of the FSA and uses no FSA logos or rating imagery. Follow the [FSA reuse terms](https://www.food.gov.uk/terms-and-conditions).

Use business records responsibly. Do not infer or recover withheld addresses or personal contact information. Robots.txt is checked at runtime; denied paths, ambiguous policies and access failures stop the run. Retries are limited to temporary errors. Proxy settings do not change these rules.

### Local development

Requires Python 3.13. Install `requirements-dev.txt` in a virtual environment, then run `python -m pytest -q` and `python -m src --input test-input.json` from this actor directory. Local SDK storage stays in the ignored `storage/` directory. See `TESTING.md` for the recorded commands and results.

# Actor input Schema

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

Name to search; clear this for all businesses in your selected area.

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

Address search sent to the FSA. Clear this to search all areas.

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

Optional numeric FSA API local authority ID; 0 means no filter. This is not localAuthorityCode.

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

Optional numeric FSA business type ID; 0 means no filter. Restaurant/Cafe/Canteen is 1.

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

Maximum unique records saved and billed across this run.

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

At most 100 source records per request; also capped by maxItems.

## `maxPages` (type: `integer`):

Stop after this many pages, even if filters find fewer results. Includes empty pages.

## `requestDelaySeconds` (type: `number`):

Minimum interval between all requests. A longer robots.txt delay takes precedence.

## `proxyConfiguration` (type: `object`):

Off by default. Optional Apify Proxy requires your Apify account configuration. Proxies never override robots.txt or access restrictions.

## Actor input object example

```json
{
  "name": "Pret A Manger",
  "address": "London",
  "localAuthorityId": 0,
  "businessTypeId": 0,
  "maxItems": 20,
  "pageSize": 100,
  "maxPages": 100,
  "requestDelaySeconds": 1.2,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (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": "Pret A Manger",
    "address": "London",
    "maxItems": 20,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("onescriptfix/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": "Pret A Manger",
    "address": "London",
    "maxItems": 20,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("onescriptfix/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": "Pret A Manger",
  "address": "London",
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call onescriptfix/uk-food-hygiene-ratings --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,onescriptfix/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/qlW12VNedxc7FoNo4/builds/h5X9p8FYTV7mXhqUx/openapi.json
