# Code Violations Scraper — City Code Enforcement Leads (`intelscrape/code-violations`) Actor

Municipal city code-enforcement / code-violation public records for contractor and investor leads. Soft CTA to Building Permit Scraper. Confirm live Store pricing before runs.

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

## Pricing

from $2.00 / 1,000 dataset items

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Code Violations Scraper — City Code Enforcement Leads

![Actor Banner](https://api.apify.com/v2/key-value-stores/PyvJzfQg02FD3RYhd/records/code-violations-banner.png)

> 🇨🇳 **中文简介 (Chinese — China & Singapore):**
> 市政 code violations / 城市执法违规线索：抓取公开违规记录相关字段，方便承包商与物业服务跟进。按结果计费（见商店 PPE）——适合本地服务拓客。同一买家常再跑 Building Permit Scraper 补新许可；需要电话邮箱时接 Skip Trace PRO；现在就在 Apify 试跑，把违规线索导出。

> 🇸🇬 **Ringkasan Melayu (Singapore):**
> Nak lead **city code enforcement** / code violation bandar AS? Actor ini scrape rekod awam pelanggaran untuk kontraktor dan pelabur. Pasangkan dengan Building Permit Scraper untuk lead bina di bandar sama. Semak panel harga Store sebelum run. Sesuai untuk pasukan hartanah di Singapura. Cuba di Apify sekarang.

#### 🤖 NEW: Connect This To Your AI! (MCP)

Want city code-enforcement leads inside Claude, Cursor, or ChatGPT? Use the **[Skip Trace MCP Server](https://apify.com/intelscrape/skip--trace)** — Model Context Protocol access to Code Violations + **Building Permit Scraper** in one AI workflow.

#### 🏆 Featured Bots by IntelScrape

1. **[Code Violations Scraper](https://apify.com/intelscrape/code-violations)** — City Code Enforcement Leads
2. **[Building Permit Scraper](https://apify.com/intelscrape/building-permit-scraper)** — Roofing, Solar & HVAC Leads
3. **[Skip Trace PRO](https://apify.com/intelscrape/skip-trace-pro)** — Name, Address, Phone & Email People Lookup
4. **[TruePeopleSearch Scraper](https://apify.com/intelscrape/truepeoplesearch-scraper)** — Phone & Email Matches
5. **[TikTok Scraper](https://apify.com/intelscrape/tiktok-scraper)** — Emails & Influencer Leads
6. **[Google Maps No-Website Leads](https://apify.com/intelscrape/website-Leads)** — Local Businesses Without a Website
7. **[UCC Lien Scraper](https://apify.com/intelscrape/ucc-lien-scraper)** — Florida & New Jersey Filings
8. **[Skip Trace MCP Server](https://apify.com/intelscrape/skip--trace)** — Use Skip Trace inside Claude, Cursor, ChatGPT

***

⚡ **Use this Actor in n8n — no code**

Use the official **Apify** node. Actor ID: `IntelScrape/code-violations`.

***

![price](https://img.shields.io/badge/price-see_Store-e83e8c) ![billing-see\_Store\_panel](https://img.shields.io/badge/billing-see_Store_panel-2ea44f) ![API key](https://img.shields.io/badge/API_key-not_required-blue) ![coverage-US\_municipal](https://img.shields.io/badge/coverage-US_municipal-8a2be2)

**City code enforcement / municipal code-violation leads** for contractor outreach and distressed-property screens.\
**Confirm the live Store pricing panel before you run — this Actor may be on a free/trial tariff.**

> **Honest coverage & billing (read this):** Source is **public municipal violation-style pages/feeds we wire in code** (open data where available). **Billing follows the live Apify Store pricing panel** (may show FREE or PPE). Do not assume a fixed per-item rate without checking. Demo/synthetic rows if offered are not production leads.

***

> 🧭 Built for **contractors, property investors, and local-service sales teams** hunting **city code enforcement** and housing/building violations.

> ⭐ **Store rating is driven by daily power users.** If this Actor saves you time, please [leave a review](https://apify.com/intelscrape/code-violations).

> ⚖️ **Lawful business use only.** Public data only. You are responsible for compliance with site terms and applicable law.

> 📌 *Examples in this README are **fictional** unless stated otherwise.*

***

### 🕵️‍♂️ Why Choose Us vs. "Cheaper" Competitors?

| Feature | This Actor | Thin stubs |
| :--- | :--- | :--- |
| **Query fit** | City code enforcement / municipal violations | Generic “leads” fluff |
| **Same buyer** | Soft CTA → Building Permit Scraper | Dead-end |
| **Honest billing** | Documented Store panel | Vague |
| **AI / n8n** | MCP + Actor ID | Often none |

### What a result looks like

| address | violation | status | url |
| :--- | :--- | :--- | :--- |
| 100 Main St | Overgrown lot | Open | https://example.city.gov/... |

### Quick start

```json
{
  "states": ["TX"],
  "cities": ["Austin", "Fort Worth"],
  "zipCodes": ["78701"],
  "keyword": "junk",
  "maxResults": 50,
  "daysBack": 90,
  "openOnly": true
}
```

Demo when available:

```json
{
  "demoMode": true,
  "maxItems": 5
}
```

***

### Distress report (paid layer)

When **Include distress report** is on (default), every run also pushes one `recordType: distress-report` summary: avg/median/max score, hot (≥60) count, category mix, hottest addresses, plus Soft CTA to Building Permit Scraper and Skip Trace PRO.

- Confirm the live Store pricing panel for the `distress-report` event (scheduled PPE — may show after the Store notice window).
- Turn the toggle off if you only want raw violation rows.

### Soft CTA — pair with Building Permit Scraper

Code violations flag **distressed / enforcement** properties; newly issued **building permits** flag **active construction spend**. Same buyer (roofing, HVAC, remodel, investors).

Run **[Building Permit Scraper](https://apify.com/intelscrape/building-permit-scraper)** on the same markets:

- Multi-city pack: `cities: ["Chicago","Austin","Miami"]`
- Keyword filter: `keyword: "roof"` / `"solar"` / `"HVAC"`
- Owner phones: pipe addresses into **[Skip Trace PRO](https://apify.com/intelscrape/skip-trace-pro)**

City / state filters on this Actor already let you pack a metro; add permit scans for HOT remodel leads on the same schedule.

### Input / Output / Pricing

See live Actor input schema and Store pricing panel. Output: Apify dataset. **PPE prices unchanged** by this reshape (metadata/README only).

### Legal

Lawful business research only. Not affiliated with the source platforms.

# Actor input Schema

## `states` (type: `array`):

Pick one or more states. Each option lists the jurisdictions covered.

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

Maximum violations to return.

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

0 = no date filter.

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

Drop violations already closed or complied.

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

Narrow to city/jurisdiction names (e.g. Chicago, Austin, New York City). Matches covered portals — civicdataforge-style city pick without losing multi-state packs. Empty = all cities in selected states.

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

Keep only violations in these 5-digit ZIPs (from portal zip field or address). Empty = no ZIP filter.

## `keyword` (type: `string`):

Case-insensitive match against address, violation type, or status (e.g. roofing, vacant, overgrown).

## `demoMode` (type: `boolean`):

Push 3 fictional sample violations without hitting city portals. Use for Store try-outs / PPE checks. Live empty runs hard-fail.

## `categories` (type: `array`):

Keep only these distress categories (permitdata-style). Empty = all. High-distress: demolition, unsafe\_structure, vacant\_abandoned.

## `statuses` (type: `array`):

Normalized status buckets. Empty = all. Prefer open for active leads.

## `minDistressScore` (type: `integer`):

Only return rows at or above this score. 0 = all. Try 60+ for hot motivated-seller leads.

## `sinceDate` (type: `string`):

Explicit start date. Overrides daysBack look-back when set.

## `untilDate` (type: `string`):

Inclusive end date on filedDate. Default: no upper bound.

## `includeDistressReport` (type: `boolean`):

Push one extractive distress-report row (score stats, hot leads, category mix) and charge distress-report PPE when effective. Default on. Rival-parity with scored distress packs.

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

Substring filter on address/city/ZIP/owner/parcel (dominvo address\_filter parity). Empty = no filter.

## `requireOwner` (type: `boolean`):

When true, keep only rows where public records include an owner/respondent name (ArcGIS+Socrata). SoftCTA → Skip Trace PRO for phones/emails.

## Actor input object example

```json
{
  "states": [
    "IL"
  ],
  "maxResults": 100,
  "daysBack": 90,
  "openOnly": false,
  "cities": [],
  "zipCodes": [],
  "keyword": "",
  "demoMode": false,
  "categories": [],
  "statuses": [],
  "minDistressScore": 0,
  "sinceDate": "",
  "untilDate": "",
  "includeDistressReport": true,
  "addressContains": "",
  "requireOwner": false
}
```

# Actor output Schema

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

Distressed-property code violation rows in the default dataset.

# 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 = {
    "states": [
        "IL"
    ],
    "maxResults": 100,
    "daysBack": 90,
    "openOnly": false,
    "demoMode": false,
    "minDistressScore": 0,
    "includeDistressReport": true,
    "requireOwner": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("intelscrape/code-violations").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 = {
    "states": ["IL"],
    "maxResults": 100,
    "daysBack": 90,
    "openOnly": False,
    "demoMode": False,
    "minDistressScore": 0,
    "includeDistressReport": True,
    "requireOwner": False,
}

# Run the Actor and wait for it to finish
run = client.actor("intelscrape/code-violations").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 '{
  "states": [
    "IL"
  ],
  "maxResults": 100,
  "daysBack": 90,
  "openOnly": false,
  "demoMode": false,
  "minDistressScore": 0,
  "includeDistressReport": true,
  "requireOwner": false
}' |
apify call intelscrape/code-violations --silent --output-dataset

```

## MCP server setup

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

```

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/KmYFhlNGpcWoHYCR9/builds/tqAVEtfVZPjsni3Fe/openapi.json
