# Building Permit Scraper PRO - Contractor Phone & Email (`codingfrontend/building-permit-scraper`) Actor

Extract building permits and contractor contact details from public city open-data APIs with transparent lead scoring.

- **URL**: https://apify.com/codingfrontend/building-permit-scraper.md
- **Developed by:** [Coding Frontned](https://apify.com/codingfrontend) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.99 / 1,000 results

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

### What this actor does

The **Building Permit Scraper** searches the [City of Chicago Building Permits dataset](https://data.cityofchicago.org/Buildings/Building-Permits/ydr8-5enu) and saves one result for each usable permit row. Results can include permit details, project cost and fees, property location, parcel identifiers, and names and roles of contacts listed in the source. It can also query another public Socrata-style JSON endpoint when its rows use fields the actor recognizes.

For Chicago permits, the actor also checks the public [Application Status service](https://webapps1.chicago.gov/buildingpermit/) for review history, applicants, published phone numbers, licenses, and completed correction comments. This service covers applications from the last 36 months. Email addresses are not extracted. Some fields are absent from individual permits, so optional values may not appear in every result.

### Why use it

Use permit records to research recent construction activity, identify projects by work type or location, review permit milestones, or find publicly listed businesses and people associated with a project. The actor keeps permit data in the results dataset and run status in a separate summary record.

Runs can be started from the Apify Console, scheduled, or called through the API. Results are saved to the run's default dataset.

### How to run the actor

1. Open the actor and select **Input**.
2. Enter a keyword, location filter, or result limit, or leave the fields blank to use the Chicago dataset defaults.
3. Select **Start** and wait for the run to finish.
4. Open **Storage → Dataset** to review permit records. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.
5. Open **Storage → Key-value store** and select `OUTPUT_SUMMARY` to see the saved-record count and run status.

### Input fields

All fields are optional. With no input, the actor uses the Chicago permit dataset and requests up to 100 rows.

| Field | Type | Required? | Default | What it does |
| --- | --- | --- | --- | --- |
| `datasetUrl` | Text (string) | Optional | `https://data.cityofchicago.org/resource/ydr8-5enu.json` | Public HTTPS JSON endpoint returning an array of permit rows. Maximum 1,000 characters. Credentials, ports, IP addresses, and local or private hosts are rejected. |
| `city` | Text (string) | Optional | None (blank) | City filter, up to 120 characters. Applied when a source row includes a recognized city field. |
| `state` | Text (string) | Optional | None (blank) | State or region filter, up to 3 characters. The value is converted to uppercase and compared without regard to case when a row includes a recognized state field. |
| `search` | Text (string) | Optional | None (blank) | Socrata full-text search, up to 200 characters, usually for permit descriptions and addresses. |
| `maxItems` | Integer | Optional | `100` | Maximum rows requested and emitted. Minimum `1`, maximum `1000`. |
| `requestTimeoutSeconds` | Integer | Optional | `45` | Timeout for each dataset or application-detail request in seconds. Minimum `5`, maximum `120`. |
| `maxRetries` | Integer | Optional | `1` | Retries for network, timeout, or server errors. Minimum `0`, maximum `3`. Source access denials and challenges are not retried. |

#### Input examples

A small keyword search:

```json
{
  "search": "Reroofing",
  "maxItems": 10
}
```

Filter for Chicago permits and request a custom sort order through the dataset URL:

```json
{
  "datasetUrl": "https://data.cityofchicago.org/resource/ydr8-5enu.json?$order=issue_date%20ASC",
  "city": "Chicago",
  "state": "IL",
  "search": "New Construction",
  "maxItems": 25
}
```

Adjust the request timeout and retry count:

```json
{
  "maxItems": 50,
  "requestTimeoutSeconds": 60,
  "maxRetries": 2
}
```

#### Search and filtering tips

- `datasetUrl` selects the source. The default is Chicago's public permits endpoint. A custom endpoint must be a public HTTPS JSON URL that returns an array of rows.
- `search` is sent as the Socrata `$q` parameter. It is useful with Socrata datasets; other endpoints may not support it.
- `maxItems` is sent as the source `$limit`. The actor applies city and state filters after that request, so a filtered run may return fewer rows than the limit.
- City and state filters are used only when a row has a recognized field. A row with no matching location field is kept because the actor cannot compare it.
- The actor removes repeated permit numbers within the returned rows. Chicago results are ordered by issue date and application date, newest first, unless the dataset URL supplies its own `$order` parameter.
- A custom `$order` in `datasetUrl` is preserved. Other query parameters are also retained, while the actor sets `$limit` from `maxItems` and `$q` from `search` when those settings are provided.

#### Advanced settings (Developer Options)

`requestTimeoutSeconds` and `maxRetries` help control slow or unreliable public endpoints. Retries are bounded, and access denials or source challenges stop without retrying. The actor accepts only public HTTPS URLs without credentials, explicit ports, IP addresses, localhost, or private host names. Unknown input fields are rejected.

### Permit records

Each dataset item represents a permit. `recordId` and `permitId` are required; all other fields are optional and appear only when the source provides a usable value or the parser can derive it from source fields. The complete illustrative example below shows every supported business field. Its values and example permit link are illustrative documentation examples, not a verified live permit.

#### Illustrative permit record

```json
{
  "recordId": "permit:row-9001",
  "sourceRecordId": "row-9001",
  "permitId": "BP-9001",
  "permitUrl": "https://data.cityofchicago.org/resource/ydr8-5enu.json?id=row-9001",
  "permitType": "PERMIT - EXPRESS PERMIT PROGRAM",
  "status": "ACTIVE",
  "permitMilestone": "INSPECTION ELIGIBLE",
  "reviewType": "EXPRESS PERMIT PROGRAM",
  "workType": "Reroofing",
  "description": "Replace the roof covering. IL ROOFING CONTRACTOR LICENSE: 104000001.",
  "permitCondition": "Inspection required.",
  "applicationDate": "2026-01-05T00:00:00.000Z",
  "issueDate": "2026-01-09T00:00:00.000Z",
  "processingDays": 4,
  "address": "100 N Main Street",
  "city": "Chicago",
  "state": "IL",
  "zip": "60601",
  "communityAreaCode": "8",
  "censusTract": "123.00",
  "ward": "42",
  "parcelIds": [
    "1234567890",
    "0987654321"
  ],
  "latitude": 41.904551438389674,
  "longitude": -87.66207256920043,
  "reportedCost": 12500,
  "buildingFeePaid": 325,
  "zoningFeePaid": 0,
  "otherFeePaid": 15,
  "subtotalPaid": 340,
  "buildingFeeUnpaid": 0,
  "zoningFeeUnpaid": 0,
  "otherFeeUnpaid": 0,
  "subtotalUnpaid": 0,
  "buildingFeeWaived": 0,
  "zoningFeeWaived": 0,
  "otherFeeWaived": 0,
  "subtotalWaived": 0,
  "buildingFeeSubtotal": 325,
  "zoningFeeSubtotal": 0,
  "otherFeeSubtotal": 15,
  "totalFee": 340,
  "currency": "USD",
  "contacts": [
    {
      "type": "OWNER",
      "name": "Jordan Example",
      "city": "Chicago",
      "state": "IL",
      "zip": "60601"
    },
    {
      "type": "GENERAL CONTRACTOR",
      "name": "North Star Builders LLC",
      "city": "Chicago",
      "state": "IL",
      "zip": "60602"
    }
  ],
  "licenseNumber": "104000001",
  "leadScore": 85,
  "leadTemperature": "HOT",
  "addressComponents": {
    "streetNumber": "100",
    "streetDirection": "N",
    "streetName": "Main Street"
  },
  "projectedCoordinates": {
    "x": 1166980.1020437458,
    "y": 1908523.3795268815,
    "unit": "feet",
    "coordinateSystem": "NAD 83 - State Plane Eastern IL"
  },
  "application": {
    "number": "BP-9001",
    "streetAddress": "100 N Main Street",
    "permitType": "Express Permit Program",
    "reviewProgram": "Express Permit Web",
    "startDate": "2026-01-05T00:00:00.000Z",
    "issueDate": "2026-01-09T00:00:00.000Z",
    "description": "Replace the roof covering. IL ROOFING CONTRACTOR LICENSE: 104000001.",
    "reviews": [
      {
        "activityType": "Express Permit Program Review #1",
        "statusDate": "2026-01-09T00:00:00.000Z",
        "status": "Approved"
      }
    ],
    "applicants": [
      {
        "group": "Primary Applicant",
        "capacity": "Owner",
        "name": "Jordan Example",
        "address": "100 N Main Street, Chicago, IL 60601",
        "phone": "(312) 555-0100"
      },
      {
        "group": "Other Applicants",
        "capacity": "General Contractor",
        "name": "North Star Builders LLC",
        "address": "200 N Example Street, Chicago, IL 60602",
        "phone": "(312) 555-0101",
        "license": {
          "type": "General Contractor (Class E)",
          "number": "TGC000001",
          "inactive": false,
          "expiresAt": "2027-01-09T00:00:00.000Z",
          "insuranceBondExpiresAt": "2027-01-01T00:00:00.000Z"
        }
      }
    ],
    "completedCorrections": [
      {
        "reviewTypeStatus": "Structural Review (Approved)",
        "comment": "Provide the applicable roof load information. Documentation accepted.",
        "addedDate": "2026-01-06T00:00:00.000Z",
        "resolvedDate": "2026-01-08T00:00:00.000Z"
      }
    ]
  }
}
```

The `contacts` array contains only source-listed role, name, city, state, and ZIP fields. It does not include phone, email, or source-row position metadata. `zip` on the permit is included only when the source has a property ZIP field; a contact's ZIP is not used as the property's ZIP. `currency` is `USD` for the Chicago dataset and is omitted for other sources unless the actor can determine the supported value.

Permit details, fees, parcel identifiers, coordinates, and `contacts` come from the dataset response. Chicago permits additionally receive `application` details from the public status, applicant, and completed-correction pages after the service's normal terms step. Other datasets are not joined to this service. Applicant roles and licenses stay associated with their own applicant; these applicants are kept separate from dataset contacts. All displayed reviews and completed correction rows are retained, including repeated source comments. Missing sections are omitted rather than represented by empty arrays. `licenseNumber` uses a dedicated source license field when available. For Chicago roofing permits, it can also read one nine-digit number explicitly labeled `IL ROOFING CONTRACTOR LICENSE:` in the work description. Missing or ambiguous licenses are omitted. `application.applicants[].license` contains the status service's published license class, number, inactive flag, and expiration dates; these are not independent licensing-registry checks. An apartment or suite is added to `address` only when the source explicitly supplies a unit field.

#### Output fields

| Field | Type | Required? | Meaning |
| --- | --- | --- | --- |
| `recordId` | String | Required | Stable actor-generated identifier for the permit record. |
| `sourceRecordId` | String | Optional | Source dataset row identifier, when available. |
| `permitId` | String | Required | Permit or application number reported by the source. |
| `permitUrl` | String (URL) | Optional | Public HTTPS link for the permit record, when available. |
| `permitType` | String | Optional | Permit classification. |
| `status` | String | Optional | Permit status reported by the source. Run status is shown in `OUTPUT_SUMMARY`. |
| `permitMilestone` | String | Optional | Permit workflow milestone. |
| `reviewType` | String | Optional | Review program or review type. |
| `workType` | String | Optional | Short work classification. |
| `description` | String | Optional | Proposed or approved work description. |
| `permitCondition` | String | Optional | Permit condition or inspection note. |
| `applicationDate` | String (date-time) | Optional | Application start date, normalized to ISO 8601. |
| `issueDate` | String (date-time) | Optional | Permit issue date, normalized to ISO 8601. |
| `processingDays` | Number | Optional | Processing duration reported by the source, in days. |
| `address` | String | Optional | Property address, reported or assembled from source address components. |
| `city` | String | Optional | Property city from the source or Chicago dataset default. |
| `state` | String | Optional | Property state from the source or Chicago dataset default. |
| `zip` | String | Optional | Property ZIP or postal code, only when supplied as a property field. |
| `communityAreaCode` | String | Optional | Community area value reported by the source. |
| `censusTract` | String | Optional | Census tract reported by the source. |
| `ward` | String | Optional | Ward or district reported by the source. |
| `parcelIds` | Array of strings | Optional | Unique parcel identifiers reported by the source. |
| `latitude` | Number | Optional | Property latitude in decimal degrees. |
| `longitude` | Number | Optional | Property longitude in decimal degrees. |
| `reportedCost` | Number | Optional | Applicant-reported project cost. |
| `buildingFeePaid` | Number | Optional | Building fees paid, as reported by the source. |
| `zoningFeePaid` | Number | Optional | Zoning fees paid, as reported by the source. |
| `otherFeePaid` | Number | Optional | Other fees paid, as reported by the source. |
| `subtotalPaid` | Number | Optional | Paid fee subtotal, as reported by the source. |
| `buildingFeeUnpaid` | Number | Optional | Unpaid building fees, as reported by the source. |
| `zoningFeeUnpaid` | Number | Optional | Unpaid zoning fees, as reported by the source. |
| `otherFeeUnpaid` | Number | Optional | Other unpaid fees, as reported by the source. |
| `subtotalUnpaid` | Number | Optional | Unpaid fee subtotal, as reported by the source. |
| `buildingFeeWaived` | Number | Optional | Building fees waived, as reported by the source. |
| `zoningFeeWaived` | Number | Optional | Zoning fees waived, as reported by the source. |
| `otherFeeWaived` | Number | Optional | Other fees waived, as reported by the source. |
| `subtotalWaived` | Number | Optional | Waived fee subtotal, as reported by the source. |
| `buildingFeeSubtotal` | Number | Optional | Building fee subtotal, as reported by the source. |
| `zoningFeeSubtotal` | Number | Optional | Zoning fee subtotal, as reported by the source. |
| `otherFeeSubtotal` | Number | Optional | Other fee subtotal, as reported by the source. |
| `totalFee` | Number | Optional | Total fee amount, as reported by the source. |
| `currency` | String | Optional | Currency for source amounts. The Chicago dataset uses `USD`. |
| `contacts` | Array of objects | Optional | Source-listed contacts. Each object may contain `type`, `name`, `city`, `state`, and `zip`. |
| `licenseNumber` | String | Optional | Source contractor license number, from a dedicated field or an explicitly labeled Chicago roofing work description. Not a registry verification. |
| `leadScore` | Number (0–100) | Optional | Score based on the presence of selected permit fields; it is not a project valuation or a guarantee that a contractor is available. |
| `leadTemperature` | String (`HOT`, `WARM`, or `COLD`) | Optional | Score band: `HOT` at 70 or higher, `WARM` from 45 through 69, and `COLD` below 45. |
| `addressComponents` | Object | Optional | Source street number, direction, and name. |
| `projectedCoordinates` | Object | Optional | Chicago primary-address x/y in feet, NAD 83 State Plane Eastern IL, as documented by the source. |
| `application` | Object | Optional | Application-service identity, dates, description, reviews, applicants, and completed corrections. |

#### Nested output fields

All nested fields are optional except `application.number` when an application object is present, and all four projected-coordinate fields when that object is present. Array items retain their source order and association.

| Field | Type | Required? | Meaning |
| --- | --- | --- | --- |
| `addressComponents.streetNumber` | String | Optional | Source street number, preserving its text. |
| `addressComponents.streetDirection` | String | Optional | Source direction abbreviation. |
| `addressComponents.streetName` | String | Optional | Source street name. |
| `projectedCoordinates.x` | Number | Required in object | East-west primary-address coordinate. |
| `projectedCoordinates.y` | Number | Required in object | North-south primary-address coordinate. |
| `projectedCoordinates.unit` | String | Required in object | `feet`. |
| `projectedCoordinates.coordinateSystem` | String | Required in object | `NAD 83 - State Plane Eastern IL`. |
| `application.number` | String | Required in object | Application number matching `permitId`. |
| `application.streetAddress` | String | Optional | Property address on the application service. |
| `application.permitType` | String | Optional | Detail service permit classification. |
| `application.reviewProgram` | String | Optional | Detail service review program. |
| `application.startDate` | String (date-time) | Optional | Detail service application start date. Kept separate from dataset `applicationDate`, which can differ. |
| `application.issueDate` | String (date-time) | Optional | Detail service ready-to-issue date. Work cannot begin until all fees are paid. |
| `application.description` | String | Optional | Full description displayed by the application service. |
| `application.reviews` | Array of objects | Optional | Each review's `activityType` (string), `statusDate` (ISO date-time), and `status` (string). |
| `application.applicants` | Array of objects | Optional | Each applicant's `group` (`Primary Applicant` or `Other Applicants`), `capacity`, `name`, `address`, and `phone` (strings), plus an optional `license` object. Applicant addresses are not substituted for property location. |
| `application.applicants[].license` | Object | Optional | `type` and `number` (strings), `inactive` (boolean), `expiresAt` and `insuranceBondExpiresAt` (ISO date-times). `inactive: false` means the source explicitly says No. |
| `application.completedCorrections` | Array of objects | Optional | `reviewTypeStatus` and complete `comment` (strings), `addedDate` and `resolvedDate` (ISO date-times). Blank resolution dates are omitted. |

Application dates are rendered as ISO 8601 at midnight UTC to represent source calendar dates, not a measured event time. Applicants may publish personal contact details; use them responsibly. The detail service may omit older permits or individual sections. If a detail request fails, available base permit data and any successful detail sections are retained and the run summary marks limited results. Open corrections, inspections, images, and external company profiles are not collected. Inspection-service access was unavailable during verification; an absent field does not imply no inspection exists.

The actor omits unavailable values instead of filling them with made-up text, zeros, or links. Fee values of zero are retained only when the source explicitly reports zero.

### Run status

- **SUCCEEDED** means at least one valid permit record was acknowledged by the dataset write.
- **SUCCEEDED with limited results** means some real permit records were saved before a later collection, detail-enrichment, or storage failure. The summary marks this as partial.
- **FAILED** means no real permit record was saved. Empty results, blocked sources, invalid input, and diagnostic-only output do not create dummy dataset rows.

### Output summary

The **Output summary** link opens the `OUTPUT_SUMMARY` record in the run's default **Key-value store**. It is separate from the permit dataset and always contains exactly these three fields:

| Field | Type | Required? | Meaning |
| --- | --- | --- | --- |
| `status` | String (`SUCCEEDED` or `FAILED`) | Required | `SUCCEEDED` when at least one real permit record was saved; otherwise `FAILED`. |
| `itemsStored` | Nonnegative integer | Required | Number of real permit records whose dataset writes completed during the run. |
| `isPartial` | Boolean | Required | `true` when a failure interrupted a run after one or more records were saved. |

Illustrative successful summary:

```json
{
  "status": "SUCCEEDED",
  "itemsStored": 2,
  "isPartial": false
}
```

### Tips, access, and cost

- Start with a small `maxItems` value while checking the fields available from a source.
- This actor makes bounded public JSON and HTML requests. Chicago detail requests use a consistent session and a short delay between requests; increasing `maxItems` increases detail requests and run time. It does not sign in to a data portal, solve CAPTCHAs, or use a browser.
- Public endpoints may be unavailable, rate-limited, or changed by their providers. A source may omit fields or return fewer matching rows than requested.
- Apify compute and storage charges depend on your plan and actual usage. Check the current plan and run details in Apify Console; this README does not quote a fixed price.
- Use public permit and contact information in line with the source portal's terms and applicable privacy, outreach, and retention rules. For help or feedback, use the actor's **Issues** tab. The **API** tab shows how to call it programmatically.

# Actor input Schema

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

Public HTTPS JSON endpoint returning an array of permit rows. Defaults to Chicago building permits. Credentials, ports, local hosts, and IP addresses are not accepted.

## `city` (type: `string`):

Optional city name. Applied to rows only when the source includes a matching city field.

## `state` (type: `string`):

Optional state or region code. Applied to rows only when the source includes a matching state field; letters are matched without regard to case.

## `search` (type: `string`):

Optional Socrata full-text query for permit descriptions and addresses.

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

Maximum number of permit rows requested and emitted for this run.

## `requestTimeoutSeconds` (type: `integer`):

Maximum time to wait for each source request.

## `maxRetries` (type: `integer`):

Number of retries for network, timeout, or server errors. Public-source access denials and challenges are not retried.

## Actor input object example

```json
{
  "datasetUrl": "https://data.cityofchicago.org/resource/ydr8-5enu.json",
  "maxItems": 100,
  "requestTimeoutSeconds": 45,
  "maxRetries": 1
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing the permit records saved during this run.

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

Three-field status summary from the default key-value store.

# 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("codingfrontend/building-permit-scraper").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("codingfrontend/building-permit-scraper").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 codingfrontend/building-permit-scraper --silent --output-dataset

```

## MCP server setup

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

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/1XEU9KwZc9pFCZ02d/builds/MLwIe8CSjdKkCIB4S/openapi.json
