# NYC DOB Complaints - Building Complaints & Outcomes (`j0401/nyc-dob-complaints`) Actor

NYC Department of Buildings complaints (3,153,645 rows, 1988-2026): premises, BIN, community board and borough, complaint category with DOB's description, handling unit, disposition and dates. Search, aggregate by category or year, or roll up one building.

- **URL**: https://apify.com/j0401/nyc-dob-complaints.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, 88.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.03 / 1,000 nyc dob complaint 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

## NYC DOB Complaints - 3,153,645 Building Complaint Records

New York City Department of Buildings complaints received as a queryable
dataset: **3,153,645 source rows (3,153,639 distinct complaint numbers) from
1988 to 2026** (one row carries a 1988 date), measured 14 November 2026
(dataset stamp 13 November 2026).
Each row is one complaint about a building: the premises, the complaint
category, the DOB unit that handled it, the disposition and the dates. The file
carries no complainant, owner or tenant identity.

### Low cost

**From $0.00005 per record, down to $0.00003 at Gold.** Pay only for the
records you receive - the full file stays queryable and you are never billed
for the scan behind it.

### What you get per record

| field | meaning |
|---|---|
| `complaintNumber` | the DOB complaint number (numeric or alphanumeric, e.g. `3A43468`) |
| `status` | `CLOSED` (3,132,790) or `ACTIVE` (20,855) |
| `address`, `houseNumber`, `houseStreet` | the premises as published |
| `zip`, `borough`, `communityBoard` | ZIP, borough and board; borough is derived from the board's first digit |
| `bin` | Building Identification Number - joins to DOB permits, violations and other NYC building data |
| `category`, `categoryDescription` | the DOB complaint category and its published description |
| `dobUnit` | the DOB unit that handled it (QNS., BKLYN, MAN., BRONX, ST.IS, ELCTR, PLUMB, BOILR, ...) |
| `dispositionCode`, `dispositionDescription` | what DOB did, with the published disposition text |
| `dateEntered`, `enteredYear`, `enteredMonth` | when the complaint was received |
| `inspectionDate`, `dispositionDate` | when it was inspected and disposed of |
| `dobRunDate` | the city's file stamp |
| `specialDistrict` | IBZ, SCD, HY, GC or WC (populated on 17,086 rows) |
| `totalMatched` | complaints matching the filters |

### Search it

- **Building** - `bin="2011164"` with `mode="building"` rolls up that building's
  full complaint history; `zip="11226"` screens an area.
- **Complaint type** - `category="45"` (illegal conversion, 427,649 rows),
  `"05"` (permit none, 419,830), `"63"` (elevator defective, 148,165),
  `"73"` (failure to maintain, 124,660).
- **Outcome** - `dispositionCode="I2"` (no violation warranted, 1,232,726),
  `"A8"` (ECB violation served, 353,229), `hasDisposition="no"` for the 9,069
  open ones.
- **Where** - `borough="Brooklyn"`, `communityBoard="302"`,
  `specialDistrict="IBZ"`, `street="FORDHAM"`.
- **When** - `year=2025`, `month=7`, or both.

### Example inputs

**Every complaint in Brooklyn** (960,647 rows - use a filter and `maxResults`)

```json
{ "borough": "Brooklyn", "maxResults": 100 }
```

**Illegal-conversion complaints in Brooklyn** (98,328 rows)

```json
{ "category": "45", "borough": "Brooklyn", "maxResults": 100 }
```

**One complaint by number**

```json
{ "mode": "profile", "complaintNumber": "3A43468" }
```

A complaint number is normally unique. Six numbers in the file appear twice:
four pairs are identical and delivered once, and two are different complaints
sharing a number - both are returned, newest first.

**One building's full complaint history**

```json
{ "mode": "building", "bin": "2011164" }
```

Returns **every** complaint recorded against that BIN (up to a 5,000-row
ceiling - a larger building is refused rather than truncated, and `maxResults`
does not clip this mode), each row carrying
`profileComplaints`, `profileOpen`, `profileClosed`, `profileFirstComplaint`
and `profileLastComplaint`. `mode="building"` takes exactly one `bin` and no
other filter.

