# Code Violations Scraper: Distressed Property & Owner Leads (`steadyscrape/code-violations-scraper`) Actor

US code violations and code-enforcement cases from city open-data portals: NYC (HPD, DOB, ECB), Chicago, Los Angeles, San Francisco, Austin, Seattle and 8 more. Address, violation, status, dates, parcel, NYC owner of record. Motivated-seller leads. Export to JSON, CSV or Excel, or via API.

- **URL**: https://apify.com/steadyscrape/code-violations-scraper.md
- **Developed by:** [Steady Scrape](https://apify.com/steadyscrape) (community)
- **Categories:** Lead generation, Real estate
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 violation delivereds

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 Violations Scraper: distressed property and owner leads

**Code Violations Scraper** collects **US code violations** and code-enforcement cases from the open-data portals of US cities, newest first: **New York City (HPD housing violations, DOB violations, DOB ECB violations), Chicago (building violations and Buildings hearings), Los Angeles, San Francisco, Austin, Seattle, New Orleans, Orlando, Norfolk, Mesa, Cincinnati, Montgomery County (MD), Cambridge (MA)** and **Reading (PA)**. Each violation comes as one clean row with the same columns everywhere: case number, date opened, status (open or closed), violation code and description, address, ZIP, parcel and coordinates. New York's violations carry the **owner of record** of the lot from NYC PLUTO, matched by BBL, with the assessed value, year built and number of units. Filter by **date, open or closed cases, keywords and ZIP codes**. Export to JSON, CSV or Excel, or use it via API.

The data comes from each city's own Socrata open-data API (data.cityofnewyork.us, data.cityofchicago.org, data.lacity.org…). No login, no key, no proxy, no browser. Every row names the portal, the dataset, the agency and the licence it was published under. This Actor is an independent tool. It is not affiliated with or endorsed by any of these cities or agencies.

### What can this code violations scraper do?

- **Motivated-seller and distressed-property leads**: properties cited this week for vacant buildings, unsafe structures, roofs, rats, heat or overgrown lots. The owner often wants out, and a code violation is one of the strongest signals a real estate investor can list.
- **Owner of record in New York City**: every HPD, DOB and ECB violation is matched to its tax lot (BBL) and comes with the owner's name, the assessed value, the year built and the residential units.
- **Respondents and fines**: NYC ECB violations name the respondent, their mailing address, the penalty and the balance still due; Chicago's Buildings hearings name the respondents, the hearing day and the fine.
- **Contractor and service leads**: roofers, exterminators, junk removal, landscapers, elevator and fire-safety contractors reach properties that must fix a violation by a date.
- **Property management and due diligence**: watch a portfolio's addresses or ZIP codes for new violations, and check a building's open cases before buying or lending.
- **Market research**: code-enforcement volume by city, ZIP and type of violation.

### How to get code violations

1. Pick the **cities** (by default Chicago, NYC HPD, Los Angeles, Austin and Seattle).
2. Choose a window: **opened in the last N days** (30 by default), or set exact dates.
3. Optionally narrow it down: **open or closed cases**, **keywords** (`vacant`, `roof`, `rodent`, `unsafe`), **ZIP codes**.
4. Run it. Each city's newest violations come first.

A keyword matches words that start with it in the violation's texts: `roof` finds "ROOFS" and "ROOFING", never "RAT PROOF". Every filter is asked of the portal and checked again on each violation, so every row matches what you asked.

### Input

```json
{
    "cities": ["nyc-hpd", "nyc-dob", "chicago", "los-angeles"],
    "openedWithinDays": 14,
    "status": "open",
    "keywords": ["vacant", "unsafe", "roof"],
    "zipCodes": ["10467", "60621"],
    "addOwner": true,
    "maxResultsPerCity": 200
}
```

| field | what it does |
|---|---|
| `cities` | The city datasets to read (keys such as `nyc-hpd`, `nyc-dob-ecb`, `nyc-dob`, `chicago`, `chicago-hearings`, `los-angeles`, `montgomery-county-md`). Pick all three of New York's for every NYC violation, and both of Chicago's. |
| `openedWithinDays` | Violations opened from this many days ago up to today (default 30). |
| `openedFrom`, `openedTo` | Exact first and last days, `YYYY-MM-DD`. They replace the window above. |
| `status` | `any`, `open` or `closed`. |
| `keywords` | Only violations whose description, title, code or type holds a word starting with one of these. |
| `zipCodes` | Only violations in these five-digit ZIP codes. |
| `addOwner` | Add the owner of record to New York's violations (on by default; charged as a violation with owner). |
| `maxResultsPerCity`, `maxResults` | Stop a city, or the whole run, after this many violations (0 for no limit). |
| `maxScannedPerCity` | Stop reading a city after this many violations read, when few pass your filters. |
| `includeRawRecord` | Add the columns the portal publishes, as published, in `raw`. |

### Output example

One NYC DOB ECB violation with its owner of record:

```json
{
    "rowType": "violation",
    "city": "nyc-dob-ecb",
    "cityName": "New York City, NY",
    "state": "NY",
    "recordId": "39211556Z",
    "openedDate": "2026-11-12",
    "hearingDate": "2027-01-29",
    "violationStatus": "ACTIVE; hearing PENDING",
    "isOpen": true,
    "caseType": "Construction",
    "violationCode": "263",
    "description": "FAILURE TO COMPLY WITH THE COMMISSIONER'S ORDER TO FILE A CERTIFICATE OF CORRECTION WITH THE DEPARTMENT OF BUILDINGS…",
    "ordinance": "AC 28-204.4 FAIL TO COMPLY W/COMMISSIONER ORDER TO FILE CERT OF CORRECTION W/DOB",
    "severity": "CLASS - 2",
    "address": "1934 UNIVERSITY AVENUE",
    "addressCity": "Bronx",
    "zipCode": "10453",
    "parcelId": "2028680105",
    "buildingId": "2092062",
    "respondentName": "WISEMAN MANAGEMENT LLC",
    "respondentAddress": "P OBOX 1086 MIDTOWN STATION, NEW YORK, 10018",
    "fineAmount": 1250,
    "balanceDue": 1250,
    "ownerName": "WISEMAN MANAGEMENT,LLC",
    "ownerSource": "NYC PLUTO (Department of City Planning), owner of record matched by BBL",
    "assessedValue": 1257300,
    "yearBuilt": 1917,
    "residentialUnits": 46,
    "recordApiUrl": "https://data.cityofnewyork.us/resource/6bgk-3dad.json?ecb_violation_number=39211556Z",
    "datasetName": "DOB ECB Violations",
    "datasetUrl": "https://data.cityofnewyork.us/d/6bgk-3dad",
    "agency": "NYC Department of Buildings (DOB) and OATH",
    "license": "NYC Open Data terms of use",
    "unreadFields": []
}
```

### Output fields

| field | meaning |
|---|---|
| `city`, `cityName`, `state` | The dataset's key, its city and state. |
| `recordId`, `caseNumber` | The violation's id in the dataset, and the case or notice it belongs to. |
| `openedDate`, `closedDate`, `lastUpdated`, `correctByDate`, `hearingDate` | Days as `YYYY-MM-DD`. |
| `violationStatus`, `isOpen` | The status as the city writes it, and whether the case is still open (`null` when the city does not say). |
| `caseType`, `violationCode`, `violationTitle`, `description`, `ordinance`, `severity` | What was found, the code and the law cited, and its class or priority. |
| `inspector` | The inspector or code officer, where the city publishes one. |
| `address`, `unit`, `addressCity`, `zipCode`, `latitude`, `longitude` | Where. |
| `parcelId`, `buildingId` | The parcel (BBL in New York, block/lot in San Francisco) and the building id (NYC BIN). |
| `respondentName`, `respondentAddress`, `fineAmount`, `balanceDue` | Who was cited and what they owe (NYC ECB, Chicago hearings). |
| `ownerName`, `ownerSource` | The owner of record and where it comes from (New York, from PLUTO). |
| `ownerOccupied`, `assessedValue`, `yearBuilt`, `residentialUnits` | Facts of the property: homestead in Orlando, owner-occupied in Reading, the lot in New York. |
| `caseUrl`, `recordApiUrl` | The case's page on the city's site where one exists, and the record in the portal's API. |
| `datasetName`, `datasetUrl`, `agency`, `license` | Where the row comes from and its licence. |
| `unreadFields` | Fields this row could not read, `null` in it: the portal stopped publishing them or wrote them in a new form (empty when all were read; the run's status message names them too). |
| `raw` | The record as published, with `includeRawRecord`. |
| `rowType`, `status` | `violation` and `ok` on a violation; a free status row has `rowType: "status"`, its `status` (`no_results`, `filter_unsupported`, `source_unavailable`, `source_changed`, `scan_limit`, `spending_limit`, `unknown_city`), the `query` (the city key) and the `reason`. |
| `scrapedAt` | When the row was read (ISO 8601, UTC). |

Rows with `rowType: "status"` are free: a city that publishes no status or ZIP for your filter, a portal that did not answer, a search with no results. They say what happened, and nothing is charged for them.

### What each city publishes

| dataset | open / closed | ZIP | parcel | extra |
|---|---|---|---|---|
| New York City, HPD housing violations | yes | yes | BBL | owner, assessed value, units, year built (PLUTO); class A/B/C; correct-by day |
| New York City, DOB ECB violations | yes | from PLUTO | BBL | respondent and mailing address, penalty, balance due, hearing; owner (PLUTO) |
| New York City, DOB violations | yes | from PLUTO | BBL | owner (PLUTO) |
| Chicago, building violations | yes | no | no | inspector, inspector comments, ordinance |
| Chicago, Buildings hearings | yes | no | no | respondents, hearing day, fine |
| Los Angeles | yes | yes | yes | program (CNAP, PACE, VEIP…) |
| San Francisco | yes | yes | block/lot | coordinates |
| Austin, TX | yes | yes | yes | priority, inspector, case link |
| New Orleans, LA | no | no | no | code section |
| Orlando, FL | yes | no | yes | assessed value, homestead |
| Norfolk, VA | yes | no | GPIN | code section |
| Seattle, WA | yes | yes | no | case link |
| Mesa, AZ | yes | yes | yes | code officer |
| Cincinnati, OH (with Blue Ash and Norwood) | yes | no | no | case link |
| Montgomery County, MD | yes | yes | no | closed day |
| Cambridge, MA | yes | no | yes | correct-by day |
| Reading, PA | yes | no | yes | owner-occupied, units, correct-by day |

### How much does it cost?

**US$0.002 per violation** delivered (US$2 per 1,000), and **US$0.003 per violation with its owner of record** (New York, when PLUTO names the owner). Free status rows are never charged, and there is no start fee. Set a maximum cost per run in Apify and the run stops at exactly the violations it pays for.

### Limits

- Data is as fresh as each city publishes it: most portals update daily.
- A city that publishes no case status (New Orleans) or no ZIP code is not read when you filter by it, and a free row says so.
- The owner of record is joined only in New York, where PLUTO publishes it by lot. Other cities publish the parcel: join it with the county's assessor records for the owner.
- Complaint texts are written by residents. Contact details a resident typed into one (a name line, an email, a phone number) are removed before the row is delivered, and Orlando's complaint comments are not delivered at all.
- Coverage is the 17 datasets listed. Open an issue to ask for another city that publishes code violations as open data.
- A portal that is down is retried with growing waits; if it still does not answer, the run goes on with the others and a free row says so.

### Is it legal to scrape code violations?

Code violations are public records, and every portal read here publishes them as open data for reuse, under the licence named in each row. Some rows name people (owners, respondents). If you use them for marketing, follow the rules that apply to you: CAN-SPAM, the TCPA and Do Not Call lists for phone outreach, fair housing and state privacy laws. Read each portal's terms before republishing the data.

### Related Actors

- [Building Permits Scraper](https://apify.com/steadyscrape/building-permits-scraper): new permits with the contractor, from the same city portals.
- [Zillow Scraper](https://apify.com/steadyscrape/zillow-scraper): property listings and prices.
- [Google Maps No-Website Leads](https://apify.com/steadyscrape/google-maps-no-website-leads): local businesses without a website.

# Actor input Schema

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

The code-enforcement datasets to read, each one newest first. Every row names its dataset, agency and licence. New York publishes three: HPD housing violations, DOB ECB violations (with the respondent and the penalty) and DOB violations; Chicago two: building violations and the hearings of building cases (with the respondent and the fine).

## `openedWithinDays` (type: `integer`):

Violations and cases the city dates in this many days back from today (the day it issued, filed or opened them). "From" and "To" below replace it.

## `openedFrom` (type: `string`):

The first day, YYYY-MM-DD, included. Leave empty to count back from the last day.

## `openedTo` (type: `string`):

The last day, YYYY-MM-DD, included. Empty means today.

## `status` (type: `string`):

Open cases only, closed ones only, or both. New Orleans publishes no status, so with "Open" or "Closed" it is not read and a free row says so.

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

Only violations whose texts (title, description, code, ordinance) hold a word starting with any of these, case aside: "vacant", "roof", "unsafe", "mold", "work without permit". At most 20.

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

Only violations in these five-digit ZIP codes. Datasets that publish no ZIP code (both Chicago datasets, NYC DOB and DOB ECB, New Orleans, Orlando, Norfolk, Cincinnati, Cambridge, Reading) are not read when this is set, and a free row says so. At most 100.

## `addOwner` (type: `boolean`):

NYC rows get the lot's owner of record from NYC PLUTO, matched by BBL. A violation delivered with its owner is charged as a violation with owner. Year built, units and assessed value come from PLUTO either way.

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

Newest first in each dataset. 0 means no limit.

## `maxResults` (type: `integer`):

0 means no limit.

## `maxScannedPerCity` (type: `integer`):

Stops reading a city after this many records when your filters match few of them. 0 means no limit.

## `includeRawRecord` (type: `boolean`):

Adds each record as the portal published it (every column) in "raw". Off keeps CSV and Excel exports to the normalized columns.

## Actor input object example

```json
{
  "cities": [
    "nyc-hpd",
    "chicago",
    "austin"
  ],
  "openedWithinDays": 30,
  "status": "any",
  "keywords": [],
  "zipCodes": [],
  "addOwner": true,
  "maxResultsPerCity": 5,
  "maxResults": 1000,
  "maxScannedPerCity": 20000,
  "includeRawRecord": false
}
```

# Actor output Schema

## `violations` (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": [
        "nyc-hpd",
        "chicago",
        "austin"
    ],
    "openedWithinDays": 30,
    "maxResultsPerCity": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadyscrape/code-violations-scraper").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": [
        "nyc-hpd",
        "chicago",
        "austin",
    ],
    "openedWithinDays": 30,
    "maxResultsPerCity": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("steadyscrape/code-violations-scraper").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": [
    "nyc-hpd",
    "chicago",
    "austin"
  ],
  "openedWithinDays": 30,
  "maxResultsPerCity": 5
}' |
apify call steadyscrape/code-violations-scraper --silent --output-dataset

```

## MCP server setup

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

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/H3IW5K1dmNPW75MuW/builds/eq77SOgtvpTctarTd/openapi.json
