{
  "openapi": "3.0.1",
  "info": {
    "title": "UK Food Hygiene Ratings Scraper (FSA)",
    "description": "Scrape UK food hygiene ratings from the Food Standards Agency register: business name, type, address, postcode, rating, inspection scores and coordinates.",
    "version": "0.1",
    "x-build-id": "erLOMf8KfOBOFfsdj"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/pohjastudio~uk-food-hygiene-ratings-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-pohjastudio-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/pohjastudio~uk-food-hygiene-ratings-scraper/runs": {
      "post": {
        "operationId": "runs-sync-pohjastudio-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/pohjastudio~uk-food-hygiene-ratings-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-pohjastudio-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": {
          "localAuthorities": {
            "title": "Local authorities",
            "type": "array",
            "description": "Council names to scan, matched as substrings of the FSA's own names (e.g. \"Birmingham\", \"City of London\", \"Aberdeen\"). Leave empty to scan all 363 authorities across the UK.",
            "items": {
              "type": "string"
            }
          },
          "minRating": {
            "title": "Minimum rating (0-5)",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "FHRS scale only. Scottish premises use Pass / Improvement Required and are excluded by any numeric rating filter."
          },
          "maxRating": {
            "title": "Maximum rating (0-5)",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Use with minRating to target a band. Ratings of 0-2 are the premises that need remedial work."
          },
          "ratingValues": {
            "title": "Exact rating values",
            "type": "array",
            "description": "Match the rating label exactly. Works for both schemes: \"5\", \"4\" … or \"Pass\", \"Improvement Required\", \"Exempt\".",
            "items": {
              "type": "string"
            }
          },
          "businessTypeIds": {
            "title": "Business type IDs",
            "type": "array",
            "description": "FSA business type IDs. Common ones: 1 = Restaurant/Cafe/Canteen, 5 = Caring premises, 7843 = Takeaway, 7838 = Retailer (other), 7842 = Pub/bar/nightclub, 4613 = School/college.",
            "items": {
              "type": "string"
            }
          },
          "postcodePrefix": {
            "title": "Postcode prefix",
            "type": "string",
            "description": "Keep only premises whose postcode starts with this. Spaces and case are ignored, so \"ec3\" and \"EC3\" both work."
          },
          "ratedAfter": {
            "title": "Rated on or after",
            "type": "string",
            "description": "Only premises inspected on or after this date. Useful for monitoring newly published ratings."
          },
          "ratedBefore": {
            "title": "Rated before",
            "type": "string",
            "description": "Only premises inspected before this date. Useful for finding stale inspections."
          },
          "maxHygieneScore": {
            "title": "Maximum hygiene score",
            "type": "integer",
            "description": "In this scheme a higher score means worse performance, so this keeps the better performers. Premises with no published score are excluded."
          },
          "onlyWithPhone": {
            "title": "Only premises with a phone number",
            "type": "boolean",
            "description": "Most records have no phone number, so this trims the list sharply.",
            "default": false
          },
          "excludeScotland": {
            "title": "Exclude Scotland (FHIS)",
            "type": "boolean",
            "description": "Drop Scottish records, which use Pass / Improvement Required instead of a 0-5 rating.",
            "default": false
          },
          "maxItems": {
            "title": "Maximum establishments",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many premises. You are charged per premises delivered.",
            "default": 5000
          },
          "pageSize": {
            "title": "Page size",
            "minimum": 100,
            "maximum": 5000,
            "type": "integer",
            "description": "Records fetched per request (100-5000). Larger pages mean fewer requests per authority.",
            "default": 1000
          },
          "includeRawFields": {
            "title": "Include raw source record",
            "type": "boolean",
            "description": "Attach the untouched FSA record under `raw`.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}