{
  "openapi": "3.0.1",
  "info": {
    "title": "NYC Restaurant Inspections - Grades, Scores & Violations",
    "description": "NYC DOHMH restaurant inspections (295k violation records / 31.5k restaurants): grade, score, critical flag, violation code, cuisine, borough, BBL/BIN. Search, aggregate by cuisine or borough, profile a restaurant, roll up one row per restaurant, or read the violation-code dictionary.",
    "version": "0.0",
    "x-build-id": "hW3WE89PKejIAPefP"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/j0401~nyc-restaurant-inspections/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-j0401-nyc-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/j0401~nyc-restaurant-inspections/runs": {
      "post": {
        "operationId": "runs-sync-j0401-nyc-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/j0401~nyc-restaurant-inspections/run-sync": {
      "post": {
        "operationId": "run-sync-j0401-nyc-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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "",
              "rows",
              "aggregate",
              "profile",
              "restaurants",
              "codes"
            ],
            "type": "string",
            "description": "rows = inspection/violation records (default). aggregate = one row per group with a count, average score or restaurant count. profile = one restaurant's latest grade, score and counts (camis required). restaurants = one record per restaurant for a narrowed filter; it requires a filter and refuses a match set above 80,000 rows rather than truncating. codes = the DOHMH violation-code dictionary.",
            "default": ""
          },
          "camis": {
            "title": "CAMIS",
            "type": "string",
            "description": "The city's 8-digit restaurant id, e.g. \"40745618\". Use with mode=profile for one restaurant's full history."
          },
          "name": {
            "title": "Restaurant name contains",
            "type": "string",
            "description": "Case-insensitive substring on the DBA name, e.g. \"pizza\"."
          },
          "boro": {
            "title": "Borough",
            "type": "string",
            "description": "Borough name, e.g. Manhattan, Brooklyn, Queens, Bronx, Staten Island."
          },
          "zipcode": {
            "title": "ZIP code",
            "type": "string",
            "description": "Exact 5-digit ZIP code."
          },
          "cuisine": {
            "title": "Cuisine contains",
            "type": "string",
            "description": "Case-insensitive substring on the cuisine description, e.g. \"Chinese\", \"Pizza\", \"Latin\"."
          },
          "grade": {
            "title": "Grade",
            "enum": [
              "",
              "A",
              "B",
              "C",
              "N",
              "P",
              "Z"
            ],
            "type": "string",
            "description": "Letter grade. A/B/C are the published grades; N = not yet graded, P = pending, Z = reopened without a grade. 150,638 rows carry no grade at all.",
            "default": ""
          },
          "criticalFlag": {
            "title": "Critical flag",
            "enum": [
              "",
              "Critical",
              "Not Critical",
              "Not Applicable"
            ],
            "type": "string",
            "description": "Whether the cited violation is critical to food safety.",
            "default": ""
          },
          "inspectionType": {
            "title": "Inspection type contains",
            "type": "string",
            "description": "e.g. \"Cycle Inspection\", \"Pre-permit\", \"Re-inspection\", \"Administrative\"."
          },
          "violationCode": {
            "title": "Violation code",
            "type": "string",
            "description": "Exact DOHMH violation code, e.g. \"02B\", \"04H\", \"10F\"."
          },
          "bin": {
            "title": "BIN",
            "type": "string",
            "description": "Building Identification Number (links to other NYC building datasets)."
          },
          "bbl": {
            "title": "BBL",
            "type": "string",
            "description": "10-digit Borough-Block-Lot."
          },
          "dateFrom": {
            "title": "Inspection date from",
            "type": "string",
            "description": "ISO date (YYYY-MM-DD)."
          },
          "dateTo": {
            "title": "Inspection date to",
            "type": "string",
            "description": "ISO date (YYYY-MM-DD)."
          },
          "minScore": {
            "title": "Minimum score",
            "minimum": 0,
            "type": "number",
            "description": "Inspection score (higher = more violation points). The score is an inspection-level value repeated on each violation row."
          },
          "maxScore": {
            "title": "Maximum score",
            "minimum": 0,
            "type": "number",
            "description": "Inspection score upper bound."
          },
          "groupBy": {
            "title": "Aggregate dimension",
            "enum": [
              "",
              "cuisine",
              "boro",
              "grade",
              "criticalFlag",
              "inspectionType",
              "violationCode",
              "zipcode"
            ],
            "type": "string",
            "description": "Used only with mode=aggregate.",
            "default": ""
          },
          "metric": {
            "title": "Aggregate metric",
            "enum": [
              "",
              "count",
              "avgScore",
              "restaurants"
            ],
            "type": "string",
            "description": "count (default) = matching rows; avgScore = row-weighted average inspection score (the score repeats on each violation row, so heavily-cited inspections weigh more); restaurants = distinct restaurants, which is the number to use when you want \"how many restaurants\", not \"how many violation rows\".",
            "default": ""
          },
          "maxResults": {
            "title": "Max records",
            "type": "integer",
            "description": "How many records to deliver in rows/profile/restaurants mode (default 50, max 5000). Aggregate and codes modes ignore this.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}