# Building Permit Leads - Denver, Chicago, Austin, Seattle, SF (`dennydevelops/building-permit-leads`) Actor

New building permits from official city open-data portals in one clean schema: work class (roofing, solar, remodel, new build...), address, valuation, issue date and contractor. Owner names removed. Only new since last run.

- **URL**: https://apify.com/dennydevelops/building-permit-leads.md
- **Developed by:** [Musedenny](https://apify.com/dennydevelops) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 permits

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

## Building Permit Leads – Denver, Chicago, Austin, Seattle, San Francisco

Fresh **building permits from official city open-data portals**, normalised into one clean schema so you can filter by **work class** (roofing, solar & battery, HVAC, remodel, new build, pool, demolition…), property type, valuation and ZIP. Schedule it daily and get **only permits that are new since your last run**.

Built for contractors, solar and roofing installers, suppliers, lenders and home-service marketers.

- **Official sources only**: Socrata (Chicago, Austin, Seattle, San Francisco) and ArcGIS (Denver) open-data APIs. No scraping, no logins.
- **One schema for every city**: permit ID, type, work class, residential/commercial, description, status, address, ZIP, neighbourhood, coordinates, valuation, issue/applied dates, contractor company and trade, housing units, link to the official record.
- **Privacy**: owner, applicant and individual names and phone numbers are never output. Only contractor *companies* (where the city publishes them). "Homeowner" entries become `ownerBuilder: true`.
- **Per-city adapters**, so more cities can be added quickly.

### Cities

| City | Source | Contractor | ZIP | Description |
|---|---|---|---|---|
| Denver, CO | Residential + commercial construction permits (ArcGIS) | ✅ | – | – (permit class only) |
| Chicago, IL | Building Permits `ydr8-5enu` | ✅ (contractor contacts only) | – | ✅ |
| Austin, TX | Issued Construction Permits `3syk-w9eu` | ✅ company + trade | ✅ | ✅ |
| Seattle, WA | Building Permits `76t5-zqzr` | – | ✅ | ✅ |
| San Francisco, CA | Building Permits `i98e-djp9` | – | ✅ | ✅ |

### Input

```json
{
  "cities": ["denver", "austin"],
  "workClasses": ["roofing", "solar"],
  "categories": ["residential"],
  "minValuation": 5000,
  "issuedWithinDays": 7,
  "onlyNew": true
}
```

| Field | Default | Description |
|---|---|---|
| `cities` | denver | Any of `denver`, `chicago`, `austin`, `seattle`, `san-francisco`. |
| `workClasses` | all | `solar` (incl. battery storage), `roofing`, `demolition`, `pool`, `sign`, `hvac`, `plumbing`, `electrical`, `new_build`, `addition`, `remodel`, `other`. |
| `categories` | all | `residential`, `commercial`, `unknown`. |
| `minValuation` | – | Minimum declared job value in USD. |
| `zipCodes` | – | ZIPs or prefixes (cities that publish ZIP). |
| `keywords` | – | Any word in description / permit type. |
| `requireContractor` | false | Only permits with a contractor company. |
| `issuedWithinDays` | 7 | Look-back window by issue date. |
| `onlyNew` | false | **Turn on for daily schedules:** each permit is returned once per filter set. |
| `maxPermitsPerCity` | 5000 | Cap per city per run. |
| `socrataAppToken` | – | Optional, for very large pulls. |

### Output (example, shortened)

```json
{
  "city": "chicago",
  "permitId": "B200517912",
  "permitType": "PERMIT – EXPRESS PERMIT PROGRAM / Small-Scale Solar PV System",
  "workClass": "solar",
  "category": "residential",
  "description": "INSTALLATION OF ROOF MOUNTED SOLAR PV SYSTEM …",
  "status": "ACTIVE",
  "address": "6543 S TROY ST, Chicago, IL",
  "zip": null,
  "neighborhood": "66",
  "latitude": 41.77,
  "longitude": -87.69,
  "valuation": 32230.0,
  "issueDate": "2026-10-29",
  "appliedDate": "2026-10-27",
  "contractor": "SUNRUN INSTALLATION SERVICES INC",
  "contractorTrade": "Electrical",
  "housingUnits": null,
  "ownerBuilder": false,
  "link": "https://webapps1.chicago.gov/buildingrecords/home?permit=B200517912",
  "source": "data.cityofchicago.org/ydr8-5enu",
  "firstSeenAt": "2026-11-01T09:00:00Z"
}
```

`workClass` is derived from each city's permit type and description with keyword rules (specific trades like solar and roofing win). It is a best-effort label; `permitType` and `description` hold the city's own wording.

### Pricing (pay per event + usage)

| Event | Price | When |
|---|---|---|
| `apify-actor-start` | $0.001 | Apify built-in event, charged once per run (per GB of memory above 1 GB). Covers start-up cost and deters empty runs. |
| `records-scanned` | $0.0005 | Each started block of 1,000 permit records read from a city portal, matching or not. |
| `permit` | $0.0015 | One new building permit matching your filters. |

Example: a daily roofing + solar watch in two cities (a few thousand records scanned, 20 matches) ≈ $0.001 + $0.002 + $0.03 = $0.033 per day. A one-off 7-day pull of all five cities (~2,000 permits) ≈ $3.

Plus Apify platform usage for the run itself (server time), typically **$0.0002–0.0005 per run** because the Actor is lightweight and capped at 512 MB. The run stops cleanly when your maximum cost per run is reached.

### Notes

- Cities publish with a delay of 1–3 days; a 7-day window with `onlyNew` catches late postings without duplicates.
- Valuations are as declared by applicants; some cities record $0–$20 for revisions or trade permits.
- One city's portal being down does not stop the others; the run log and `OUTPUT` record name the failed city.

### Adding a city (developers)

Write a `norm_<city>(row)` function in `src/cities.py` that maps the portal's fields to `base_record(...)`, then register a `SocrataCity(...)` or `ArcGISCity(...)` in `CITIES` and add the key to the input schema enum. Never map owner/applicant fields.

### Local development

```bash
pip install -r requirements.txt pytest pytest-asyncio respx
pytest          # HTTP mocked with recorded portal responses (personal names scrubbed)
python -m src   # reads storage/key_value_stores/default/INPUT.json
```

# Actor input Schema

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

City open-data portals to pull from.

## `workClasses` (type: `array`):

Empty = all. Derived from each city's permit type and description.

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

Empty = all.

## `minValuation` (type: `integer`):

Skip permits with a lower declared job value (or none).

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

ZIP codes or prefixes (e.g. 787). Not available for Chicago/Denver (no ZIP in their data).

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

Match in description or permit type.

## `requireContractor` (type: `boolean`):

Only return permits that list a contractor company.

## `issuedWithinDays` (type: `integer`):

Issued within (days).

## `onlyNew` (type: `boolean`):

Turn ON for scheduled (daily) runs: each item is then returned only once per filter set (state in the named store below). Off = return everything in the time window.

## `maxPermitsPerCity` (type: `integer`):

Maximum number of permits returned per city per run.

## `socrataAppToken` (type: `string`):

Free token from the city's Socrata portal; raises rate limits for very large pulls.

## `stateStoreName` (type: `string`):

State store name.

## Actor input object example

```json
{
  "cities": [
    "denver"
  ],
  "requireContractor": false,
  "issuedWithinDays": 7,
  "onlyNew": false,
  "maxPermitsPerCity": 5000,
  "stateStoreName": "building-permit-leads-state"
}
```

# Actor output Schema

## `results` (type: `string`):

Normalised permits from the selected cities.

## `summary` (type: `string`):

Totals for this run (JSON).

# 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("dennydevelops/building-permit-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("dennydevelops/building-permit-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 dennydevelops/building-permit-leads --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dennydevelops/building-permit-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/4GghknjzbE5lSCm4P/builds/6acTigFdpkij0wkvc/openapi.json
