{
  "openapi": "3.0.1",
  "info": {
    "title": "UK Food Hygiene Ratings Scraper",
    "description": "Search official Food Standards Agency FHRS/FHIS data and return one structured record per UK food establishment. Filter by name, postcode/address, radius, rating, scheme, local authority, business type, or exact FHRS ID across England, Wales, Northern Ireland, and Scotland.",
    "version": "1.0",
    "x-build-id": "1saHs36CRgtdy2x3B"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/muhammadafzal~uk-food-hygiene-ratings-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-muhammadafzal-uk-food-hygiene-ratings-scraper",
        "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/muhammadafzal~uk-food-hygiene-ratings-scraper/runs": {
      "post": {
        "operationId": "runs-sync-muhammadafzal-uk-food-hygiene-ratings-scraper",
        "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/muhammadafzal~uk-food-hygiene-ratings-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-muhammadafzal-uk-food-hygiene-ratings-scraper",
        "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": {
          "searchQuery": {
            "title": "Business name search",
            "type": "string",
            "description": "Use this when searching by a food business name or keyword. Free text is matched against business names; example: 'The Golden Lion' or 'pizza'. Defaults to 'restaurant'. Do not use this for a postcode-only search; use address instead.",
            "default": "restaurant"
          },
          "address": {
            "title": "Address or postcode",
            "type": "string",
            "description": "Use this when searching a street, town, city, or UK postcode. Example: 'B1 1AA' or 'Cambridge'. Searches business addresses and postcodes. Leave blank when using exact FHRS IDs.",
            "default": ""
          },
          "latitude": {
            "title": "Latitude",
            "type": "number",
            "description": "Use this with longitude to search around a geographic point. Decimal degrees, for example 51.5074. Both latitude and longitude are required for a radius search; do not provide only one coordinate.",
            "default": 0
          },
          "longitude": {
            "title": "Longitude",
            "type": "number",
            "description": "Use this with latitude to search around a geographic point. Decimal degrees, for example -0.1278. Both coordinates are required for a radius search; do not provide only one coordinate.",
            "default": 0
          },
          "radiusMiles": {
            "title": "Radius in miles",
            "minimum": 0.1,
            "maximum": 100,
            "type": "number",
            "description": "Use this to limit a coordinate search to a radius in miles. Accepts 0.1 to 100 and defaults to 5 when coordinates are supplied. Ignored unless latitude and longitude are supplied.",
            "default": 5
          },
          "establishmentIds": {
            "title": "Exact FHRS IDs",
            "maxItems": 100,
            "type": "array",
            "description": "Use this for exact record lookups when you already know the Food Hygiene Rating Scheme IDs. Enter integers such as [80928, 1865746]. When supplied, search filters are ignored and records are fetched directly.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "schemeType": {
            "title": "Scheme type",
            "enum": [
              "FHRS",
              "FHIS"
            ],
            "type": "string",
            "description": "Use this to select the official scheme. 'FHRS' is the hygiene rating scheme used in England, Wales, and Northern Ireland; 'FHIS' is the food hygiene information scheme used in Scotland. Defaults to FHRS.",
            "default": "FHRS"
          },
          "rating": {
            "title": "Hygiene rating or status",
            "type": "string",
            "description": "Use this to filter by an FHRS rating such as '5', '4', or '0', or an FHIS status such as 'Pass' or 'ImprovementRequired'. Example: '5'. Leave blank to include all ratings.",
            "default": ""
          },
          "ratingOperator": {
            "title": "Rating operator",
            "enum": [
              "Equal",
              "GreaterThanOrEqual",
              "LessThanOrEqual"
            ],
            "type": "string",
            "description": "Use this with numeric FHRS ratings to choose the comparison: Equal, GreaterThanOrEqual, or LessThanOrEqual. Defaults to Equal. It has no effect on non-numeric FHIS statuses.",
            "default": "Equal"
          },
          "businessTypeId": {
            "title": "Business type ID",
            "minimum": 0,
            "type": "integer",
            "description": "Use this to filter by the FSA business type identifier, for example restaurants, takeaways, schools, or supermarkets. Supply an integer from the official BusinessTypes endpoint. Leave 0 for all business types.",
            "default": 0
          },
          "localAuthorityId": {
            "title": "Local authority ID",
            "minimum": 0,
            "type": "integer",
            "description": "Use this to restrict results to one UK local authority. Supply an integer from the official Authorities endpoint. Leave 0 to search all authorities.",
            "default": 0
          },
          "countryId": {
            "title": "Country ID",
            "minimum": 0,
            "type": "integer",
            "description": "Use this to restrict results to a country record from the official Countries endpoint. Supply an integer ID; leave 0 for all UK countries.",
            "default": 0
          },
          "sortBy": {
            "title": "Sort results",
            "enum": [
              "Relevance",
              "rating",
              "desc_rating",
              "alpha",
              "desc_alpha",
              "distance"
            ],
            "type": "string",
            "description": "Use this to choose result order. Supported values are Relevance, rating, desc_rating, alpha, desc_alpha, and distance. Defaults to Relevance; distance is most useful with coordinates.",
            "default": "Relevance"
          },
          "maxResults": {
            "title": "Maximum results",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Use this to cap the number of establishments returned and the maximum number of per-record charges. Accepts 1 to 1000 and defaults to 25. Tighten this for an agent lookup; raise it for bounded local research.",
            "default": 25
          },
          "pageSize": {
            "title": "API page size",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Use this to control each FSA API page. Accepts 1 to 200 and defaults to 100. The API recommends paging at 200 or below to reduce throttling; this is not the final result cap.",
            "default": 100
          },
          "requestDelayMs": {
            "title": "Delay between API requests (ms)",
            "minimum": 100,
            "maximum": 10000,
            "type": "integer",
            "description": "Use this to add flow control between FSA API requests. Accepts 100 to 10000 milliseconds and defaults to 500. Increase it if the FSA API returns 403 or 429 throttling responses.",
            "default": 500
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}