{
  "openapi": "3.0.1",
  "info": {
    "title": "Restaurant Health Inspections – Food Safety Scores",
    "description": "Restaurant health inspection results from official US health departments (NYC, Chicago, Austin, NY State, Seattle/King County, Montgomery County MD, Delaware, Marin, Boulder, Cincinnati): grades, scores, pass/fail, closures and violations, one row per inspection. $1 per 1,000 inspections.",
    "version": "0.1",
    "x-build-id": "Vh5Qx5cjUXhXk1MoQ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/gazidev~restaurant-inspections/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-gazidev-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/gazidev~restaurant-inspections/runs": {
      "post": {
        "operationId": "runs-sync-gazidev-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/gazidev~restaurant-inspections/run-sync": {
      "post": {
        "operationId": "run-sync-gazidev-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": {
          "jurisdictions": {
            "title": "Jurisdictions",
            "type": "array",
            "description": "Which official health-department datasets to search.",
            "items": {
              "type": "string",
              "enum": [
                "NYC",
                "CHI",
                "AUS",
                "NYS",
                "KING",
                "MOCO",
                "DE",
                "MARIN",
                "BOULDER",
                "CIN",
                "ALL"
              ],
              "enumTitles": [
                "New York City – DOHMH (grades A/B/C, scores, violations)",
                "Chicago – CDPH food inspections (pass/fail, violations)",
                "Austin, TX – inspection scores (0-100)",
                "New York State outside NYC – DOH food service inspections",
                "Seattle & King County, WA – inspections, points, red/blue violations",
                "Montgomery County, MD – food inspections",
                "Delaware (statewide) – inspection violations",
                "Marin County, CA – placards and violations",
                "Boulder County, CO – scores and violations",
                "Cincinnati, OH – food safety inspections",
                "All jurisdictions"
              ]
            },
            "default": [
              "NYC",
              "CHI"
            ]
          },
          "withinDays": {
            "title": "Inspected in the last N days",
            "minimum": 0,
            "type": "integer",
            "description": "Only inspections from the last N days (0 = any date). Fresh leads: 7-30.",
            "default": 30
          },
          "inspectedAfter": {
            "title": "Inspected on/after (date)",
            "type": "string",
            "description": "YYYY-MM-DD. Overrides *last N days*."
          },
          "inspectedBefore": {
            "title": "Inspected on/before (date)",
            "type": "string",
            "description": "YYYY-MM-DD. Optional upper bound."
          },
          "results": {
            "title": "Result",
            "type": "array",
            "description": "Normalized result category (see README for how each city maps). Empty = all. Delaware publishes no result and is skipped when this is set.",
            "items": {
              "type": "string",
              "enum": [
                "pass",
                "conditional",
                "fail",
                "closed"
              ],
              "enumTitles": [
                "Pass",
                "Conditional / pass with conditions / B-grade range",
                "Fail / unsatisfactory / reinspection required",
                "Closed by health department / red placard"
              ]
            }
          },
          "onlyWithCriticalViolations": {
            "title": "Only inspections with critical violations",
            "type": "boolean",
            "description": "Critical / priority / red / major violations (NYC, Chicago, NY State, King County, Montgomery County, Marin, Boulder). Datasets without a critical flag are skipped.",
            "default": false
          },
          "minViolations": {
            "title": "Minimum number of violations",
            "minimum": 0,
            "type": "integer",
            "description": "E.g. 3 = only inspections with 3+ violations cited."
          },
          "minScore": {
            "title": "Min score",
            "type": "integer",
            "description": "Only jurisdictions with a numeric score (NYC, Austin, King County, Boulder). Meaning differs: NYC/King/Boulder points (lower = better), Austin 0-100 (higher = better)."
          },
          "maxScore": {
            "title": "Max score",
            "type": "integer",
            "description": "See *Min score*. E.g. Austin maxScore 69 = failed inspections; NYC minScore 28 = C-grade range."
          },
          "nameContains": {
            "title": "Establishment name contains",
            "type": "string",
            "description": "E.g. `pizza`, `starbucks`, `taco`."
          },
          "zipCodes": {
            "title": "ZIP codes or prefixes",
            "type": "array",
            "description": "E.g. `10001` or `100` (prefixes not supported for Chicago and Cincinnati - use full ZIPs).",
            "items": {
              "type": "string"
            }
          },
          "cities": {
            "title": "Cities / boroughs",
            "type": "array",
            "description": "Exact city names, e.g. `Brooklyn`, `Seattle`, `Bellevue`, `Rochester`, `Pflugerville`.",
            "items": {
              "type": "string"
            }
          },
          "includeViolations": {
            "title": "Include violation details",
            "type": "boolean",
            "description": "Turn off for a slimmer table (counts are still included).",
            "default": true
          },
          "onlyNew": {
            "title": "Only new inspections (monitoring)",
            "type": "boolean",
            "description": "Skip inspections returned by earlier runs with the same *State key*. Schedule daily/weekly for a fresh-inspections feed.",
            "default": false
          },
          "stateKey": {
            "title": "State key",
            "type": "string",
            "description": "Separate 'already seen' lists for different searches.",
            "default": "default"
          },
          "maxResultsPerJurisdiction": {
            "title": "Max inspections per jurisdiction",
            "minimum": 0,
            "type": "integer",
            "description": "0 = no per-jurisdiction limit."
          },
          "maxResults": {
            "title": "Max inspections",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many inspections in total (0 = all matching). You pay per inspection saved.",
            "default": 1000
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Optional free token for higher rate limits on very large exports."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}