{
  "openapi": "3.0.1",
  "info": {
    "title": "Code Violation Leads – Building & Housing Violations",
    "description": "Building and housing code violations from NYC (HPD + DOB), Chicago, Los Angeles, Austin, Seattle, Kansas City, New Orleans and 7 more cities in one schema: address, ZIP, date, open/closed status, class, description, parcel. Distressed-property leads. $1 per 1,000.",
    "version": "0.1",
    "x-build-id": "43ObGoHcFrcS1VzYc"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/gazidev~code-violation-leads/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-gazidev-code-violation-leads",
        "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~code-violation-leads/runs": {
      "post": {
        "operationId": "runs-sync-gazidev-code-violation-leads",
        "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~code-violation-leads/run-sync": {
      "post": {
        "operationId": "run-sync-gazidev-code-violation-leads",
        "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": "Official open-data code-violation datasets to search.",
            "items": {
              "type": "string",
              "enum": [
                "all",
                "new-york-ny-hpd",
                "new-york-ny-dob",
                "chicago-il",
                "los-angeles-ca",
                "austin-tx",
                "seattle-wa",
                "kansas-city-mo",
                "new-orleans-la",
                "cincinnati-oh",
                "orlando-fl",
                "norfolk-va",
                "montgomery-county-md",
                "cambridge-ma",
                "reading-pa"
              ],
              "enumTitles": [
                "All cities",
                "New York, NY – HPD housing violations",
                "New York, NY – DOB building violations",
                "Chicago, IL",
                "Los Angeles, CA (open LADBS cases)",
                "Austin, TX",
                "Seattle, WA",
                "Kansas City, MO",
                "New Orleans, LA",
                "Cincinnati, OH",
                "Orlando, FL",
                "Norfolk, VA",
                "Montgomery County, MD",
                "Cambridge, MA",
                "Reading, PA"
              ]
            },
            "default": [
              "chicago-il"
            ]
          },
          "withinDays": {
            "title": "Violations from the last N days",
            "minimum": 0,
            "maximum": 3650,
            "type": "integer",
            "description": "Ignored when 'Date from' is set.",
            "default": 30
          },
          "dateFrom": {
            "title": "Date from (YYYY-MM-DD)",
            "type": "string",
            "description": "Optional start date (violation / case date)."
          },
          "dateTo": {
            "title": "Date to (YYYY-MM-DD)",
            "type": "string",
            "description": "Optional end date."
          },
          "openOnly": {
            "title": "Only open violations",
            "type": "boolean",
            "description": "Skip violations the city marks as closed, corrected, complied, resolved or dismissed.",
            "default": false
          },
          "severityOrCategory": {
            "title": "Severity / class / category",
            "type": "array",
            "description": "Keep only rows whose severity, class or category matches, e.g. 'C' (NYC HPD immediately hazardous), 'B', 'conservation', 'elevator', 'structure', 'vacant', 'weeds', 'infestation'.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Full-text search in the violation record, e.g. 'roof', 'mold', 'rodent', 'bed bugs', 'porch', 'vacant', 'fire escape', 'boiler'. Each keyword is a separate search.",
            "items": {
              "type": "string"
            }
          },
          "zipCodes": {
            "title": "ZIP codes",
            "type": "array",
            "description": "Keep only properties in these ZIP codes (Chicago does not publish ZIPs).",
            "items": {
              "type": "string"
            }
          },
          "addressContains": {
            "title": "Address contains",
            "type": "string",
            "description": "e.g. a street name: 'BROADWAY'."
          },
          "maxResultsPerCity": {
            "title": "Max results per city",
            "minimum": 0,
            "type": "integer",
            "description": "Violations (or properties when grouping) per city. 0 = no limit.",
            "default": 100
          },
          "groupByProperty": {
            "title": "Group by property (one row per address)",
            "type": "boolean",
            "description": "Distressed-property lists: one row per property with violation count, open count, dates and top categories, sorted by most violations. Charged per property row.",
            "default": false
          },
          "minViolationsPerProperty": {
            "title": "Min violations per property (grouping)",
            "minimum": 1,
            "type": "integer",
            "description": "With grouping: only properties with at least this many matching violations (free filter).",
            "default": 1
          },
          "maxViolationsToScanPerCity": {
            "title": "Max violations to scan per city (grouping)",
            "minimum": 100,
            "maximum": 200000,
            "type": "integer",
            "description": "With grouping: how many recent violations to read before grouping (reading is free).",
            "default": 5000
          },
          "includeRawFields": {
            "title": "Include all original fields",
            "type": "boolean",
            "description": "Adds the city's original record under 'raw' (not with grouping).",
            "default": false
          },
          "onlyNew": {
            "title": "Only violations not returned before",
            "type": "boolean",
            "description": "For scheduled lead alerts: skip violations (or unchanged properties) earlier runs with the same state key already returned (free).",
            "default": false
          },
          "stateKey": {
            "title": "State key",
            "type": "string",
            "description": "Separate alerts keep separate 'seen' lists.",
            "default": "default"
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Free token from any Socrata portal (dev.socrata.com). Only needed for very large runs."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}