**Complaints entered in 2025** (119,413 rows)

```json
{ "year": 2025, "maxResults": 200 }
```

**Page through 2025** (the second 5,000-row page)

```json
{ "year": 2025, "maxResults": 5000, "offset": 5000 }
```

### Aggregate it

```json
{ "mode": "aggregate", "groupBy": "year" }
```

Complaints by entered year: **2023 131,283 / 2024 124,927 / 2025 119,413 /
2026 115,881** (the four most recent of the 39 groups the aggregate returns,
1988-2026). `year` and `month` aggregates are built from one grouped query over
the text date column (about 15-25 seconds on the full file - the source has no
date type, so SoQL cannot truncate it); every other dimension is a single
grouped query. `metric="buildings"` applies to the non-time dimensions.

```json
{ "mode": "aggregate", "groupBy": "category" }
```

Top complaint categories: `45` illegal conversion 427,649 / `05` permit none
419,830 / `63` elevator defective 148,165 / `73` failure to maintain 124,660 /
`30` building shaking 94,876 / `31` certificate of occupancy none 85,014 /
`04` after-hours work 84,258 / `59` defective electrical wiring 83,250 / `83`
work contrary to plans 80,042 / `6S` single elevator device 69,909.

`groupBy` = `category`, `status`, `dispositionCode`, `communityBoard`,
`dobUnit`, `zip`, `specialDistrict`, `borough`, `year` or `month`.
`metric` = `count` or `buildings` (distinct BINs) - use `buildings` when the
question is "how many buildings", not "how many complaints". The file covers
**526,589 distinct BINs**.
With `groupBy=borough` the buildings metric counts distinct BINs in each
borough separately (one query per borough, so this combination takes about a
minute); each group is that borough's true distinct count. A handful of BINs
are filed under more than one borough, so the five groups need not add up to
the file-wide 526,589.

By borough: Brooklyn 960,647 / Queens 951,131 / Manhattan 673,494 / Bronx
394,593 / Staten Island 173,438 - plus 342 rows with no community board.

### Category and disposition dictionaries

```json
{ "mode": "codes" }
```

Returns the 197 category codes and 159 disposition codes present in the file
with their counts (this mode takes no filters). Descriptions come from DOB's published
**Complaint Categories** list (Rev. 09/21, 180 codes) and the city's
**Building Complaint Disposition Codes** dataset (160 codes). 19 category codes
in the feed are newer than the published list and carry an empty
`categoryDescription`; **39 disposition codes (26,041 rows)** are likewise not
in the published dictionary and carry an empty `dispositionDescription`. The
code and count are always present.

### Row grain and how to read it

- **One row = one complaint**, identified by `complaintNumber` - except that
  six numbers appear twice. Four pairs are identical (delivered once) and two
  are different complaints sharing a number (both delivered). A full pull is
  **3,153,641 unique rows**; `matched` in the run log still reports the 3,153,645
  source rows.
- **One run delivers at most 5,000 rows.** Page with `offset` - the order is
  pinned to the entered date and then the record id, so consecutive pages do
  not overlap or skip. A month with more than 5,000 complaints (22 of the last
  23 months) is paged the same way or narrowed with `borough`/`category`.
- **All dates are text in MM/DD/YYYY** - the source has no date type. Sorting
  is therefore month-major across years: **set `year` when you need a
  chronological feed**, and use `year`/`month` rather than arbitrary date
  ranges. (SoQL on this dataset offers no date parsing function.)
- **`unit` is not an apartment.** It is the DOB unit/bureau handling the
  complaint. The apartment number is not published in this dataset.
- **Borough is derived** from the first digit of `community_board`: 1
  Manhattan, 2 Bronx, 3 Brooklyn, 4 Queens, 5 Staten Island. 342 rows have no
  board and therefore no borough.
- **9,069 rows have no disposition code or date** - mostly still `ACTIVE`.
  23,284 rows have no ZIP.
- **Category descriptions are not in the feed.** They are joined from DOB's
  published list; a code missing from that list is delivered with an empty
  description rather than a guess.
