{
  "openapi": "3.0.1",
  "info": {
    "title": "Restaurant Inspections | Food Hygiene Ratings US & UK",
    "description": "Extract restaurant inspections and UK food hygiene ratings from official open data at $2.00 per 1,000: New York City, Chicago, Austin, Seattle & King County and any UK local authority. Business, address, date, score, grade, violations; incremental mode.",
    "version": "0.1",
    "x-build-id": "WIRVpAzo6bbTvFFwb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/aurelix~restaurant-inspections/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-aurelix-restaurant-inspections",
        "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/aurelix~restaurant-inspections/runs": {
      "post": {
        "operationId": "runs-sync-aurelix-restaurant-inspections",
        "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/aurelix~restaurant-inspections/run-sync": {
      "post": {
        "operationId": "run-sync-aurelix-restaurant-inspections",
        "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": {
          "cities": {
            "title": "US cities",
            "type": "array",
            "description": "Which US inspection datasets to read: 'nyc' (New York City restaurant inspections with grade, score and every violation), 'chicago' (Chicago food inspections with pass/fail result, risk level and violation titles), 'austin' (Austin food establishment inspection scores), 'king-county' (Seattle & King County food establishment inspections with points, result, grade and violations). Leave empty to read only UK authorities.",
            "items": {
              "type": "string",
              "enum": [
                "nyc",
                "chicago",
                "austin",
                "king-county"
              ],
              "enumTitles": [
                "New York City",
                "Chicago",
                "Austin",
                "Seattle & King County"
              ]
            },
            "default": [
              "nyc",
              "chicago",
              "austin",
              "king-county"
            ]
          },
          "ukAuthorities": {
            "title": "UK local authorities (Food Hygiene Rating Scheme)",
            "maxItems": 50,
            "type": "array",
            "description": "UK local authority names as the Food Standards Agency lists them, e.g. ['Westminster', 'Manchester', 'Glasgow City']. Each returns establishments whose food hygiene rating date falls in the window, with the rating (0-5, or Pass / Improvement Required in Scotland) and the three inspection scores. Empty = none.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "daysBack": {
            "title": "Inspected in the last N days",
            "minimum": 0,
            "maximum": 365,
            "type": "integer",
            "description": "Keep inspections dated on or after today minus this many days (UTC). For the UK this is the rating date. Example: 7 for a weekly feed.",
            "default": 30
          },
          "maxResultsPerSource": {
            "title": "Max results per city or authority",
            "minimum": 0,
            "maximum": 50000,
            "type": "integer",
            "description": "Upper limit of inspections per US city or UK authority after filters, newest first. 0 = no limit.",
            "default": 1000
          },
          "keywords": {
            "title": "Business name, type or address contains",
            "maxItems": 100,
            "type": "array",
            "description": "Keep inspections whose business name, cuisine or business type, or address contains one of these (case-insensitive), e.g. ['pizza', 'starbucks', 'school']. Empty = all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "results": {
            "title": "Result, grade or rating contains",
            "maxItems": 50,
            "type": "array",
            "description": "Keep inspections whose result, grade or UK rating contains one of these (case-insensitive), e.g. ['fail', 'closed'] for Chicago failures and New York City closures, ['unsatisfactory'] for King County, ['0', '1'] for the lowest UK ratings. Empty = all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "postcodes": {
            "title": "ZIP codes or postcodes (prefix)",
            "maxItems": 200,
            "type": "array",
            "description": "Keep inspections whose ZIP code or postcode starts with one of these, e.g. ['10001', '606'] or ['W1', 'SW1A']. Empty = all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "withViolationsOnly": {
            "title": "Only inspections with violations",
            "type": "boolean",
            "description": "Keep only inspections that list at least one violation (New York City, Chicago, King County; Austin and UK records carry no violation list and drop out).",
            "default": false
          },
          "incremental": {
            "title": "Incremental: skip inspections already returned",
            "type": "boolean",
            "description": "Return only inspections not returned by a previous run with the same sources and filters (or the same state name below). Use with a daily or weekly schedule.",
            "default": false
          },
          "stateKey": {
            "title": "Incremental memory name (optional)",
            "type": "string",
            "description": "Name for the incremental memory. Leave empty to derive it from the sources and filters; set it to keep separate feeds apart, e.g. 'nyc-closures'."
          },
          "slackWebhookUrl": {
            "title": "Slack webhook URL (optional)",
            "type": "string",
            "description": "After each run, post a short digest to Slack: how many inspections were saved (new ones only when incremental mode is on) and the top 10 with links, e.g. https://hooks.slack.com/services/T000/B000/XXXX. Nothing is posted when the run saved nothing. Leave empty to skip."
          },
          "webhookUrl": {
            "title": "Webhook URL (optional)",
            "type": "string",
            "description": "After each run, POST the same digest as JSON (actor, newOnly, count, items = top 10 results, runUrl, text) to any URL, e.g. a Zapier, Make or n8n webhook. Nothing is sent when the run saved nothing. Leave empty to skip."
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}