{
  "openapi": "3.0.1",
  "info": {
    "title": "UK Food Hygiene Ratings (FSA FHRS) Scraper",
    "description": "Scrape UK Food Hygiene Ratings from the FSA FHRS API (ratings.food.gov.uk) by postcode, name, council or type. Ideal for restaurant lead generation, compliance checks and market research.",
    "version": "0.1",
    "x-build-id": "tLonemeAAVWDykIXs"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/lafabbricallc~uk-food-hygiene-ratings/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-lafabbricallc-uk-food-hygiene-ratings",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/lafabbricallc~uk-food-hygiene-ratings/runs": {
      "post": {
        "operationId": "runs-sync-lafabbricallc-uk-food-hygiene-ratings",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/lafabbricallc~uk-food-hygiene-ratings/run-sync": {
      "post": {
        "operationId": "run-sync-lafabbricallc-uk-food-hygiene-ratings",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "localAuthorities",
              "businessTypes"
            ],
            "type": "string",
            "description": "\"search\" returns establishments matching your filters. \"localAuthorities\" returns the list of councils with their localAuthorityId. \"businessTypes\" returns the business type list with businessTypeId. Use the two lookup modes to find ids for the search filters.",
            "default": "search"
          },
          "name": {
            "title": "Business name",
            "type": "string",
            "description": "Words to look for in the business name, e.g. \"Greggs\" or \"Pizza Express\"."
          },
          "address": {
            "title": "Address terms",
            "type": "string",
            "description": "Words to look for in the address, e.g. a street or town name (\"High Street Oxford\")."
          },
          "postcode": {
            "title": "Postcode",
            "type": "string",
            "description": "Full or partial UK postcode, e.g. \"SW1A\" or \"M1 1AE\". Partial postcodes match every address that starts with them."
          },
          "localAuthorityId": {
            "title": "Local authority id",
            "minimum": 1,
            "type": "integer",
            "description": "Restrict to one council. This is the API id (Westminster = 120, Manchester = 180, Cardiff = 339), not the code printed on records. Run mode \"localAuthorities\" to get the full list.",
            "default": 120
          },
          "businessTypeId": {
            "title": "Business type id",
            "minimum": 1,
            "type": "integer",
            "description": "Restrict to one business type (e.g. 1 = Restaurant/Cafe/Canteen, 7843 = Pub/bar/nightclub, 7846 = Takeaway/sandwich shop). Run mode \"businessTypes\" to get the full list."
          },
          "ratingKey": {
            "title": "Rating",
            "enum": [
              "",
              "5",
              "4",
              "3",
              "2",
              "1",
              "0",
              "Pass",
              "ImprovementRequired",
              "AwaitingPublication",
              "AwaitingInspection",
              "Exempt"
            ],
            "type": "string",
            "description": "Only establishments with exactly this rating. England, Wales and Northern Ireland (FHRS): \"0\" to \"5\". Scotland (FHIS): \"Pass\", \"ImprovementRequired\", \"AwaitingPublication\", \"AwaitingInspection\", \"Exempt\".",
            "default": "5"
          },
          "schemeTypeKey": {
            "title": "Scheme",
            "enum": [
              "",
              "FHRS",
              "FHIS"
            ],
            "type": "string",
            "description": "Optional. \"FHRS\" = England, Wales and Northern Ireland (0-5 ratings). \"FHIS\" = Scotland (Pass / Improvement Required).",
            "default": ""
          },
          "sortOptionKey": {
            "title": "Sort order",
            "enum": [
              "Relevance",
              "rating",
              "desc_rating",
              "alpha",
              "desc_alpha"
            ],
            "type": "string",
            "description": "How the API orders results before paging.",
            "default": "Relevance"
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Stop after this many rows have been saved. You are charged only for rows actually saved.",
            "default": 50
          },
          "pageSize": {
            "title": "Page size",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Rows requested per API call (search mode). Larger pages mean fewer calls; the API caps the value itself. Lower it only if the API returns errors.",
            "default": 200
          },
          "requestDelayMs": {
            "title": "Delay between pages (ms)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Pause between successive API calls, to stay polite to the public FSA service.",
            "default": 250
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}