# US Code Violations - 15 City Enforcement Systems (`j0401/us-code-violations`) Actor

Property code violations API: records from 15 US cities in one schema - NYC (HPD, DOB), Chicago, Philadelphia, New Orleans, San Francisco, Baltimore, Cincinnati, Boston, Detroit, Mesa, Norfolk, Austin, Seattle, Columbus, Cleveland. 28 registers; filter by address, ZIP, case, parcel or date.

- **URL**: https://apify.com/j0401/us-code-violations.md
- **Developed by:** [Wenhao Yang](https://apify.com/j0401) (community)
- **Categories:** Business, Real estate, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.03 / 1,000 us code-violation records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Code Violations - 15 City Enforcement Systems

Property code violations, citations, inspections and enforcement cases from fifteen US cities, in one schema: **28 registers, ~27.2 million register rows** (measured 2026-11-22). One row is one source record - not one case.

Ask one question - an address, a ZIP, a case number, a parcel, a date window - and get the enforcement record back as structured JSON, with the status normalized to `open` / `closed` so a violation in Chicago and a violation in New Orleans read the same way.

### Low cost

**From $0.00005 per record, down to $0.00003 at Gold.**

One record is one violation, citation, inspection or case row; an aggregate row is charged as one record. There is no per-run fee and no charge for the query itself.

### What you get

| Jurisdiction | Register (`corpus`) | Records | One row is |
|---|---|---:|---|
| `nyc` | HPD housing violations (`violations`, default) | 11,422,299 | a violation |
| `nyc` | DOB building violations (`dob`) | 2,478,049 | a violation |
| `chicago` | building code violations (`building`, default) | 2,037,803 | a violation |
| `chicago` | ordinance citations (`ordinance`) | 825,445 | a docket citation |
| `philly` | L\&I violations (`violations`, default) | 2,043,582 | a violation |
| `philly` | L\&I investigations (`investigations`) | 2,145,881 | an inspector visit |
| `philly` | L\&I complaints (`complaints`) | 1,075,506 | a complaint |
| `nola` | code enforcement cases (`cases`, default) | 183,726 | a case |
| `nola` | violations cited (`violations`) | 274,280 | a violation line |
| `nola` | inspections (`inspections`) | 247,682 | an inspection |
| `nola` | hearings and judgments (`hearings`) | 103,426 | a hearing |
| `nola` | abatements (`abatements`) | 7,240 | an abatement |
| `nola` | active pipeline (`pipeline`) | 44,791 | a case in progress |
| `sf` | building notices of violation | 519,993 | a notice line item |
| `baltimore` | Environmental Control Board citations (`citations`) | 159,682 | a citation |
| `cincinnati` | code enforcement cases (`cases`) | 773,658 | a case |
| `boston` | Public Works violations (`pw`, default) | 933,290 | a ticket |
| `boston` | Building & Property violations (`building`) | 17,524 | a ticket |
| `detroit` | blight tickets (`blight`, default) | 915,218 | a ticket |
| `detroit` | rental registrations (`rental`) | 45,691 | a registration |
| `detroit` | commercial building compliance (`compliance`) | 27,768 | a building rating |
| `detroit` | demolition inspections (`demolition`) | 40,166 | an inspection |
| `mesa` | code enforcement cases (`cases`) | 83,168 | a case |
| `norfolk` | complaint / violation inspection events (`inspections`) | 75,480 | an inspection event |
| `austin` | code complaint cases (`cases`) | 82,611 | a case |
| `seattle` | code complaints and violations (`cases`) | 252,484 | a case |
| `columbus` | code enforcement cases (`cases`) | 322,695 | a case |
| `cleveland` | issued building violations (`violations`) | 61,957 | a violation |

Counts are the source systems' own totals on 2026-11-22 and continue to grow. Cleveland re-published its register on 2026-11-15; a probe that afternoon caught the publish mid-flight at 38,357 rows, and the finished layer holds 61,957 (same last-edit stamp). Fifteen jurisdictions are supported; this is not a nationwide register. The total is the sum of register rows and double-counts cases that appear in several registers (see the coverage notes).

### One schema across fifteen jurisdictions

Every row carries the same 36 fields regardless of jurisdiction: identifiers (`recordId`, `caseId`, `parcelId` + `parcelScheme`), location (`address`, `city`, `zip`, `latitude`, `longitude`), the violation itself (`violationCode`, `description`, `category`), status (`statusRaw`, `status`, `resolution`), dates (`openedDate`, `closedDate`, `eventDate`, `lastModified`), money (`fineAmount`, `balanceDue`) and provenance (`source`, `sourceUrl`, `sourceUpdatedAt`, `platform`).

**Filter** by `status`, `address`, `zip`, `caseId`, `recordId`, `parcelId`, `dateFrom` / `dateTo`. `recordId` works on every register - pass back any `recordId` you received. On San Francisco it is the notice id, and one notice can hold several line items, so a `recordId` there can return more than one row (`relatedId` is the line item). Which of these a register can serve varies - a register that publishes no ZIP rejects the ZIP filter rather than returning unfiltered rows; the error names the filters it does support.

**Aggregate** by `status` (folded to open / closed / unknown across every source), `category`, `city` or `zip`, where the register publishes that dimension. Aggregates return every group; a dimension with an extreme number of groups fails the run rather than silently dropping the tail.

**Compare cities in one call**: `jurisdiction: "all"` with `mode: "aggregate"` runs the chosen dimension across every city's **default register** and returns one row per city and group - the only way to ask "which city carries the most open violations" in a single answer. A city that does not publish the chosen dimension is skipped and named in the run log; so is a city whose source cannot answer within the time budget (the rest of the comparison still comes back) - run that city on its own to see the underlying error. A **filter** that a city cannot apply still fails the run, because a filter has to work everywhere or the comparison would silently shrink. If a city's standalone row-count check times out but its aggregate still answers, the aggregate's own group totals are checked against the register's minimum instead, so a collapse is still caught. Rows mode stays one city (and one register) per run.

### How status is normalized

Each city publishes its own vocabulary - Chicago writes `OPEN` / `COMPLIED` / `NO ENTRY`, Boston writes `Open` / `Closed` / `Void`, Baltimore writes a single padded letter. Every measured value is mapped to `open`, `closed` or left blank, and the untouched value is always in `statusRaw`. A status word that is not in the published mapping is never guessed into `open` or `closed`; in aggregates those blank rows are counted under `unknown`.

Where a register publishes something other than a case status - an inspection result, a building compliance rating - the mapping is described where noted below and `recordKind` says what the row is.

### Coverage notes

- **Chicago**: `building` (2.03M building-code violations) and `ordinance` (824.7k citations from the city's administrative hearings) are **different datasets**. They are never merged into one count.
- **Philadelphia**: violations, investigations and complaints are three linked registers joined by case number where the source publishes one (the case number is present on about a quarter of complaint rows) - a case can appear in all three, so their row counts are not additive. `investigations` maps the inspection outcome (FAILED = open finding, PASSED / CLOSED = closed). `complaints` publishes no status on about 60% of its rows (646,400 of 1,070,781), so a `status` filter there sees a minority of the register; `statusRaw` is blank on those rows. The source publishes projected geocodes (Web Mercator metres) rather than degrees, so `latitude` / `longitude` are left empty for Philadelphia instead of being emitted as wrong numbers.
- **New Orleans**: six registers at five different grains (case, violation line, inspection, hearing judgment, abatement). Violations and inspections publish no case status; there `status` is blank by design. Hearings map `Guilty*` / `Dismissed*` to closed and `Reset*` to open.
- **Detroit**: `compliance` is a building compliance rating (RED / YELLOW / GREY / GREEN), not a case status - RED and YELLOW are open, GREEN is closed, GREY is unknown, and the rating itself is preserved in `statusRaw`. `demolition` maps the inspection result (FAIL / Work not complete / Hold / Scheduled = open; Passed / OK / DONE / Approved / Cancelled = closed). `rental` records a registration and carries no status.
- **NYC DOB** (`corpus: dob`): building violations issued by the Department of Buildings - a different register from HPD housing violations, never merged with it. Status comes from the source's own `violation_category` (ACTIVE / DISMISSED / Resolved); one value that carries no outcome marker stays blank. The register publishes no ZIP or city column, and the parcel key is the **BIN**, not a BBL. Issue dates are stored as `YYYYMMDD` text, so a few dozen malformed values (a null, pre-1900 sentinels such as `Y9990120`, non-date strings) carry no `openedDate`. The street column is padded to fixed width ("WEST   43 STREET"); an address filter is matched token by token - a leading house number is anchored exactly, a bare number must be a whole word (so `43` does not match `143 STREET`), and a partial street name still works.
- **Austin**: `case_type` and `department` are the same on every row, so this register publishes no `category` dimension; the short violation type is in `description`.
- **Seattle**: `category` is the record type (Complaint / Notice of Violation / Citation / Tenant Relocation / Unfit Building); `description` carries the subtype and the free-text complaint.
- **Columbus**: the layer publishes no last-edit stamp, so freshness is not checked for this register (the row-count floor still is).
- **Cleveland**: `status` comes from the source's `ACTIVE_VIOLATION` flag (Yes = open, No = closed). The source's 40+ value `RECORD_STATUS` is a workflow stage, not a case status, and is not used. The address is one string that already contains city and ZIP ("3291 W 54TH ST, CLEVELAND, OH, 44102"). Only about 36% of rows carry a parent case id; the rest are standalone violation notices, so `caseId` is blank there.
- **Address matching**: registers that store the address in parts (NYC, San Francisco, Boston) match a house number, a street name or a full address typed in any order - `243 EAST 51 STREET` (NYC) and `238 MARKET ST` (Boston) both work. The parts are matched individually, and the whole string is matched as well (New York and San Francisco) or token by token (Boston, whose SQL endpoint does not allow the string-concat function).
- **Boston**: the city publishes the date of the latest status change, not an issue date - `openedDate`, `eventDate` and (for closed rows) `closedDate` all come from that timestamp.
- **Mesa**: the source stores its status strings in a 19-character field; `Closed Duplicate Ca` is the source's complete value, not a truncation made here.
- **Dates outside 1900-01-01 ... about a year ahead are dropped.** Several of these systems carry junk sentinels (`6111-12-01`, `8535-09-25`); they never reach the output. Scheduled hearings and inspections a few months out are kept.
- **Not included**: Kansas City and Montgomery County (AL) code-violation feeds are excluded because the source systems stopped updating - KC's last dataset edit was months behind and Montgomery publishes no address field.
- Row counts are per register and are not comparable across registers: the same case can produce one violation row in one city and an inspection, a hearing and an abatement row in another.

### Examples

Newest open housing violations in New York:

```json
{ "jurisdiction": "nyc", "status": "open", "maxResults": 100 }
```

One Philadelphia parcel's violation history:

```json
{ "jurisdiction": "philly", "parcelId": "365330", "maxResults": 200 }
```

Detroit blight tickets on one street:

```json
{ "jurisdiction": "detroit", "address": "Grand River", "maxResults": 100 }
```

How open / closed splits in Chicago building violations:

```json
{ "jurisdiction": "chicago", "mode": "aggregate", "groupBy": "status" }
```

Which of the fifteen cities carries the most open violations:

```json
{ "jurisdiction": "all", "mode": "aggregate", "groupBy": "status" }
```

Underwriting screen - every open violation at one address, across the city register:

```json
{ "jurisdiction": "nyc", "address": "243 EAST 51 STREET", "status": "open", "maxResults": 200 }
```

Tenant screening - the newest 500 rows of the enforcement trail behind one NYC block and lot (this lot holds ~9,691 records; raise `maxResults` or page with `dateFrom` for the rest):

```json
{ "jurisdiction": "nyc", "parcelId": "2028820229", "maxResults": 500 }
```

The same screen in San Francisco, typed as a postal address:

```json
{ "jurisdiction": "sf", "address": "3342 MISSION ST", "maxResults": 100 }
```

A Boston address, where the house number, street and suffix are separate source columns:

```json
{ "jurisdiction": "boston", "address": "238 MARKET ST", "maxResults": 100 }
```

NYC building violations (DOB, a separate register from HPD) at one address - the street is stored padded, token matching handles it:

```json
{ "jurisdiction": "nyc", "corpus": "dob", "address": "2284 EAST 65 STREET", "status": "open", "maxResults": 100 }
```

One known record by its id:

```json
{ "jurisdiction": "baltimore", "recordId": "58127432" }
```

Chicago ordinance citations by violation date:

```json
{
  "jurisdiction": "chicago",
  "corpus": "ordinance",
  "dateFrom": "2026-01-01",
  "dateTo": "2026-09-30",
  "maxResults": 500
}
```

### Output fields

| Field | Meaning |
|---|---|
| `jurisdiction`, `jurisdictionName`, `state` | Which register answered, and its state |
| `corpus`, `recordKind`, `source`, `sourceUrl` | The register, the grain of the row, and the upstream dataset |
| `recordId`, `caseId`, `relatedId` | Source identifiers - record, case and the secondary key (building id, parcel account, ticket) |
| `address`, `city`, `zip`, `parcelId`, `parcelScheme`, `latitude`, `longitude` | Where the property is; `parcelScheme` names the key (BBL, BIN, OPA_PARCEL, BLOCK_LOT, DETROIT_PARCEL, PARCEL, GPIN, GEO_PIN) |
| `violationCode`, `description`, `category` | What was cited, and the source's own category field |
| `statusRaw`, `status`, `resolution` | The source's status word, the normalized status, and the outcome where one is published (PAID, ABATED, CORRECTED, DISMISSED, ...) |
| `openedDate`, `closedDate`, `eventDate`, `lastModified` | Dates as the source defines them; `closedDate` is filled only when the row's normalized status is `closed`; junk values are dropped |
| `fineAmount`, `balanceDue` | Fines and outstanding balance where the source publishes money |
| `ownerName` | Only where the source itself publishes a property owner (Philadelphia, Detroit) |
| `sourceUpdatedAt`, `platform` | When the dataset was last edited upstream, and its platform |
| `mode`, `groupBy`, `groupKey`, `groupCount` | Present on every row; aggregate rows carry the group key and count |

### Data sources and rights

Every register is a public open-data release from the issuing city: NYC Open Data, Chicago Data Portal, Philadelphia's L\&I open data, New Orleans Open Data, DataSF, Baltimore City open data, Cincinnati Open Data, Analyze Boston, Detroit's BSEED open data, Mesa Open Data, Norfolk Open Data, Austin's open data hub, Seattle Open Data, Columbus GIS Open Data and Cleveland Open Data. All come from the cities' own Socrata, ArcGIS or CKAN endpoints. Records are public property-enforcement records; tenant and complainant names are not included.

Measured 2026-11-22. Counts and vocabularies are re-checked against the sources, and a register whose row count collapses, or whose dataset stops updating when the source provides a last-edit stamp, fails the run loudly instead of returning an empty result.

### Use it from an AI agent (MCP)

Connect any MCP client to `https://mcp.apify.com/?tools=j0401/us-code-violations` to load this dataset as a single tool beside the tools you already have - same records, same per-record pricing.

# Actor input Schema

## `jurisdiction` (type: `string`):

nyc (default) = NYC HPD housing violations, or DOB building violations (corpus). chicago = building violations or ordinance citations (corpus). philly = L\&I violations / investigations / complaints. nola = six code-enforcement corpora. sf = building notices of violation. baltimore = ECB citations. cincinnati = code cases. boston = Public Works or Building violations. detroit = blight tickets / rental / compliance / demolition. mesa = code cases. norfolk = complaint / inspection events. austin = code complaint cases. seattle = code complaints and violations. columbus = code enforcement cases. cleveland = issued building violations. all = every city's default register in one aggregate (mode=aggregate only).

## `corpus` (type: `string`):

Which register inside the jurisdiction. Blank uses that jurisdiction's default. nyc: violations (HPD, default) / dob (DOB building violations). chicago: building (default) / ordinance. philly: violations (default) / investigations / complaints. nola: cases (default) / violations / inspections / hearings / abatements / pipeline. boston: pw (default) / building. detroit: blight (default) / rental / compliance / demolition. Every other jurisdiction has exactly one corpus; naming it is accepted, any other name is rejected.

## `mode` (type: `string`):

rows = matching records, newest source event first (exception: Detroit blight filtered by address or ZIP comes back in source order, because that layer rejects a date sort on a filtered set). aggregate = one count row per group.

## `groupBy` (type: `string`):

Dimension for mode=aggregate. status folds each source's own vocabulary into open / closed / unknown. Not every corpus publishes every dimension; an unavailable one is rejected with the list of available dimensions. With jurisdiction=all, a city that does not publish the dimension - or whose source cannot answer in time - is left out of that run and named in the log, while the rest of the comparison still returns; a filter that a city cannot apply still fails the run.

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

Normalized case status. Blank returns every status. Corpora that publish no case status (several New Orleans registers, Detroit rental registrations) reject this filter rather than guess.

## `address` (type: `string`):

Substring match on the street address. Registers that store the address in parts (NYC, San Francisco, Boston) match a house number, a street name or a full address in any order, e.g. '243 EAST 51 STREET' (NYC) or '238 MARKET ST' (Boston). Wildcards are rejected.

## `zip` (type: `string`):

Exact postal code, on registers that publish one (NYC, Philadelphia, San Francisco, New Orleans cases / hearings / pipeline, Boston, Detroit, Mesa, Austin, Seattle). Accepts ZIP+4 ("12345-6789"); matched on the 5-digit core. Chicago, Baltimore, Cincinnati, Norfolk, Columbus, Cleveland and NYC DOB violations have no ZIP field and the filter is rejected for them.

## `caseId` (type: `string`):

Exact case number as returned in the `caseId` field (case, docket, citation or complaint number depending on the register).

## `recordId` (type: `string`):

Exact record identifier as returned in the `recordId` field (violation number, ticket number, primary key) - use it to fetch one known row.

## `parcelId` (type: `string`):

Exact parcel key: BBL (NYC HPD), BIN (NYC DOB), OPA parcel (Philadelphia), block/lot written 0293/038 (San Francisco, Baltimore), parcel id (Detroit), parcel number (Mesa, Austin, Columbus, Cleveland), GPIN (Norfolk), GEO_PIN (New Orleans cases / hearings / pipeline).

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

ISO date (YYYY-MM-DD) on the jurisdiction's primary date column (opened / filed / inspection date). Inclusive.

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

ISO date (YYYY-MM-DD) on the same column. Inclusive.

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

Records to return in rows mode (default 50). In aggregate mode every group is returned; a dimension with an extreme number of groups fails the run instead of being truncated.

## Actor input object example

```json
{
  "jurisdiction": "nyc",
  "corpus": "",
  "mode": "rows",
  "groupBy": "status",
  "status": "",
  "maxResults": 50
}
```

# Actor output Schema

## `recordsUrl` (type: `string`):

Code-violation / enforcement records - as JSON

## `datasetUrl` (type: `string`):

No description

## `runUrl` (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("j0401/us-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 = {}

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

```

## MCP server setup

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