{
  "openapi": "3.0.1",
  "info": {
    "title": "Chicago Food Inspections Scraper",
    "description": "Scrape City of Chicago food establishment inspection records from the public Socrata Open Data API. Search by name, address, ZIP, ward, community area, risk, result, facility/inspection type, date range, or near-me radius. Lookup by license number or inspection ID.",
    "version": "1.0",
    "x-build-id": "H2EVgNfxdcitGR25Z"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawlerbros~chicago-food-inspections-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawlerbros-chicago-food-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~chicago-food-inspections-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawlerbros-chicago-food-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~chicago-food-inspections-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawlerbros-chicago-food-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",
              "byInspectionIds"
            ],
            "type": "string",
            "description": "What to fetch.",
            "default": "search"
          },
          "facilityName": {
            "title": "Facility name",
            "type": "string",
            "description": "Partial, case-insensitive match against the establishment's DBA or AKA name (mode=search).",
            "default": ""
          },
          "address": {
            "title": "Address",
            "type": "string",
            "description": "Partial, case-insensitive match against the street address (mode=search)."
          },
          "city": {
            "title": "City",
            "type": "string",
            "description": "Exact, case-insensitive city match. Nearly all rows are `CHICAGO`; a small number cover neighboring suburbs (mode=search)."
          },
          "zipCode": {
            "title": "ZIP code",
            "type": "string",
            "description": "Exact 5-digit ZIP code (mode=search)."
          },
          "riskLevel": {
            "title": "Risk category",
            "enum": [
              "",
              "Risk 1 (High)",
              "Risk 2 (Medium)",
              "Risk 3 (Low)"
            ],
            "type": "string",
            "description": "Chicago's risk-based inspection frequency category.",
            "default": ""
          },
          "results": {
            "title": "Inspection result",
            "enum": [
              "",
              "Pass",
              "Pass w/ Conditions",
              "Fail",
              "Out of Business",
              "No Entry",
              "Not Ready",
              "Business Not Located"
            ],
            "type": "string",
            "description": "Outcome of the inspection.",
            "default": ""
          },
          "facilityType": {
            "title": "Facility type",
            "type": "string",
            "description": "Partial, case-insensitive match against facility type. Common values: Restaurant, Grocery Store, School, Bakery, Children's Services Facility, Daycare (2 - 6 Years), Long Term Care, Catering, Liquor, Mobile Food Preparer, Hospital, Golden Diner, Wholesale, Shared Kitchen, Tavern, Special Event. Free text -- any substring the city has used is matched (110+ variants exist in the raw data).",
            "default": ""
          },
          "inspectionType": {
            "title": "Inspection type",
            "type": "string",
            "description": "Partial, case-insensitive match against inspection type. Common values: Canvass, License, Canvass Re-Inspection, Complaint, License Re-Inspection, Complaint Re-Inspection, Short Form Complaint, Non-Inspection, Suspected Food Poisoning, Consultation, Tag Removal. Free text -- any substring the city has used is matched.",
            "default": ""
          },
          "dateFrom": {
            "title": "Inspection date from",
            "type": "string",
            "description": "Only include inspections on/after this date (YYYY-MM-DD)."
          },
          "dateTo": {
            "title": "Inspection date to",
            "type": "string",
            "description": "Only include inspections on/before this date (YYYY-MM-DD)."
          },
          "keyword": {
            "title": "Keyword (violations full-text)",
            "type": "string",
            "description": "Full-text search across the violation descriptions (e.g. `rodent`, `mold`, `hot water`)."
          },
          "ward": {
            "title": "Ward",
            "enum": [
              "",
              "1",
              "2",
              "3",
              "4",
              "5",
              "6",
              "7",
              "8",
              "9",
              "10",
              "11",
              "12",
              "13",
              "14",
              "15",
              "16",
              "17",
              "18",
              "19",
              "20",
              "21",
              "22",
              "23",
              "24",
              "25",
              "26",
              "27",
              "28",
              "29",
              "30",
              "31",
              "32",
              "33",
              "34",
              "35",
              "36",
              "37",
              "38",
              "39",
              "40",
              "41",
              "42",
              "43",
              "44",
              "45",
              "46",
              "47",
              "48",
              "49",
              "50"
            ],
            "type": "string",
            "description": "Chicago City Council ward (1-50) the establishment falls in, resolved from the city's ward boundary map (mode=search).",
            "default": ""
          },
          "communityArea": {
            "title": "Community area",
            "enum": [
              "",
              "ROGERS PARK",
              "WEST RIDGE",
              "UPTOWN",
              "LINCOLN SQUARE",
              "NORTH CENTER",
              "LAKE VIEW",
              "LINCOLN PARK",
              "NEAR NORTH SIDE",
              "EDISON PARK",
              "NORWOOD PARK",
              "JEFFERSON PARK",
              "FOREST GLEN",
              "NORTH PARK",
              "ALBANY PARK",
              "PORTAGE PARK",
              "IRVING PARK",
              "DUNNING",
              "MONTCLARE",
              "BELMONT CRAGIN",
              "HERMOSA",
              "AVONDALE",
              "LOGAN SQUARE",
              "HUMBOLDT PARK",
              "WEST TOWN",
              "AUSTIN",
              "WEST GARFIELD PARK",
              "EAST GARFIELD PARK",
              "NEAR WEST SIDE",
              "NORTH LAWNDALE",
              "SOUTH LAWNDALE",
              "LOWER WEST SIDE",
              "LOOP",
              "NEAR SOUTH SIDE",
              "ARMOUR SQUARE",
              "DOUGLAS",
              "OAKLAND",
              "FULLER PARK",
              "GRAND BOULEVARD",
              "KENWOOD",
              "WASHINGTON PARK",
              "HYDE PARK",
              "WOODLAWN",
              "SOUTH SHORE",
              "CHATHAM",
              "AVALON PARK",
              "SOUTH CHICAGO",
              "BURNSIDE",
              "CALUMET HEIGHTS",
              "ROSELAND",
              "PULLMAN",
              "SOUTH DEERING",
              "EAST SIDE",
              "WEST PULLMAN",
              "RIVERDALE",
              "HEGEWISCH",
              "GARFIELD RIDGE",
              "ARCHER HEIGHTS",
              "BRIGHTON PARK",
              "MCKINLEY PARK",
              "BRIDGEPORT",
              "NEW CITY",
              "WEST ELSDON",
              "GAGE PARK",
              "CLEARING",
              "WEST LAWN",
              "CHICAGO LAWN",
              "WEST ENGLEWOOD",
              "ENGLEWOOD",
              "GREATER GRAND CROSSING",
              "ASHBURN",
              "AUBURN GRESHAM",
              "BEVERLY",
              "WASHINGTON HEIGHTS",
              "MOUNT GREENWOOD",
              "MORGAN PARK",
              "OHARE",
              "EDGEWATER"
            ],
            "type": "string",
            "description": "One of Chicago's 77 official community areas, resolved from the city's community-area boundary map (mode=search).",
            "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 Chicago business license numbers to fetch full inspection history for.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "inspectionIds": {
            "title": "Inspection IDs (mode=byInspectionIds)",
            "type": "array",
            "description": "Exact inspection ID(s) to fetch.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "sortAscending": {
            "title": "Sort ascending",
            "type": "boolean",
            "description": "Sort by inspection date oldest-first instead of newest-first.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}