- This is the intake and disposition record, not the inspection finding. For
  the violation itself use DOB violations; for the adjudication use OATH.
- A cold run verifies the whole 3.1M-row corpus before delivering anything, so
  the first call can take up to about a minute; you are still billed only per
  delivered record, never for the guard.
- When `maxResults` or the run-level charge cap stops a query, the dataset also
  carries one unbilled `_meta` row with `truncated`, `delivered` (a lower bound
  when `stopReason="charge-limit"`), `totalMatched` and `stopReason`.

### Source and licence

New York City Department of Buildings, published on the
[NYC Open Data portal](https://data.cityofnewyork.us/Housing-Development/DOB-Complaints-Received/eabe-havv)
(public open data). Category descriptions from DOB's
[Complaint Categories](https://www.nyc.gov/assets/buildings/pdf/complaint_category.pdf)
list; disposition descriptions from the city's
[Building Complaint Disposition Codes](https://data.cityofnewyork.us/Housing-Development/Building-Complaint-Disposition-Codes/6v9u-ndjg)
dataset.

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

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

# Actor input Schema

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

rows = complaints (default). aggregate = one row per group; year and month are built from one grouped query over the text date column. profile = the complaint (or the two different complaints that share a number) by complaint number. building = every complaint at one BIN with its summary (bin required). codes = the category and disposition dictionaries with counts.

## `complaintNumber` (type: `string`):

The DOB complaint number, e.g. "3A43468" or "3619872" (letters are matched upper-case).

## `bin` (type: `string`):

Building Identification Number.

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

Exact 5-digit ZIP code. Accepts ZIP+4 ("12345-6789"); matched on the 5-digit core.

## `communityBoard` (type: `string`):

Board id as published, e.g. "302" (3 = Brooklyn).

## `borough` (type: `string`):

Derived from the first digit of the community board. 342 rows have no board and no borough.

## `specialDistrict` (type: `string`):

IBZ, SCD, HY, GC or WC.

## `category` (type: `string`):

DOB complaint category, e.g. "45" (illegal conversion), "05" (permit none), "4B". The feed has 197 codes.

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

CLOSED (3,132,790 rows) or ACTIVE (20,855).

## `dispositionCode` (type: `string`):

Exact code, e.g. "I2" or "A8". 160 codes are published; 159 appear in the feed.

## `dobUnit` (type: `string`):

The unit that handled the complaint: QNS., BKLYN, MAN., BRONX, ST.IS, ELCTR, PLUMB, BOILR, ...

## `street` (type: `string`):

Case-insensitive substring on the street name, e.g. "FORDHAM".

## `houseNumber` (type: `string`):

Exact house number as published, e.g. "320" or "87-77".

## `year` (type: `integer`):

Exact year, 1988-2026. Sorting is chronological only when a year is set (the source stores dates as text).

## `month` (type: `integer`):

1-12. Combine with year for a single month.

## `hasDisposition` (type: `string`):

no = 9,069 rows with no disposition code (mostly still active).

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

Used only with mode=aggregate. Default category.

## `metric` (type: `string`):

count = complaints; buildings = distinct BINs.

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

Records delivered in rows mode (default 50, max 5000). building returns the whole building history up to its 5,000 ceiling and profile returns the matching complaint(s) regardless of this value; aggregate and codes ignore it. 0 uses the default 50.

## `offset` (type: `integer`):

Rows to skip in rows mode (default 0). Use it to page through a filter whose match count is above the 5,000-row run ceiling, e.g. maxResults=5000 with offset=5000 for the second page. Ignored by the other modes.

## Actor input object example

```json
{
  "mode": "",
  "borough": "",
  "status": "",
  "hasDisposition": "",
  "groupBy": "",
  "metric": "",
  "maxResults": 50,
  "offset": 0
}
```

# Actor output Schema

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

NYC DOB complaints 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/nyc-dob-complaints").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/nyc-dob-complaints").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/nyc-dob-complaints --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,j0401/nyc-dob-complaints"
        }
    }
}
```

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/aTn48gVyHmXGvW1en/builds/thg0vj3kBLq6bRV3r/openapi.json
