{
  "openapi": "3.0.1",
  "info": {
    "title": "Restaurant Inspections & New Openings: 16 US Cities & Counties",
    "description": "Restaurant health inspection grades, scores and pass/fail results for NYC, Chicago, San Francisco, Austin, Cincinnati, Boston and Marin County, plus alerts when a new restaurant opens or fails an inspection. Official city data, one deduplicated record per restaurant.",
    "version": "0.1",
    "x-build-id": "uBOboOuSSNmkhvQr7"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/registryfeeds~us-food-inspection-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-registryfeeds-us-food-inspection-monitor",
        "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/registryfeeds~us-food-inspection-monitor/runs": {
      "post": {
        "operationId": "runs-sync-registryfeeds-us-food-inspection-monitor",
        "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/registryfeeds~us-food-inspection-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-registryfeeds-us-food-inspection-monitor",
        "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": "Cities",
            "type": "array",
            "description": "Cities to include. Currently live: NYC, CHICAGO, SF, AUSTIN, CINCINNATI, BOSTON, MARIN, MONTGOMERY (Montgomery County, Maryland), KINGCOUNTY (King County WA, including Seattle), MINNEAPOLIS, LOUISVILLE, WAKE (Wake County NC, including Raleigh), SACRAMENTO (Sacramento County), NYSTATE (New York State outside NYC), SANTACLARA (Santa Clara County CA, including San Jose), BOULDER (Boulder County CO). More are added over time.",
            "default": [
              "NYC",
              "CHICAGO",
              "SF",
              "AUSTIN",
              "CINCINNATI",
              "BOSTON",
              "MARIN",
              "MONTGOMERY",
              "KINGCOUNTY",
              "MINNEAPOLIS",
              "LOUISVILLE",
              "WAKE",
              "SACRAMENTO",
              "NYSTATE",
              "SANTACLARA",
              "BOULDER"
            ],
            "items": {
              "type": "string"
            }
          },
          "onlyOutputChanges": {
            "title": "Monitor mode: output only changes",
            "type": "boolean",
            "description": "Push only new/changed/removed establishments instead of the full list. The first run builds the baseline; each later run reports only what changed (new openings, grade/result changes).",
            "default": false
          },
          "maxRecordsPerSource": {
            "title": "Max inspection rows per city",
            "minimum": 0,
            "type": "integer",
            "description": "Cap on inspection rows read per city, newest-first (rows are reduced to one record per establishment, so establishment count is lower). This captures new openings and recent result changes. Set 0 for a full pull, which also enables closure/removal detection (a capped run cannot tell a real closure from an establishment that simply dropped out of the newest-N window).",
            "default": 2000
          },
          "maxInspectionAgeDays": {
            "title": "Only establishments inspected in the last N days",
            "minimum": 0,
            "type": "integer",
            "description": "Leaves out establishments with no inspection in this many days, since most of them have closed. The default of 1095 (3 years) keeps every active restaurant: cities inspect each one at least yearly. NYC permits that have not had a first inspection yet are always kept, marked result \"not_yet_inspected\". Set 0 for the full history.",
            "default": 1095
          },
          "suppressInitialChanges": {
            "title": "Suppress changes on first run",
            "type": "boolean",
            "description": "On the first run (no baseline yet), do not emit a 'new' event for every establishment. Leave on to avoid a flood.",
            "default": true
          },
          "geocodeMissingCoordinates": {
            "title": "Geocode missing coordinates",
            "type": "boolean",
            "description": "Fill lat/lng for any city that does not publish coordinates, via free OpenStreetMap Nominatim, cached across runs. NYC and Chicago already publish coordinates.",
            "default": false
          },
          "maxGeocodePerRun": {
            "title": "Max new geocodes per run",
            "minimum": 0,
            "type": "integer",
            "description": "Cap on new (uncached) geocode lookups per run, to respect Nominatim's rate limit.",
            "default": 500
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "HTTPS endpoint to receive change events as a POST after each run (fires only when there are changes and a baseline exists)."
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Optional Socrata app token to raise open-data rate limits on large pulls. Not required for normal runs."
          },
          "testMode": {
            "title": "Test mode",
            "type": "boolean",
            "description": "Cap every city at 5 inspection rows and skip the snapshot. Free smoke test.",
            "default": false
          },
          "sourceTimeoutSecs": {
            "title": "Time limit per city (seconds)",
            "minimum": 30,
            "type": "integer",
            "description": "If a city portal is slow or down, stop waiting after this long and continue with the other cities. That city is reported as failed in RUN_HEALTH.",
            "default": 300
          },
          "selfTest": {
            "title": "Self-test (maintenance)",
            "type": "boolean",
            "description": "Used by the daily health check. Checks every city with a small pull and fails the run if any city is broken or stale.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}