Food Hygiene API Reference
Food Standards Agency hygiene ratings and food safety alerts across the UK.
Base URL: https://api.govdata.dev/v1
Search Food Alerts
GET /v1/food-hygiene/alerts returns allergy alerts, product recalls and food alerts for action from January 2018, newest first. q searches the alert title only.
/v1/food-hygiene/alerts
Waiting for request...
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
q |
string | No | — | Case-insensitive partial title only. |
type |
enum | No | — | allergy_alert, product_recall, or food_alert_for_action. |
allergen |
string | No | — | Exact FSA allergen SKOS notation, e.g. milk, gluten, nuts, wheat, or soya. |
status |
enum | No | — | published or withdrawn. Omit to include both. |
from |
date | No | — | Earliest notification date (YYYY-MM-DD). |
to |
date | No | — | Latest notification date (YYYY-MM-DD). |
page |
integer | No | 1 | One-based page. |
per_page |
integer | No | 25 | 1–100 results. |
curl -H "Authorization: Bearer YOUR_API_KEY" "https://api.govdata.dev/v1/food-hygiene/alerts?q=pulled%20pork&type=product_recall&from=2018-01-01"
uri = URI("https://api.govdata.dev/v1/food-hygiene/alerts?q=pulled%20pork&type=product_recall&from=2018-01-01")\nres = Net::HTTP.get_response(uri, {"Authorization" => "Bearer YOUR_API_KEY"})
response = requests.get("https://api.govdata.dev/v1/food-hygiene/alerts", headers={"Authorization": "Bearer YOUR_API_KEY"}, params={"q": "pulled pork", "type": "product_recall", "from": "2018-01-01"})
const response = await fetch("https://api.govdata.dev/v1/food-hygiene/alerts?q=pulled%20pork&type=product_recall&from=2018-01-01", { headers: { Authorization: "Bearer YOUR_API_KEY" } });
Response
{"data":[{"alert_id":"FSA-PRIN-01-2018","type":"product_recall","title":"James Hall recalls BBQ Pulled Pork because it may contain Salmonella","description":"James Hall is recalling SPAR BBQ Pulled Pork and Woodland BBQ Pulled Pork because the products may contain salmonella. Both products have been sold at SPAR stores.","notification_date":"2018-01-18","modified_at":"2018-01-29T16:25:08.000Z","reporting_business":"James Hall","other_business":"SPAR","alert_url":"https://www.food.gov.uk/news-alerts/alert/FSA-PRIN-01-2018","action_taken":"James Hall is recalling the above products. Point of sale notices will be displayed in all retail stores that are selling this/these products. These notices explain to customers why the products are being recalled and tell them what to do if they have bought the product. Please see the attached notice.","consumer_advice":"If you have bought any of the above products, do not eat it. Instead, return it to the store from where it was bought for a full refund.","risk_statement":"The products listed above might be contaminated with salmonella. Symptoms caused by salmonella usually include fever, diarrhoea and abdominal cramps.","allergens":[],"status":"Published","countries":[],"previous_alert_id":null,"related_alert_ids":[],"products":[{"name":"SPAR BBQ Pulled Pork 2 for £3.50","pack_size":"110g","product_code":null,"product_category":null,"batches":[{"batch_code":"413151","use_by":"Up to and including 25 January 2018","best_before":null,"best_before_date":null,"lot_number":null,"use_by_date":null,"batch_text":null}]},{"name":"Woodland BBQ Pulled Pork 2 for £3.50","pack_size":"110g","product_code":null,"product_category":null,"batches":[{"batch_code":"561092","use_by":"Up to and including 25 January 2018","best_before":null,"best_before_date":null,"lot_number":null,"use_by_date":null,"batch_text":null}]}]}],"meta":{"api_version":"v1","licence":"Open Government Licence v3.0","source":"Food Standards Agency","source_url":"https://data.food.gov.uk/food-alerts/id.json","coverage_from":"2018-01-09","newest_modified_at":"2026-08-10T15:49:00.442Z"},"pagination":{"total":1,"page":1,"per_page":1,"total_pages":1}}
Captured verbatim from a local authenticated request after importing the complete 1,350-alert FSA source snapshot on 21 August 2026; re-capture from production after the initial load. Invalid type/date/status filters return 422 invalid_parameter; unauthenticated calls return 401.
Get Food Alert
GET /v1/food-hygiene/alerts/:alert_id returns one alert with all affected products and batches.
/v1/food-hygiene/alerts/:alert_id
Waiting for request...
curl -H "Authorization: Bearer YOUR_API_KEY" "https://api.govdata.dev/v1/food-hygiene/alerts/FSA-PRIN-01-2018"
uri = URI("https://api.govdata.dev/v1/food-hygiene/alerts/FSA-PRIN-01-2018")\nres = Net::HTTP.get_response(uri, {"Authorization" => "Bearer YOUR_API_KEY"})
response = requests.get("https://api.govdata.dev/v1/food-hygiene/alerts/FSA-PRIN-01-2018", headers={"Authorization": "Bearer YOUR_API_KEY"})
const response = await fetch("https://api.govdata.dev/v1/food-hygiene/alerts/FSA-PRIN-01-2018", { headers: { Authorization: "Bearer YOUR_API_KEY" } });
Response
{"data":{"alert_id":"FSA-PRIN-01-2018","type":"product_recall","title":"James Hall recalls BBQ Pulled Pork because it may contain Salmonella","description":"James Hall is recalling SPAR BBQ Pulled Pork and Woodland BBQ Pulled Pork because the products may contain salmonella. Both products have been sold at SPAR stores.","notification_date":"2018-01-18","modified_at":"2018-01-29T16:25:08.000Z","reporting_business":"James Hall","other_business":"SPAR","alert_url":"https://www.food.gov.uk/news-alerts/alert/FSA-PRIN-01-2018","action_taken":"James Hall is recalling the above products. Point of sale notices will be displayed in all retail stores that are selling this/these products. These notices explain to customers why the products are being recalled and tell them what to do if they have bought the product. Please see the attached notice.","consumer_advice":"If you have bought any of the above products, do not eat it. Instead, return it to the store from where it was bought for a full refund.","risk_statement":"The products listed above might be contaminated with salmonella. Symptoms caused by salmonella usually include fever, diarrhoea and abdominal cramps.","allergens":[],"status":"Published","countries":[],"previous_alert_id":null,"related_alert_ids":[],"products":[{"name":"SPAR BBQ Pulled Pork 2 for £3.50","pack_size":"110g","product_code":null,"product_category":null,"batches":[{"batch_code":"413151","use_by":"Up to and including 25 January 2018","best_before":null,"best_before_date":null,"lot_number":null,"use_by_date":null,"batch_text":null}]},{"name":"Woodland BBQ Pulled Pork 2 for £3.50","pack_size":"110g","product_code":null,"product_category":null,"batches":[{"batch_code":"561092","use_by":"Up to and including 25 January 2018","best_before":null,"best_before_date":null,"lot_number":null,"use_by_date":null,"batch_text":null}]}]},"meta":{"api_version":"v1","licence":"Open Government Licence v3.0","source":"Food Standards Agency","source_url":"https://data.food.gov.uk/food-alerts/id.json","coverage_from":"2018-01-09","newest_modified_at":"2026-08-10T15:49:00.442Z"}}
Captured verbatim from the same complete local source import; re-capture from production after the initial load.
404 — no alert has that ID: {"error":{"code":"not_found","message":"Resource not found","documentation_url":"https://docs.govdata.dev/errors/not_found"}}
Search Establishments
Returns paginated FSA establishment records for consumer apps, procurement teams, and local publishers. Power a postcode-level food safety widget, find caterers awaiting inspection, or screen suppliers by hygiene rating and business type.
/v1/food-hygiene
Waiting for request...
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
q |
string | No | — | Case-insensitive partial match on business_name. |
postcode |
string | No | — | Full UK postcode; spacing and case are normalised. |
authority |
string | No | — | Case-insensitive partial local-authority name. |
rating |
string | No | — | Exact FHRS or FHIS rating_value, including textual values. |
business_type |
string | No | — | Exact FSA business-type label. |
new_rating_pending |
boolean | No | — | true or false. |
page |
integer | No | 1 | One-based result page. |
per_page |
integer | No | 25 | Results per page; minimum 1, maximum 100. |
curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.govdata.dev/v1/food-hygiene?q=Alex&postcode=ZE1%200HJ&authority=Shetland&rating=Improvement%20Required&business_type=Retailers%20-%20other&new_rating_pending=false&per_page=5"
uri = URI("https://api.govdata.dev/v1/food-hygiene") uri.query = URI.encode_www_form(q: "Alex", postcode: "ZE1 0HJ", authority: "Shetland", rating: "Improvement Required", business_type: "Retailers - other", new_rating_pending: false, per_page: 5) req = Net::HTTP::Get.new(uri, "Authorization" => "Bearer YOUR_API_KEY") res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
response = requests.get( "https://api.govdata.dev/v1/food-hygiene", headers={"Authorization": "Bearer YOUR_API_KEY"}, params={"q": "Alex", "postcode": "ZE1 0HJ", "authority": "Shetland", "rating": "Improvement Required", "business_type": "Retailers - other", "new_rating_pending": False, "per_page": 5} )
const url = new URL("https://api.govdata.dev/v1/food-hygiene"); url.search = new URLSearchParams({ q: "Alex", postcode: "ZE1 0HJ", authority: "Shetland", rating: "Improvement Required", business_type: "Retailers - other", new_rating_pending: "false", per_page: "5" }); const response = await fetch(url, { headers: { Authorization: "Bearer YOUR_API_KEY" } });
Response
{ "data": [{ "fhrsid": 1022651, "business_name": "Alex Morrisons", "business_type": "Retailers - other", "address": ["5&9 Browns Buildings", "Burgh Road", "Lerwick"], "postcode": "ZE1 0HJ", "rating_value": "Improvement Required", "rating_date": "2025-04-03", "scheme_type": "FHIS", "new_rating_pending": false, "scores": { "hygiene": null, "structural": null, "confidence_in_management": null }, "local_authority": { "code": "789", "name": "Shetland Islands" }, "geocode": { "latitude": 60.15646362, "longitude": -1.15153301 } }], "meta": { "api_version": "v1", "licence": "Open Government Licence v3.0", "source": "Food Standards Agency", "source_url": "https://ratings.food.gov.uk/open-data" }, "pagination": { "total": 1, "page": 1, "per_page": 5, "total_pages": 1 } }
rating_value is deliberately textual. Scotland's FHIS returns values such as Pass and Improvement Required; FHRS returns 0–5 and status labels. FHIS records normally have null component scores. FHRSID 1022651 is a real record in the bundled FSA development fixture.
Error responses
Search has no endpoint-specific 400, 404, or 422 branch. Unknown or incompatible filters return an empty data array with HTTP 200.
Get Establishment
Returns one complete FSA record by FHRSID for profile pages, audit trails, or enriching a supplier record after search. The stable FSA identifier makes this the preferred endpoint for refreshing a previously selected establishment.
/v1/food-hygiene/:fhrsid
Waiting for request...
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
fhrsid |
integer | Yes | — | Food Standards Agency establishment identifier. |
curl -H "Authorization: Bearer YOUR_API_KEY" "https://api.govdata.dev/v1/food-hygiene/1022651"
uri = URI("https://api.govdata.dev/v1/food-hygiene/1022651") req = Net::HTTP::Get.new(uri, "Authorization" => "Bearer YOUR_API_KEY") res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
response = requests.get("https://api.govdata.dev/v1/food-hygiene/1022651", headers={"Authorization": "Bearer YOUR_API_KEY"})
const response = await fetch("https://api.govdata.dev/v1/food-hygiene/1022651", { headers: { Authorization: "Bearer YOUR_API_KEY" } });
Response
{ "data": { "fhrsid": 1754849, "business_name": "£1 Plus Shop", "business_type": "Retailers - other", "address": [ "110 West Street", "Boston" ], "postcode": "PE21 8QN", "rating_value": "5", "rating_date": "2024-08-14", "scheme_type": "FHRS", "new_rating_pending": false, "scores": { "hygiene": 0, "structural": 0, "confidence_in_management": 0 }, "local_authority": { "code": "219", "name": "Boston" }, "geocode": { "latitude": 52.9760275, "longitude": -0.0289386 } }, "meta": { "api_version": "v1", "licence": "Open Government Licence v3.0", "source": "Food Standards Agency", "source_url": "https://ratings.food.gov.uk/open-data", "latest_rating_date": "2026-08-19" } }
The object is identical to a search result, but the response has no pagination member.
Error responses
404 — no establishment has that FHRSID. There are no endpoint-specific 400 or 422 branches.
{"error":{"code":"not_found","message":"Resource not found","documentation_url":"https://docs.govdata.dev/errors/not_found"}}
Data notes
Coverage and cadence: FSA open-data records cover England, Wales, Northern Ireland, and Scotland. GovData refreshes authority feeds daily, but a local authority controls when a rating is submitted or changed.
Food alerts: notices cover January 2018 onward and are polled hourly because the FSA publishes them as event-driven recalls and allergy/safety alerts. Alert API data is OGL 3 and includes publisher API version and modification timestamps.
Risks and allergens: risk_statement preserves the FSA problem statement. allergens use the publisher's SKOS allergen scheme; filter with its lowercase notation, such as milk, gluten, nuts, wheat, or soya.
Withdrawals: withdrawn notices remain listed for auditability. Pass status=published to exclude them, or status=withdrawn to retrieve only withdrawn notices.
Products and update links: products retain publisher codes/categories; batches retain codes, lot numbers, use-by/best-before dates and free-text batch descriptions. Country codes and labels are returned in countries. previous_alert_id and related_alert_ids resolve FSA update notices to their original/related alert notations.
Intentional omissions: SMS/Twitter copy, shortened URLs, and related-media document metadata are not stored because they duplicate the canonical title/alert URL or point to presentation attachments; the canonical notice URL remains available.
Licence and attribution: source Food Standards Agency open data, reused under the Open Government Licence v3.0. Attribute the Food Standards Agency and the relevant local authority when publishing ratings.
FHRS in England, Wales and Northern Ireland stores 0–5 plus non-numeric forms such as AwaitingInspection, AwaitingPublication, and concatenated variants. Scotland's FHIS stores spaced forms such as Pass and Eat Safe and Improvement Required. The rating filter accepts both stored concatenated FHRS forms and spaced forms. Do not parse rating_value as a number or compare FHIS and FHRS as one scale.
Addresses, coordinates, component scores, and rating dates may be null because the source omits them. new_rating_pending means the establishment reports a more recent rating is pending publication; it does not predict the result.