{
  "openapi": "3.0.1",
  "info": {
    "title": "Boston Restaurant Inspections Scraper",
    "description": "Scrape City of Boston food establishment health inspection records from the public data.boston.gov CKAN datastore. Search by business name, address, neighborhood, ZIP, type, result, or date range. Lookup by license number, property ID, or violation code.",
    "version": "1.0",
    "x-build-id": "GeReeJL6TbJMDUaTX"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawlerbros~boston-restaurant-inspections-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawlerbros-boston-restaurant-inspections-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/crawlerbros~boston-restaurant-inspections-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawlerbros-boston-restaurant-inspections-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/crawlerbros~boston-restaurant-inspections-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawlerbros-boston-restaurant-inspections-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "byLicense",
              "byPropertyId",
              "byViolationCode"
            ],
            "type": "string",
            "description": "What to fetch.",
            "default": "search"
          },
          "businessName": {
            "title": "Business name (mode=search)",
            "type": "string",
            "description": "Partial, case-insensitive match against the establishment's business name or DBA name.",
            "default": ""
          },
          "ownerName": {
            "title": "Owner name (mode=search)",
            "type": "string",
            "description": "Partial, case-insensitive match against the establishment's legal owner / license holder name (also checks the first/last name columns on file).",
            "default": ""
          },
          "address": {
            "title": "Address (mode=search)",
            "type": "string",
            "description": "Partial, case-insensitive match against the street address.",
            "default": ""
          },
          "city": {
            "title": "Neighborhood / city (mode=search)",
            "enum": [
              "",
              "ALLSTON",
              "BACK BAY",
              "BOSTON",
              "BOSTON/CHINATOWN",
              "BOSTON/WEST END",
              "BRIGHTON",
              "CHARLESTOWN",
              "CHESTNUT HILL",
              "DORCHESTER",
              "DORCHESTER CENTER",
              "DOWNTOWN/FINANCIAL DISTRICT",
              "EAST BOSTON",
              "FENWAY",
              "FINANCIAL DISTRICT",
              "HYDE PARK",
              "JAMAICA PLAIN",
              "MATTAPAN",
              "MISSION HILL",
              "ROSLINDALE",
              "ROXBURY",
              "ROXBURY/BOSTON",
              "ROXBURY CROSSIN",
              "SOUTH BOSTON",
              "SOUTH END",
              "WEST ROXBURY"
            ],
            "type": "string",
            "description": "Boston neighborhood (nearly all rows list the city as `BOSTON`; the remainder use the specific neighborhood name).",
            "default": ""
          },
          "zipCode": {
            "title": "ZIP code (mode=search)",
            "type": "string",
            "description": "Exact 5-digit ZIP code.",
            "default": ""
          },
          "establishmentType": {
            "title": "Establishment type (mode=search)",
            "enum": [
              "",
              "Eating & Drinking",
              "Eating & Drinking w/ Take Out",
              "Mobile Food Walk On",
              "Retail Food"
            ],
            "type": "string",
            "description": "The license category of the food establishment.",
            "default": ""
          },
          "licenseStatus": {
            "title": "License status (mode=search)",
            "enum": [
              "",
              "Active",
              "Inactive",
              "Deleted"
            ],
            "type": "string",
            "description": "Current status of the establishment's food service license.",
            "default": ""
          },
          "result": {
            "title": "Inspection result (mode=search)",
            "enum": [
              "",
              "Pass",
              "Fail",
              "PassViol",
              "Failed",
              "Closed",
              "NoViol",
              "HE_Pass",
              "HE_Fail",
              "HE_FailExt",
              "HE_FAILNOR",
              "HE_Filed",
              "HE_Hearing",
              "HE_Hold",
              "HE_Misc",
              "HE_NotReq",
              "HE_OutBus",
              "HE_TSOP",
              "HE_VolClos",
              "HE_Closure",
              "DATAERR"
            ],
            "type": "string",
            "description": "Outcome/status code of the inspection or violation record. `HE_*` codes are Boston Health Division inspection-workflow statuses.",
            "default": ""
          },
          "violationStatus": {
            "title": "Violation status (mode=search)",
            "enum": [
              "",
              "Pass",
              "Fail"
            ],
            "type": "string",
            "description": "Whether the specific violation line item passed or failed re-inspection.",
            "default": ""
          },
          "violationLevel": {
            "title": "Violation severity (mode=search)",
            "enum": [
              "",
              "Minor",
              "Significant",
              "Critical"
            ],
            "type": "string",
            "description": "Severity of the cited violation: Minor (*), Significant (**), or Critical (***).",
            "default": ""
          },
          "dateFrom": {
            "title": "Inspection date from (mode=search)",
            "type": "string",
            "description": "Only include inspections on/after this date (YYYY-MM-DD), matched against the result date.",
            "default": ""
          },
          "dateTo": {
            "title": "Inspection date to (mode=search)",
            "type": "string",
            "description": "Only include inspections on/before this date (YYYY-MM-DD), matched against the result date.",
            "default": ""
          },
          "licenseExpiresFrom": {
            "title": "License expires from (mode=search)",
            "type": "string",
            "description": "Only include establishments whose food license expiration date is on/after this date (YYYY-MM-DD). Useful for compliance/renewal monitoring (e.g. \"expiring this quarter\").",
            "default": ""
          },
          "licenseExpiresTo": {
            "title": "License expires to (mode=search)",
            "type": "string",
            "description": "Only include establishments whose food license expiration date is on/before this date (YYYY-MM-DD).",
            "default": ""
          },
          "keyword": {
            "title": "Keyword (violation description / comments)",
            "type": "string",
            "description": "Full-text, case-insensitive search across the violation description and inspector comments (e.g. `rodent`, `hand washing`, `hot holding`).",
            "default": ""
          },
          "latitude": {
            "title": "Near latitude (mode=search)",
            "minimum": -90,
            "maximum": 90,
            "type": "number",
            "description": "Center latitude for a \"near me\" radius search. Combine with `longitude` and `radiusKm`."
          },
          "longitude": {
            "title": "Near longitude (mode=search)",
            "minimum": -180,
            "maximum": 180,
            "type": "number",
            "description": "Center longitude for a \"near me\" radius search. Combine with `latitude` and `radiusKm`."
          },
          "radiusKm": {
            "title": "Radius (km)",
            "minimum": 0.1,
            "maximum": 50,
            "type": "number",
            "description": "Search radius in kilometers around `latitude`/`longitude`. Only applied when both are set. Default 1 km.",
            "default": 1
          },
          "licenseNumbers": {
            "title": "License numbers (mode=byLicense)",
            "type": "array",
            "description": "City of Boston food establishment license numbers to fetch the full inspection/violation history for.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "propertyIds": {
            "title": "Property IDs (mode=byPropertyId)",
            "type": "array",
            "description": "Boston Assessing Department property IDs to fetch the full inspection history of every establishment ever registered at that building.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "violationCodes": {
            "title": "Violation codes (mode=byViolationCode)",
            "type": "array",
            "description": "Exact Massachusetts food code violation code(s) to look up citywide, e.g. `22-4-601/602.11`.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "resultDate",
              "businessName",
              "violationLevel"
            ],
            "type": "string",
            "description": "Field to sort results by (all modes). `Violation severity` sorts Critical-first when descending.",
            "default": "resultDate"
          },
          "sortAscending": {
            "title": "Sort ascending",
            "type": "boolean",
            "description": "Sort oldest/lowest-first instead of newest/highest-first (applies to all modes).",
            "default": false
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Hard cap on emitted records.",
            "default": 50
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}