# Code Violation & Distressed Property Leads (`astounding_loam/code-violation-leads`) Actor

Building, housing and property code violations from official open data in Chicago, Los Angeles, Austin, Seattle, San Francisco, Cincinnati and New Orleans. Address, date, status, category, description and a distressed-property roll-up. No login, API key or proxy.

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

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 & Distressed Property Leads

Get **building, housing and property code violations** from official open-data portals in **Chicago, Los Angeles, Austin, Seattle, San Francisco, Cincinnati and New Orleans**. One clean row per violation — address, ZIP, date, open/closed status, category, description, parcel and coordinates — or roll them up to a **distressed-property list** (one row per address with a violation count).

Built for **contractors and restorers (roof, mold, pest, foundation), cash buyers and investors, property managers, neighborhood nonprofits, and municipal-data researchers**.

### What does this Actor do?

- Searches each city's official code-enforcement or building-violation dataset for records in your date window (default: last 30 days).
- Keeps **open / active** cases by default (where the city publishes a status).
- Optional keyword filter (`roof`, `mold`, `vacant`, `rodent`, `weeds`...).
- Optional **Group by property** to produce a repeat-offender / distressed-property list.
- Normalizes every city's columns into **one schema**.
- No login, no API key, no proxies, no browser — public Socrata (SODA) APIs only.

### Supported cities

| City | Source | Status | Description | ZIP | Parcel | Link |
|---|---|---|---|---|---|---|
| Chicago, IL | Building Violations (`22u3-xenr`) | ✅ | ✅ + inspector comments | – | – | – |
| Los Angeles, CA | LADBS Code Enforcement Cases open (`u82d-eh7z`); closed (`rken-a55j`) when Open only is off | ✅ | case type | ✅ | ✅ | – |
| Austin, TX | Code Department cases (`6wtj-zbtb`) | ✅ | ✅ + last update | ✅ | ✅ | ✅ |
| Seattle, WA | SDCI Code Complaints and Violations (`ez4a-iug7`) | ✅ | ✅ | ✅ | – | ✅ |
| San Francisco, CA | DBI Housing / Building Complaints (`gm2e-bten`) | ✅ | ✅ | ✅ | ✅ | – |
| Cincinnati, OH | Code Enforcement (`cncm-znd6`) | ✅ | ✅ | – | – | ✅ |
| New Orleans, LA | Code Enforcement All Violations (`3ehi-je3s`) | – | ✅ | – | – | – |

### How to use it

1. Pick one or more **Cities**.
2. Set **Opened / issued in the last N days** (or an exact date range).
3. Leave **Open / active cases only** on unless you also want closed history.
4. Optional: keywords, or **Group by property** with a minimum violation count.
5. Click **Start** and download CSV, Excel or JSON — or schedule it daily/weekly.

#### Example input

```json
{
  "cities": ["chicago", "austin", "seattle"],
  "daysBack": 30,
  "openOnly": true,
  "keywords": ["roof", "mold", "vacant"],
  "groupByProperty": true,
  "minViolations": 2,
  "maxResultsPerCity": 500,
  "maxResults": 2000
}
```

### Output example

```json
{
  "city": "Chicago",
  "state": "IL",
  "violationId": "7566309",
  "violationDate": "2026-11-06",
  "status": "OPEN",
  "category": "ELEVATOR",
  "description": "MAINTAIN OR REPAIR ELECT ELEVA",
  "comments": "COMPLETE GENERATOR TESTING FOR FINAL.",
  "address": "1255 S WABASH AVE",
  "violationCount": 1,
  "latitude": 41.8659,
  "longitude": -87.6257,
  "sourceDataset": "https://data.cityofchicago.org/resource/22u3-xenr"
}
```

### How much does it cost?

You pay **per row returned** (pay-per-result) — no start fee. 1,000 rows cost about **$4**. Grouped property rows count as one result each. Use **Max results in total** to cap any run.

### Use cases

- **Roof, mold, pest and restoration contractors:** open violations are a timed lead — the owner already has a problem to fix.
- **Investors and cash buyers:** group by property and set a minimum violation count to find distressed or neglected buildings.
- **Property managers and researchers:** track open cases by ZIP and category week over week.

### FAQ

**Is this data legal to use?** Yes. It comes from official public-records open-data portals. A violation is an allegation or finding by the city, not a verdict about the owner. Follow local laws when you reach out.

**Why do some rows have no ZIP, parcel or status?** Not every city publishes those fields. The table above shows what each source provides. New Orleans has no status field, so "open only" cannot be applied there.

**Do violation counts include the property's full history?** No. When you group by property, the count is of violations returned in *this run* (after the date, city, open-only and keyword filters).

**How fresh is the data?** As fresh as the city's portal — most update daily.

**Can I run it on a schedule?** Yes — use Apify Schedules (e.g. every morning, `daysBack: 1`) and send results to Google Sheets, Slack, email, Zapier or Make.

**Something broke or a city is missing?** Report it in the Issues tab and it gets fixed fast.

# Actor input Schema

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

Official city open-data portals to search.

## `daysBack` (type: `integer`):

Used when Date from is empty.

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

Optional. Overrides 'last N days'.

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

Optional. Defaults to today.

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

Skip violations the city marks closed, completed, complied, withdrawn or resolved. New Orleans does not publish a status, so this filter is skipped there. Los Angeles uses the official open-cases dataset when this is on, and also the closed-cases dataset when it is off.

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

Optional phrases matched in the description, category or comments, e.g. 'roof', 'mold', 'vacant', 'rodent'.

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

Roll violations up to one row per address, with a violation count. Useful for repeat-offender / distressed-property lists. Counts are within the rows returned this run (after city and date filters), not a lifetime total.

## `minViolations` (type: `integer`):

Only used when Group by property is on. Drop properties with fewer than this many violations in the result set.

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

Stop after this many violation rows (before grouping) from any one city.

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

Hard cap on rows (and cost) for the whole run, applied after grouping if grouping is on.

## Actor input object example

```json
{
  "cities": [
    "chicago",
    "los-angeles",
    "austin"
  ],
  "daysBack": 30,
  "openOnly": true,
  "groupByProperty": false,
  "minViolations": 1,
  "maxResultsPerCity": 100,
  "maxResults": 200
}
```

# Actor output Schema

## `leads` (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",
        "los-angeles",
        "austin"
    ],
    "daysBack": 30,
    "maxResultsPerCity": 100,
    "maxResults": 200
};

// Run the Actor and wait for it to finish
const run = await client.actor("astounding_loam/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",
        "los-angeles",
        "austin",
    ],
    "daysBack": 30,
    "maxResultsPerCity": 100,
    "maxResults": 200,
}

# Run the Actor and wait for it to finish
run = client.actor("astounding_loam/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",
    "los-angeles",
    "austin"
  ],
  "daysBack": 30,
  "maxResultsPerCity": 100,
  "maxResults": 200
}' |
apify call astounding_loam/code-violation-leads --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,astounding_loam/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/4PpmqFTPpirbt4UJh/builds/v7AerC5rkccBtm3we/openapi.json
