# UK New Food Businesses (FSA Hygiene Ratings) (`secondshift-data/uk-new-food-businesses-fsa`) Actor

New UK food businesses awaiting first inspection (default) or recently rated, from the official FSA Food Hygiene Rating Scheme, by local authority or postcode radius.

- **URL**: https://apify.com/secondshift-data/uk-new-food-businesses-fsa.md
- **Developed by:** [SecondShift Data](https://apify.com/secondshift-data) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 33.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.005 / business

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 New Food Businesses (FSA Hygiene Ratings)

Find UK **new food businesses**: premises registered with their council that are **awaiting their first hygiene inspection** (the default view), and optionally premises **recently rated** under the Food Standards Agency's Food Hygiene Rating Scheme (FHRS). Useful for suppliers, equipment/insurance/software vendors, and local-market researchers.

Search by **local authority** (name or FSA ID) and/or **postcode + radius**, optionally filter by business type and (for rated businesses) days back, and get one clean dataset row per business.

### How it works

The Actor reads the official [FSA FHRS API](https://api.ratings.food.gov.uk/help) (no key needed, API v2), pages through the selected area, and keeps establishments according to the *What to return* mode below. Requests are throttled (max ~2/second) and retried on errors.

### What counts as "new" (date rules)

The FHRS API marks first-time premises with `RatingValue: "AwaitingInspection"` / `RatingKey: "fhrs_awaitinginspection_en-gb"`. Their `RatingDate` is **not empty but a placeholder** (e.g. `1901-01-01T00:00:00`), so they can never match a "last N days" test. The Actor therefore:

- identifies them by rating key/value and treats any rating date before 1990 as "no date" (`ratingDate` is `null` in the output; `awaitingInspection` is `true`);
- returns **all** current awaiting-inspection businesses in the area (after the business-type filter), **not date-filtered**. `daysBack` does not apply to them;
- sorts them highest FHRS ID first. ASSUMPTION: FHRS IDs are allocated in increasing order, so a higher ID is likely a more recent registration; the FSA publishes no registration date. A large authority can have hundreds awaiting, some for a long time, so use `maxResults` to take the newest.

### Important limits (please read)

- **Recently rated is not the same as new.** The API exposes only the *latest* rating date. A business rated 10 days ago may be brand new **or** an established business that was re-inspected. Awaiting inspection is the cleaner "new" signal, but it also includes premises the council has not yet got round to inspecting.
- Ratings change. FSA's terms say users must use the current rating or show the date it was updated – every row includes `ratingDate`; the data is a snapshot taken at run time.
- Coverage is England, Wales and Northern Ireland (and Scotland's FHS scheme, which uses "Pass"/"Improvement Required" values). Some records lack coordinates or have FSA-side data quirks, which are passed through unchanged.
- **Blank addresses are common among awaiting-inspection rows.** Measured example from one authority (Bristol, one run in Oct 2026): 234 of 563 awaiting-inspection rows (about 42%) had a blank address, and some had a partial postcode. This is how they appear in the FSA records; the Actor passes them through unchanged. It is a single-authority example, not a national figure.
- Data comes from local authorities, so it can lag real-world events.

### Input

| Field | Meaning | Default |
|---|---|---|
| `localAuthorities` | Names (e.g. `Cambridge City`) or numeric FSA IDs. Unique partial names work. | – |
| `postcode`, `radiusMiles` | Centre and radius (geocoded with [postcodes.io](https://postcodes.io)) | radius 5 |
| `resultMode` | `awaitingInspection` (default), `recentlyRated`, or `both` | awaitingInspection |
| `daysBack` | Rated within the last N days. Only for `recentlyRated` / `both`; ignored for awaiting-inspection rows | 30 |
| `businessTypes` | Optional FSA business types, e.g. `Restaurant/Cafe/Canteen`, `Pub/bar/nightclub` | all |
| `includeAwaitingInspection` | **Deprecated** legacy flag. `true` → `resultMode: "both"`, `false` → `"recentlyRated"`. An explicit `resultMode` always wins; a deprecation line is logged | – |
| `maxResults` | Cap on rows (you pay per row) | 100 |

Provide at least one of `localAuthorities` or `postcode`. Results: rated rows newest rating first, then awaiting-inspection rows highest FHRS ID first; de-duplicated by FHRS ID.

Example input:

```json
{ "localAuthorities": ["Bristol"], "maxResults": 100 }
```

Recently rated instead:

```json
{ "localAuthorities": ["Cambridge City", "Hackney"], "resultMode": "recentlyRated", "daysBack": 30, "maxResults": 20 }
```

### Output (one item per business)

```json
{
  "fhrsId": 1935132,
  "businessName": "BaxterStorey - Amazon LHR140",
  "businessType": "Restaurant/Cafe/Canteen",
  "address": "The Bard 20 Curtain Road London, Hackney, London",
  "postcode": "EC21 3NG",
  "localAuthority": "Hackney",
  "ratingValue": "5",
  "ratingDate": "2026-10-16",   // null when awaiting inspection
  "awaitingInspection": false,
  "latitude": null,
  "longitude": null,
  "fsaUrl": "https://ratings.food.gov.uk/business/1935132",
  "source": "Food Standards Agency, FHRS open data (Open Government Licence v3.0)"
}
```

Note: values such as the postcode ("EC21 3NG" above) are passed through unchanged from FSA data; the Actor does not validate or alter them.

Postcode-radius searches also include `distanceMiles`. Only business data published by the FSA is returned.

### Pricing

Pay per result: **$0.005 per business returned** (i.e. $5 per 1,000), plus Apify's standard platform terms. Set `maxResults` to cap spend.

### Data source and licence

Data: [Food Standards Agency – Food Hygiene Rating Scheme open data](https://ratings.food.gov.uk/open-data) via the [FHRS API](https://api.ratings.food.gov.uk/help). The FSA states that its content, including food hygiene ratings information, is available under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) ([FSA terms and conditions](https://www.food.gov.uk/terms-and-conditions)).

> © Crown copyright. Contains public sector information licensed under OGL v3.0. Source: Food Standards Agency.

This Actor is independent and not endorsed by the FSA. It does not use the FHRS sticker imagery or the FSA logo.

### Run locally

`npm install`, put input JSON in `storage/key_value_stores/default/INPUT.json`, then `node main.js` (or `apify run`). Results land in `storage/datasets/default/`.

# Actor input Schema

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

Local authority names (e.g. "Cambridge City") or numeric FSA IDs (e.g. 1). Names are matched case-insensitively against the FSA list; an exact match is preferred, otherwise a unique partial match. Leave empty if using postcode + radius.

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

UK postcode, e.g. "CB1 3NF". Used with 'Radius'. Geocoded via postcodes.io.

## `radiusMiles` (type: `integer`):

Search radius around the postcode.

## `daysBack` (type: `integer`):

Applies to rated businesses only (modes 'Recently rated' and 'Both'). Ignored for awaiting-inspection businesses, which have no rating date.

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

Restrict to these FSA business types. Empty = all types.

## `resultMode` (type: `string`):

'Awaiting first inspection' = registered with the council but not yet rated: the genuinely new businesses. These have no real rating date, so 'Rated in the last N days' does NOT apply to them; all current awaiting-inspection businesses in the area are returned. 'Recently rated' returns businesses whose latest rating date is within N days (may include re-inspected older businesses).

## `includeAwaitingInspection` (type: `boolean`):

Deprecated: use 'What to return' (resultMode). true = 'both', false = 'recentlyRated'. Ignored if resultMode is set.

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

Maximum businesses to return (you are charged per business returned).

## Actor input object example

```json
{
  "localAuthorities": [
    "Bristol"
  ],
  "radiusMiles": 5,
  "daysBack": 30,
  "resultMode": "awaitingInspection",
  "maxResults": 10
}
```

# Actor output Schema

## `businesses` (type: `string`):

Food businesses matching your search, shown in the 'Businesses' table view.

# 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": [
        "Bristol"
    ],
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("secondshift-data/uk-new-food-businesses-fsa").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": ["Bristol"],
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("secondshift-data/uk-new-food-businesses-fsa").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": [
    "Bristol"
  ],
  "maxResults": 10
}' |
apify call secondshift-data/uk-new-food-businesses-fsa --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,secondshift-data/uk-new-food-businesses-fsa"
        }
    }
}
```

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/rFibgRBAbfOr2phRq/builds/PCdyWvDI39NeToUpj/openapi.json
