# US Building Permits (13 Cities) — Contractor Leads (`cherry_hippopotamus/us-building-permits`) Actor

Daily building permits from 13 US cities' official open data, one schema. Filter roofing, solar, HVAC, value, ZIP. Only new permits per run.

- **URL**: https://apify.com/cherry_hippopotamus/us-building-permits.md
- **Developed by:** [Carson Packard](https://apify.com/cherry_hippopotamus) (community)
- **Categories:** Lead generation, Real estate, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 75.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 permits

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 Building Permits (13 Cities) — Contractor Leads

> **Status:** listed on the Apify Store as [US Building Permits (13 Cities) — Contractor Leads](https://apify.com/cherry_hippopotamus/us-building-permits). Pay-per-event pricing below is live.
> This Actor sends anonymous error and usage stats, including the run's input settings (URLs, cities, companies, filters) for debugging. No personal or scraped data is included. URLs are sent without query strings; emails, phone numbers, and secrets are masked. `disableTelemetry` turns this off.

Recently issued building permits from **13 US cities**, pulled from each city's **official open-data API** and normalized into one schema. Filter by category (roofing, solar, HVAC, pool, new construction…), valuation, ZIP, and residential/commercial. Run it on a schedule in **delta mode** to get only permits you have not seen before.

Cities: Chicago, New York, Los Angeles, San Francisco, Seattle, Austin, Dallas, New Orleans, Baton Rouge, Cincinnati, Mesa, Norfolk, Cambridge (MA).

### What you get

One row per permit: `permit_id`, `city`, `state`, `issued_date`, `applied_date`, `status`, `permit_type`, `work_class`, `category`, `description`, `valuation_usd`, `address`, `zip`, `lat`, `lon`, `contractor_name`, `contractor_license`, `residential`, `source_url`, `change_type` (`new`/`seen`), `first_seen`, and more. The full frozen schema is in `SPEC.md`.

**No homeowner personal data.** Owner and applicant names, phone numbers, and emails are never read into the output. Contractor business names and license numbers are public record.

### Quick start

```json
{ "cities": ["austin", "dallas"], "sinceDays": 7, "categories": ["roofing"], "minValuationUsd": 10000 }
```

Schedule daily with `"mode": "delta"` and a `stateStoreName` per task to get only new permits. Under Apify limited permissions, the Actor can create and reuse a named store for your account. If opening that store is forbidden (for example a store with the same name already exists outside this Actor's scope), the run still succeeds: it falls back to the run's default key-value store and records in the status and dataset that delta state was not persisted. Use a new `stateStoreName` so the Actor can create its own store.

### Pricing (pay per event)

Live Store prices. Apify bills the synthetic start event once per GB of run memory (minimum one event). The default run memory is 512 MB, so a typical run is charged one start event. Diagnostic error rows are not billed.

Diagnostic rows (`type: "error"`, never billed) explain anything unusual in a run: a city that could not be fetched, delta state that could not be saved (`reason: "state_not_persisted"`), a city that returned 0 rows in a window where it normally has permits (`reason: "zero_rows"`, for example after a city changes its open-data columns), or a city skipped because the run was close to its timeout (`reason: "time_budget"`; the next delta run picks it up).

| Event | Price | When it is charged |
|---|---|---|
| Actor start (`apify-actor-start`) | $0.01 per start event | Synthetic platform event; not charged again from code |
| `permit` | $0.004 | Each permit row emitted (`new` or `seen`) |
| `permit-enriched` | +$0.004 | Extra charge per row when `enrich` is on |

Set `maxCostUsd` or `maxItems` to cap a run. The Actor stops cleanly when the cap is reached, and unemitted new permits stay pending for the next run.

### How it fetches

Socrata SODA `/resource/` endpoints only, with server-side `$where` date/value filters, at most one request per second per city host (robots.txt `Crawl-delay: 1`), a descriptive User-Agent, and retries with backoff. If a city is down, the run continues with the others and reports the skipped city in the status message.

### Data sources and attribution

Data comes from each city's official open-data portal (see `SOURCES.md` for dataset ids and licenses). Source for Mesa data: **City of Mesa** (data.mesaaz.gov).

City of Chicago data notice (required by the City's Data Terms of Use):

> "This site provides applications using data that has been modified for use from its original source, www.cityofchicago.org, the official website of the City of Chicago. The City of Chicago makes no claims as to the content, accuracy, timeliness, or completeness of any of the data provided at this site. The data provided at this site is subject to change at any time. It is understood that the data provided at this site is being used at one's own risk."

Cities publish on their own schedules (most daily; Los Angeles weekly), so the newest permits can lag by a few days.

### Development

```bash
python3 -m venv .venv && .venv/bin/pip install -r requirements-dev.txt
.venv/bin/python -m pytest -q
.venv/bin/python tools/live_smoke.py austin chicago   # live, public, polite; no Apify
```

# Actor input Schema

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

Cities to pull. Default: all 13. Data comes from each city's official open-data portal (Socrata API).

## `sinceDays` (type: `integer`):

Ignored when Date from is set.

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

Optional explicit window start (max 90 days).

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

Optional window end. Default: today (America/Denver).

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

Normalized permit categories. Empty = all.

## `permitTypeContains` (type: `array`):

Case-insensitive keywords matched against permit type, work class, and description.

## `minValuationUsd` (type: `integer`):

Rows without a declared value are dropped when this is above 0.

## `residentialOnly` (type: `boolean`):

Keep rows the city marks as residential.

## `commercialOnly` (type: `boolean`):

Keep rows the city marks as commercial.

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

Optional 5-digit ZIP filter.

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

delta = only permits not returned by earlier runs that used the same state store. full = everything in the window, tagged new or seen.

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

Named key-value store that remembers seen permits. Use one per saved task.

## `enrich` (type: `boolean`):

Adds normalized contractor name, contractor entity type, and valuation band. Charged as an extra event per row.

## `maxItems` (type: `integer`):

Hard cap on billable rows per run.

## `maxCostUsd` (type: `number`):

Optional. The run stops before charges would exceed this amount.

## `maxRowsPerCity` (type: `integer`):

Safety cap on rows read from each city per run.

## `disableTelemetry` (type: `boolean`):

Turn off anonymous error and usage stats sent to PostHog, including the run's sanitized input settings (URLs, cities, companies, filters). No personal or scraped data is included either way. Default is off (telemetry on).

## Actor input object example

```json
{
  "cities": [
    "austin",
    "seattle"
  ],
  "sinceDays": 7,
  "minValuationUsd": 0,
  "residentialOnly": false,
  "commercialOnly": false,
  "mode": "full",
  "stateStoreName": "us-building-permits-state",
  "enrich": false,
  "maxItems": 50,
  "maxRowsPerCity": 2000,
  "disableTelemetry": false
}
```

# Actor output Schema

## `results` (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 = {
    "cities": [
        "austin",
        "seattle"
    ],
    "mode": "full",
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("cherry_hippopotamus/us-building-permits").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 = {
    "cities": [
        "austin",
        "seattle",
    ],
    "mode": "full",
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("cherry_hippopotamus/us-building-permits").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 '{
  "cities": [
    "austin",
    "seattle"
  ],
  "mode": "full",
  "maxItems": 50
}' |
apify call cherry_hippopotamus/us-building-permits --silent --output-dataset

```

## MCP server setup

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

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/pwEF8VaxsTXSeX6Ie/builds/oCFG4bM5v4G6HKTrG/openapi.json
