# Code Violation Leads – Building & Housing Violations (`gazidev/code-violation-leads`) Actor

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.

- **URL**: https://apify.com/gazidev/code-violation-leads.md
- **Developed by:** [Cemal Atakli](https://apify.com/gazidev) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 violations

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Code Violation Leads – Building & Housing Code Violations (US cities)

Get **building, housing and property code violations** from the official open-data portals of **New York City (HPD housing + DOB building), Chicago, Los Angeles, Austin, Seattle, Kansas City, New Orleans, Cincinnati, Orlando, Norfolk (VA), Montgomery County (MD), Cambridge (MA) and Reading (PA)**, all in **one clean schema**. Every row has the property address, ZIP, violation date, **open / closed status**, category, severity or class, description, inspector comments (where published), parcel / BBL, coordinates and a link to the source dataset.

Turn it on with **Group by property** to get a **distressed-property list**: one row per address with the number of violations, how many are still open, first and latest dates and the top problem categories, sorted by most violations.

Data comes from each city's public **Socrata open-data API** (no login, no scraping of protected portals). **$1 per 1,000 rows.** Filtered rows are free.

### What it does

- **14 official datasets**, choose any or "All cities". Every city's columns are mapped to the same fields, so you can combine cities in one spreadsheet or CRM.
- **Date filters:** violations from the last N days, or an exact date range. Newest first.
- **Open violations only:** skip anything the city marks closed, corrected, complied, resolved or dismissed.
- **Severity / class / category filter:** e.g. NYC HPD class `C` (immediately hazardous), `vacant`, `infestation`, `elevator`, `structure`, `weeds`.
- **Keyword search** over the full record: `roof`, `mold`, `rodent`, `bed bugs`, `porch`, `fire escape`, `boiler`, `vacant`...
- **ZIP codes** and **address contains** (street name) filters.
- **Group by property** with a minimum violation count (repeat-offender / distressed-property lists).
- **Monitoring mode:** `onlyNew` on a daily or weekly schedule returns only violations (or changed properties) you have not seen before.
- **Optional `raw` field** with every original column the city publishes.

| Source key | City / dataset | Status | Severity / class | ZIP | Parcel | Inspector comments |
|---|---|---|---|---|---|---|
| `new-york-ny-hpd` | NYC HPD Housing Maintenance Code Violations | ✓ | ✓ class A/B/C, rent impairing | ✓ | ✓ BBL, BIN | – |
| `new-york-ny-dob` | NYC DOB Violations | ✓ | ✓ violation type | – | ✓ BBL, BIN | ✓ disposition comments |
| `chicago-il` | Chicago Building Violations | ✓ | ✓ bureau | – | – | ✓ |
| `los-angeles-ca` | LADBS Code Enforcement Cases (open) | ✓ open | ✓ case type | ✓ | ✓ | – |
| `austin-tx` | Austin Code Complaint Cases | ✓ | ✓ priority | ✓ | ✓ | ✓ last update, inspector |
| `seattle-wa` | Seattle Code Complaints and Violations | ✓ | ✓ complaint / NOV / citation | ✓ | – | ✓ complaint text |
| `kansas-city-mo` | KCMO Open Property Violations | ✓ | ✓ issue type | ✓ | – | – |
| `new-orleans-la` | NOLA Code Enforcement All Violations | – | ✓ code section | – | – | ✓ violation text |
| `cincinnati-oh` | Cincinnati Code Enforcement | ✓ | ✓ | – | – | – |
| `orlando-fl` | Orlando Code Enforcement Cases | ✓ | ✓ case type | – | ✓ (+ assessed value, homestead) | ✓ case comments |
| `norfolk-va` | Norfolk Violations | ✓ | ✓ ordinance | – | ✓ GPIN | – |
| `montgomery-county-md` | Montgomery County Housing Code Violations | ✓ | ✓ item | ✓ | – | ✓ corrective action |
| `cambridge-ma` | Cambridge Housing Code Violations | ✓ | ✓ code | ✓ | ✓ MBL | – |
| `reading-pa` | Reading Code Violations | ✓ | ✓ code chapter | – | ✓ (+ units, owner-occupied) | ✓ corrective action |

All datasets were checked to contain 2026 records (most update daily).

### Use cases

- **Real-estate investors and wholesalers:** distressed and neglected properties, repeat-offender buildings, vacant-building complaints – motivated-seller lists by ZIP code.
- **Contractors and home services:** roofers, plumbers, electricians, pest control, junk removal, lawn care, boiler and elevator companies – owners who are ordered to fix something now.
- **Property managers and lenders:** watch your own or your borrowers' buildings for new violations.
- **Tenant advocates, journalists and researchers:** worst buildings, hazardous-condition trends, response times.

### Input example

```json
{
  "cities": ["new-york-ny-hpd", "chicago-il"],
  "withinDays": 30,
  "openOnly": true,
  "groupByProperty": true,
  "minViolationsPerProperty": 10,
  "maxResultsPerCity": 50
}
```

### Output example (one violation)

```json
{
  "city": "New York, NY", "source": "new-york-ny-hpd", "violationId": "19260498",
  "propertyAddress": "30-14 90 STREET", "zip": "11369", "district": "QUEENS",
  "violationDate": "2026-10-19", "status": "open", "statusRaw": "NOV SENT OUT", "statusDate": "2026-10-19",
  "category": "Housing maintenance", "severity": "B - hazardous",
  "description": "§ 27-2087 ADM CODE - DISCONTINUE USE OF ROOMS FOR LIVING, DISCONNECT PLUMBING FIXTURES WHERE ILLEGAL ...",
  "inspectionDate": "2026-09-27", "parcelId": "4013870013", "bin": "4033469", "neighborhood": "Jackson Heights",
  "latitude": 40.761459, "longitude": -73.878867, "dataset": "https://data.cityofnewyork.us/d/wvxf-dwi5"
}
```

### Output example (group by property)

```json
{
  "city": "Chicago, IL", "source": "chicago-il", "propertyAddress": "112 W 110TH PL",
  "violationCount": 35, "openViolations": 35, "latestViolationDate": "2026-10-08", "firstViolationDate": "2026-10-02",
  "topCategories": ["CONSERVATION"], "latestDescription": "LISTED FOR USE TEMP & LOCATION",
  "violationIds": ["7555235", "7554826", "7554827"], "latitude": 41.693568, "longitude": -87.626192,
  "dataset": "https://data.cityofchicago.org/d/22u3-xenr"
}
```

### Pricing (pay per event)

| Event | Price |
|---|---|
| Violation (or property row when grouping) | **$0.001** |
| Actor start | $0.00005 |

Rows removed by your filters and `onlyNew` repeats are **free**, and reading violations for grouping is free – you pay only for rows saved. Set a *maximum cost per run* and the Actor stops cleanly at that limit.

| Actor | Price per row |
|---|---|
| **This Actor** | **$0.001** |
| permitdata/us-code-violations-scraper | $0.003 |
| finaldynamics/code-violation-leads | $0.006 + $0.01 per run |

Competitor prices from the Apify Store on 2026-10-20.

### FAQ

**Does it include the owner's name and phone number?** Only where the city publishes it in the violation dataset (most do not). The Actor never guesses or looks up contact details. Use the parcel / BBL number with your county assessor or skip-tracing tool.

**Why are Chicago and New Orleans rows missing a ZIP?** Those datasets do not publish ZIP codes; use `addressContains` or coordinates instead.

**What does "status" mean?** `open` / `closed` is normalized from the city's own status (`statusRaw` keeps the original). New Orleans does not publish a status. The Los Angeles dataset contains open cases only.

**Why not every US city?** Only cities that publish violations as current open data with an API are included. Tell us which city you need next.

**Data licenses:** each row links to its source dataset; data is published by the cities under their open-data terms. Not affiliated with any city.

### Related

Looking for new construction instead of problems? **[Building Permits Search – US City Construction Leads](https://apify.com/gazidev/building-permits-search)** returns newly issued building permits (NYC, Chicago, LA, SF, Austin, Seattle and more) in the same style.

### Use with AI agents (Apify MCP)

Works as a tool in the [Apify MCP server](https://mcp.apify.com): "List Brooklyn and Bronx buildings with more than 10 open class C HPD violations this month" or "Find open roof violations in Chicago from the last 2 weeks."

# Actor input Schema

## `cities` (type: `array`):

Official open-data code-violation datasets to search.

## `withinDays` (type: `integer`):

Ignored when 'Date from' is set.

## `dateFrom` (type: `string`):

Optional start date (violation / case date).

## `dateTo` (type: `string`):

Optional end date.

## `openOnly` (type: `boolean`):

Skip violations the city marks as closed, corrected, complied, resolved or dismissed.

## `severityOrCategory` (type: `array`):

Keep only rows whose severity, class or category matches, e.g. 'C' (NYC HPD immediately hazardous), 'B', 'conservation', 'elevator', 'structure', 'vacant', 'weeds', 'infestation'.

## `keywords` (type: `array`):

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.

## `zipCodes` (type: `array`):

Keep only properties in these ZIP codes (Chicago does not publish ZIPs).

## `addressContains` (type: `string`):

e.g. a street name: 'BROADWAY'.

## `maxResultsPerCity` (type: `integer`):

Violations (or properties when grouping) per city. 0 = no limit.

## `groupByProperty` (type: `boolean`):

Distressed-property lists: one row per property with violation count, open count, dates and top categories, sorted by most violations. Charged per property row.

## `minViolationsPerProperty` (type: `integer`):

With grouping: only properties with at least this many matching violations (free filter).

## `maxViolationsToScanPerCity` (type: `integer`):

With grouping: how many recent violations to read before grouping (reading is free).

## `includeRawFields` (type: `boolean`):

Adds the city's original record under 'raw' (not with grouping).

## `onlyNew` (type: `boolean`):

For scheduled lead alerts: skip violations (or unchanged properties) earlier runs with the same state key already returned (free).

## `stateKey` (type: `string`):

Separate alerts keep separate 'seen' lists.

## `socrataAppToken` (type: `string`):

Free token from any Socrata portal (dev.socrata.com). Only needed for very large runs.

## Actor input object example

```json
{
  "cities": [
    "chicago-il",
    "new-york-ny-hpd"
  ],
  "withinDays": 7,
  "openOnly": false,
  "maxResultsPerCity": 10,
  "groupByProperty": false,
  "minViolationsPerProperty": 1,
  "maxViolationsToScanPerCity": 5000,
  "includeRawFields": false,
  "onlyNew": false,
  "stateKey": "default"
}
```

# Actor output Schema

## `violations` (type: `string`):

No description

## `properties` (type: `string`):

No description

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "cities": [
        "chicago-il",
        "new-york-ny-hpd"
    ],
    "withinDays": 7,
    "maxResultsPerCity": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("gazidev/code-violation-leads").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "cities": [
        "chicago-il",
        "new-york-ny-hpd",
    ],
    "withinDays": 7,
    "maxResultsPerCity": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("gazidev/code-violation-leads").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "cities": [
    "chicago-il",
    "new-york-ny-hpd"
  ],
  "withinDays": 7,
  "maxResultsPerCity": 10
}' |
apify call gazidev/code-violation-leads --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gazidev/code-violation-leads"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ksb1wo5WI6pNv7DhI/builds/43ObGoHcFrcS1VzYc/openapi.json
