# US Building Permits Scraper — Construction & Contractor Leads (`olvi_tech/us-building-permits-contractors`) Actor

Fast, browser-free US building permits scraper & construction leads extractor. Pulls live municipal permits and deduplicated, activity-scored contractor leads (solar, roofing, HVAC, electrical, ADU) from 11 official Socrata open-data portals.

- **URL**: https://apify.com/olvi_tech/us-building-permits-contractors.md
- **Developed by:** [OLVI TECH](https://apify.com/olvi_tech) (community)
- **Categories:** Lead generation, Real estate, MCP servers
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.50 / 1,000 building permit rows

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?

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 Building Permits Scraper — Construction & Contractor Leads

Fast, browser-free Apify Actor extracting live US municipal building permits, construction leads, and deduplicated, activity-scored contractor leads directly from **11 official Socrata SODA 2.1 open-data portals**.

- **Zero browser / zero proxy overhead (256 MB RAM):** pure HTTPS JSON extraction with native `fetch`, automatic pagination, polite rate-limiting, and retries.
- **Two output modes:**
  1. `permits` — flat 19-field normalized building permit records across all **11 cities**, ready for CSV, Excel, Clay, HubSpot, Make, or n8n.
  2. `contractors` — deduplicated active contractors across **9 cities with contractor data** (LA & SF are skipped automatically) with trade classification (`solar`, `roofing`, `hvac`, `electrical`, `plumbing`, `adu`, `remodel`, `commercial`, `other`), valuation totals, sample job addresses, phone numbers (where published), and an `activityScore` (`0..100`).
- **Delta scheduling (`deltaMode`):** built-in Key-Value Store watermarks prevent duplicate records across daily/weekly scheduled runs.

### Pay-per-Event Pricing

| Event | Price | Unit |
| :--- | :--- | :--- |
| `apify-actor-start` | `$0.00005` | Per Actor start (platform-managed, 256 MB default) |
| `permit-row` | `$0.0025` | Per permit row (`$2.50 / 1,000 permits`) |
| `contractor-lead` | `$0.01` | Per unique active contractor lead (`$10.00 / 1,000 leads`) |

Both `maxResults` and Apify's `ACTOR_MAX_TOTAL_CHARGE_USD` spending cap are enforced strictly before every chunk push so runs never over-bill.

### Supported Cities (11 Official Portals)

| City ID | Jurisdiction | Portal Domain | Dataset ID | Contractor Data |
| :--- | :--- | :--- | :--- | :--- |
| `austin` | Austin, TX | `data.austintexas.gov` | `3syk-w9eu` | Name + Phone |
| `chicago` | Chicago, IL | `data.cityofchicago.org` | `ydr8-5enu` | Name + Phone |
| `nyc` | New York, NY | `data.cityofnewyork.us` | `rbx6-tga4` | Name |
| `seattle` | Seattle, WA | `data.seattle.gov` | `76t5-zqzr` | Name |
| `mesa` | Mesa, AZ | `citydata.mesaaz.gov` | `dzpk-hxfb` | Name |
| `new_orleans` | New Orleans, LA | `data.nola.gov` | `72f9-bi28` | Name |
| `cincinnati` | Cincinnati, OH | `data.cincinnati-oh.gov` | `uhjb-xac9` | Name |
| `baton_rouge` | East Baton Rouge, LA | `data.brla.gov` | `7fq7-8j7r` | Name |
| `marin_county` | Marin County, CA | `data.marincounty.gov` | `mkbn-caye` | Name |
| `la` | Los Angeles, CA | `data.lacity.org` | `pi9x-tg5x` | Permits only |
| `sf` | San Francisco, CA | `data.sfgov.org` | `i98e-djp9` | Permits only |

Pass `"cities": ["all"]` to query every supported portal in one run (in `contractors` mode, `la` and `sf` are automatically skipped with a notice in `RUN_SUMMARY`).

### Example Inputs

#### 1. Recent Solar & Roofing Permits

```json
{
  "mode": "permits",
  "cities": ["austin", "seattle", "chicago"],
  "daysBack": 14,
  "trades": ["solar", "roofing"],
  "minValuation": 10000,
  "maxResults": 250
}
```

#### 2. Ranked Active Contractor Leads

```json
{
  "mode": "contractors",
  "cities": ["austin", "seattle", "cincinnati", "baton_rouge"],
  "daysBack": 30,
  "maxPermitsPerCity": 1000,
  "maxResults": 100
}
```

#### 3. Incremental Daily Delta Run

```json
{
  "mode": "permits",
  "cities": ["all"],
  "daysBack": 7,
  "deltaMode": true,
  "deltaStoreName": "us-permits-delta-state",
  "maxResults": 500
}
```

### Output Schemas

#### `NormalizedPermit` (`mode: "permits"`)

```json
{
  "cityId": "austin",
  "city": "Austin",
  "state": "TX",
  "permitNumber": "2026-145001 BP",
  "permitType": "Building Permit",
  "workClass": "Remodel",
  "trade": "solar",
  "description": "Residential solar panel array install",
  "status": "Active",
  "issuedDate": "2026-11-18",
  "appliedDate": "2026-11-12",
  "address": "1200 E 6TH ST",
  "zip": "78702",
  "lat": 30.2649,
  "lng": -97.7289,
  "valuation": 35000,
  "contractorName": "SunPower Texas LLC",
  "contractorPhone": "512-555-0192",
  "sourceUrl": "https://abc.austintexas.gov/permit/2026-145001"
}
```

#### `ContractorLead` (`mode: "contractors"`)

```json
{
  "contractorKey": "austin::SUNPOWER TEXAS",
  "contractorName": "SunPower Texas LLC",
  "cityId": "austin",
  "city": "Austin",
  "state": "TX",
  "primaryTrade": "solar",
  "trades": ["solar", "electrical"],
  "permitCount": 4,
  "totalValuation": 145000,
  "lastPermitDate": "2026-11-18",
  "phone": "512-555-0192",
  "sampleAddresses": ["1200 E 6TH ST", "401 CONGRESS AVE"],
  "activityScore": 87
}
```

Every run also writes a `RUN_SUMMARY` record to the default Key-Value Store containing per-city fetch/emission stats, error diagnostics, and open-data attributions.

### Local Development & Verification

```bash
npm test                                    # Unit test suite (offline, Vitest)
npm run build                               # TypeScript compilation
npm run smoke -w apps/apify-us-permits      # Live 11-city Socrata health check
ACTOR_TEST_PAY_PER_EVENT=true npm start -w apps/apify-us-permits
```

### Open-Data Attributions

Data is retrieved in real time from public municipal open-data portals operated under their respective public-domain / open-data terms:

- City of Austin Open Data Portal (`3syk-w9eu`)
- City of Chicago Data Portal (`ydr8-5enu`)
- NYC Open Data / Department of Buildings (`rbx6-tga4`)
- City of Los Angeles Open Data / LADBS (`pi9x-tg5x`)
- City of Seattle Open Data Portal (`76t5-zqzr`)
- DataSF / San Francisco Department of Building Inspection (`i98e-djp9`)
- City of Mesa Open Data Portal (`dzpk-hxfb`)
- City of New Orleans Open Data (`72f9-bi28`)
- Open Data Cincinnati (`uhjb-xac9`)
- Open Data BR / East Baton Rouge (`7fq7-8j7r`)
- County of Marin Open Data Portal (`mkbn-caye`)

# Actor input Schema

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

Choose 'permits' for individual normalized building permit rows (all 11 cities) or 'contractors' for deduplicated, activity-scored active contractor leads (9 cities with contractor data; LA and SF are skipped automatically).

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

Select one or more supported US municipal open-data portals, or choose 'All 11 US Cities'. Note: Los Angeles and San Francisco portals publish permits only (no contractor names).

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

Number of days back from today to query (clamped 1-365). Ignored if 'Date From' is provided.

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

Optional explicit ISO start date (YYYY-MM-DD). Overrides Days Back when set.

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

Optional case-insensitive keywords matched against permit descriptions, work types, and contractor fields.

## `trades` (type: `array`):

Optional list of classified construction trades to include. Leave empty to include all trades.

## `minValuation` (type: `number`):

Minimum project valuation in USD. Permits without reported valuation are excluded when > 0.

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

Hard cap on total output items billed and pushed to the dataset.

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

Upper scan ceiling per city portal (especially useful in 'contractors' mode to control aggregation depth).

## `deltaMode` (type: `boolean`):

When enabled, tracks per-city watermarks in a named Key-Value Store so scheduled runs emit only new permits without duplicates.

## `deltaStoreName` (type: `string`):

Named Apify Key-Value Store used to persist per-city watermarks when Delta Mode is enabled.

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

Optional Socrata X-App-Token for higher municipal API throughput. Falls back to SOCRATA_APP_TOKEN environment variable.

## Actor input object example

```json
{
  "mode": "permits",
  "cities": [
    "austin",
    "chicago",
    "nyc",
    "seattle"
  ],
  "daysBack": 14,
  "minValuation": 0,
  "maxResults": 200,
  "maxPermitsPerCity": 2000,
  "deltaMode": false,
  "deltaStoreName": "us-permits-delta-state"
}
```

# Actor output Schema

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

Normalized building permits (mode='permits') or deduplicated active contractor leads (mode='contractors').

## `runSummary` (type: `string`):

Per-city fetch/emission statistics, error diagnostics, and official open-data portal attributions.

# 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("olvi_tech/us-building-permits-contractors").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("olvi_tech/us-building-permits-contractors").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 olvi_tech/us-building-permits-contractors --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,olvi_tech/us-building-permits-contractors"
        }
    }
}
```

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/Vo2mbiFluKh0yDJ9Q/builds/4PkLBFaLeeghdbwrh/openapi.json
