# Code Violations & Distressed Property Scraper ($0.80/1k) (`desastreger/us-municipal-code-violation-distressed-leads`) Actor

Multi-city municipal code enforcement & distressed property scraper harmonizing live Socrata feeds across Austin, SF, Seattle, Buffalo, Montgomery MD & Cincinnati for wholesalers & contractors. Early-bird $0.80/1k (rises to $2.00/1k). +MCP.

- **URL**: https://apify.com/desastreger/us-municipal-code-violation-distressed-leads.md
- **Developed by:** [Ignacio De Saeger](https://apify.com/desastreger) (community)
- **Categories:** Real estate, Lead generation, MCP servers
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 normalized municipal code violation & distressed property leads

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

### US Municipal Code Violations & Distressed Property Leads Scraper

The **Code Violations & Distressed Property Scraper** unifies live municipal code enforcement, housing habitability violations, condemned/vacant structures, unpermitted construction, and exterior blight records across **6 major US municipal Socrata open-data portals** (**Austin, Seattle, San Francisco, Buffalo, Montgomery County MD, and Cincinnati**). Instead of writing separate scripts for fragmented city schemas (`case_id`, `recordnum`, `complaint_number`, `sbl`, GeoJSON vs flat coordinates), every record is normalized into a consistent 19-field JSON schema containing `address`, `parcelId`, `zipCode`, `distressCategory`, `violationType`, `status`, `isOpenCase`, `openedDate`, `description`, `inspectorOrDivision`, `latitude`, `longitude`, and a deterministic `distressScore` (`0–100`) with `investorPriorityTier` (`CRITICAL_DISTRESS`, `HIGH_MOTIVATION`, `STANDARD`). Fault-isolated per-city fetching ensures one portal hiccup never stops multi-city runs, with native Standby MCP Server support. **No external API key or proxy required.**

### Use cases

- **Off-Market Real Estate Wholesaling & Acquisition:** Pull fresh `openCasesOnly: true` properties with structural hazards, vacant/abandoned tags, or repeat citations before deals hit the MLS.
- **Fix-and-Flip & Distressed Rehab Sourcing:** Filter across 6 US metros by `distressFilter` (`structural_hazard`, `vacant_abandoned`, `housing_habitability`) and prioritize `CRITICAL_DISTRESS` properties.
- **Roofing, Mold Remediation, Plumbing & Electrical Contractors:** Match active `fire_electrical_plumbing`, `exterior_blight`, or `unpermitted_zoning` keywords (`roof`, `mold`, `work without permit`) to immediate homeowner repair demand.
- **Real Estate Skip-Tracing & CRM Pipelines:** Export standardized `address`, `parcelId`, `city`, `state`, and `zipCode` fields directly into Clay, n8n, Make, or PropStream/BatchLeads skip-tracing.
- **Municipal Blight & Risk Analytics:** Track open code enforcement volume and inspector trends across multiple city open-data feeds in one call.
- **AI Deal-Finding Agents (MCP):** Query distressed property leads inside Claude Desktop, Cursor, or Google Antigravity via `/mcp`.

***

### Transparent Pay-Per-Event Launch Pricing

> \[!IMPORTANT]
> **Early-Adopter Launch Rate (`$0.80 / 1,000 leads`):** Temporary promotional pricing for early Apify Store adopters & real-estate workflows.
> **Upcoming Standard Rate (`$2.00 / 1,000 leads`):** Price will step up once initial launch benchmarks are met — and even the permanent standard rate remains **75%–95% lower** than comparable property & municipal scrapers (`$10–$80/1k`).

Pay only per normalized municipal code violation lead returned—no monthly SaaS seat or data vendor fees:

| Plan Tier | Event (`code-violation-lead`) | Effective Rate |
| :--- | :--- | :--- |
| **Early-Bird Launch / Free** | `$0.0008` per lead | **$0.80 per 1,000 leads** |
| **Bronze** | `$0.0007` per lead | **$0.70 per 1,000 leads** |
| **Silver** | `$0.0006` per lead | **$0.60 per 1,000 leads** |
| **Gold** | `$0.0005` per lead | **$0.50 per 1,000 leads** |
| **Scheduled Standard Rate** | `$0.0020` per lead | **$2.00 per 1,000 leads** |

***

### Supported US Municipal Portals (`metros`)

| Metro Key | Jurisdiction | Official Municipal Open-Data Portal |
| :--- | :--- | :--- |
| `austin` | Austin, TX | Austin Code Department Compliance (`6wtj-zbtb`) |
| `seattle` | Seattle, WA | Seattle SDCI Code Complaints & Violations (`ez4a-iug7`) |
| `san_francisco` | San Francisco, CA | SF Dept. of Building Inspection Complaints (`gm2e-bten`) |
| `buffalo` | Buffalo, NY | City of Buffalo Code Violations (`ivrf-k9vm`) |
| `montgomery_md` | Montgomery County, MD | Montgomery County DHCA Housing Code Violations (`k9nj-z35d`) |
| `cincinnati` | Cincinnati, OH | Cincinnati / CAGIS Code Enforcement (`cncm-znd6`) |

***

### 1-Click JSON Input Example

```json
{
  "metros": ["austin", "san_francisco", "buffalo"],
  "distressFilter": "all",
  "openCasesOnly": true,
  "keywords": ["vacant", "roof"],
  "maxResults": 50
}
```

***

### Sample Unified Output Record

```json
{
  "caseId": "2026-148597 CC",
  "metro": "austin",
  "city": "Austin",
  "state": "TX",
  "zipCode": "78745",
  "address": "5907 EUREKA DRIVE",
  "parcelId": "0415120205",
  "distressCategory": "UNPERMITTED_ZONING",
  "violationType": "Complaints - Work Without Permit - Priority 5",
  "status": "Pending",
  "isOpenCase": true,
  "openedDate": "2026-11-11",
  "description": "Work Without Permit",
  "inspectorOrDivision": "Monroe Yarbrough ((512) 788-3046)",
  "latitude": 30.207773,
  "longitude": -97.790069,
  "distressScore": 69,
  "investorPriorityTier": "HIGH_MOTIVATION",
  "sourcePortalUrl": "https://data.austintexas.gov/Public-Safety/Austin-Code-Department-Code-Compliance/6wtj-zbtb"
}
```

***

### API Quickstart (cURL, Node.js & Python)

#### cURL (Synchronous Run + Dataset Items)

```bash
curl -X POST "https://api.apify.com/v2/acts/desastreger~us-municipal-code-violation-distressed-leads/run-sync-get-dataset-items?token=<APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "metros": ["austin", "seattle"],
    "distressFilter": "vacant_abandoned",
    "openCasesOnly": true,
    "maxResults": 25
  }'
```

#### Node.js (`apify-client`)

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('desastreger/us-municipal-code-violation-distressed-leads').call({
  metros: ['austin', 'san_francisco', 'cincinnati'],
  distressFilter: 'structural_hazard',
  openCasesOnly: true,
  maxResults: 50,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python (`apify-client`)

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("desastreger/us-municipal-code-violation-distressed-leads").call(run_input={
    "metros": ["austin", "buffalo", "montgomery_md"],
    "distressFilter": "all",
    "openCasesOnly": True,
    "maxResults": 50,
})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(items[:3])
```

***

### Model Context Protocol (MCP) Integration

Connect **Claude Desktop**, **Cursor**, or **Google Antigravity** directly to the live Standby MCP server at `/mcp`:

```json
{
  "mcpServers": {
    "code-violation-leads": {
      "url": "https://desastreger--us-municipal-code-violation-distressed-leads.apify.actor/mcp",
      "headers": {
        "Authorization": "Bearer <APIFY_TOKEN>"
      }
    }
  }
}
```

**Exposed MCP Tools:**

- `search_code_violation_leads`: Query live code enforcement & distressed property leads across `austin`, `seattle`, `san_francisco`, `buffalo`, `montgomery_md`, and `cincinnati` filtered by `distressFilter`, `openCasesOnly`, `keywords`, and `maxResults`.
- `list_code_violation_metros`: List all 6 supported municipal code violation Socrata portals, dataset URLs, ordering fields, and supported distress filters.

***

### Data Legality & Provenance

100% of data is retrieved from official US municipal open-data portals (`data.austintexas.gov`, `data.seattle.gov`, `data.sfgov.org`, `data.buffalony.gov`, `data.montgomerycountymd.gov`, `data.cincinnati-oh.gov`) published as public municipal records.

# Actor input Schema

## `metros` (type: `array`):

Municipal Socrata open-data portals to query. Supported keys: 'austin', 'seattle', 'san_francisco', 'buffalo', 'montgomery_md', 'cincinnati'.

## `distressFilter` (type: `string`):

Filter code enforcement leads to a specific property distress or rehabilitation category, or select 'all' to return all categories.

## `openCasesOnly` (type: `boolean`):

When enabled, returns only active/open/unresolved code enforcement cases and filters out closed, abated, or corrected cases.

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

Optional keywords matched case-insensitively against violation description, violation type, status, inspector/division, or property address (e.g., 'condemned', 'mold', 'work without permit', 'roof').

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

Maximum total number of normalized code violation leads to return across selected municipal portals (1 to 500).

## Actor input object example

```json
{
  "metros": [
    "austin",
    "san_francisco",
    "buffalo"
  ],
  "distressFilter": "all",
  "openCasesOnly": false,
  "keywords": [],
  "maxResults": 25
}
```

# Actor output Schema

## `leads` (type: `string`):

No description

## `runSummary` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("desastreger/us-municipal-code-violation-distressed-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("desastreger/us-municipal-code-violation-distressed-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 '{}' |
apify call desastreger/us-municipal-code-violation-distressed-leads --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,desastreger/us-municipal-code-violation-distressed-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/pFEO2SbvagV72Bfyn/builds/9aW0hsYU4Gme8QLXr/openapi.json
