跳到正文
DEV Community· FedSignals Data·· 2 小時前AI 評分43

如何用 Building Permits Scraper 從城市開放數據取得太陽能、屋頂工程及 HVAC 許可潛在客戶?

How to Get New Building Permit Leads (Solar, Roofing, HVAC) from City Open Data

AI 導讀

Building Permits Scraper 將 22 個城市及郡縣入口的建築許可資料統一欄位並標記行業,供用戶篩選及取得新許可。工具支援太陽能、屋頂工程、HVAC 等行業標籤,並可設定每日只傳送尚未提供過的許可。新許可可透過 Slack 訊息或 webhook 傳送至 CRM。

正文

Pull newly issued solar, roofing and HVAC permits from city open-data portals into one daily feed, filtered by trade, with only new permits each run.

Written with AI assistance and reviewed by the FedSignals Data team; we maintain these tools.

A rooftop solar permit means an installer just closed a sale. An HVAC change-out names the mechanical contractor that got the job. A wave of roofing permits after a hailstorm shows you where demand is. Suppliers, subcontractors, lenders, insurers and researchers all use this data.

Many large U.S. cities publish issued permits as open data, for example Austin, San Francisco and Seattle. The catch is that every portal is different. Each has its own field names, permit types, date formats and ways of saying "solar". If you want more than one city, you end up maintaining a parser per city.

There are two common options:

  • Commercial permit-data providers (such as Construction Monitor, PermitStack or Johto Data) cover many jurisdictions and add enrichment, for a subscription fee.
  • Query each city's API yourself. It's free, but you need one adapter per city, plus your own trade tagging and deduplication.

We built the Building Permits Scraper: New Construction Leads by City Actor on Apify to solve that, and this tutorial walks through it. It reads 22 city and county portals whose terms allow commercial reuse, maps each one to the same fields, tags each permit by trade, and returns only permits you haven't seen.

What you'll build

  • A daily list of newly issued permits from the cities you pick, all with the same fields.
  • Filters for trade (solar, roofing, HVAC and 13 more), property class, ZIP code, keywords and declared value.
  • A daily run that returns only permits it hasn't delivered before.
  • A Slack message (or webhook to your CRM) with each new permit.

Step 1: Run it once by hand

Open apify.com/fedsignals/building-permits-monitor and click Try for free. This is the exact input we used for this article:

{
  "cities": ["austin", "san-francisco", "seattle"],
  "daysBack": 7,
  "tradeTags": ["solar", "roofing", "hvac"],
  "propertyClasses": ["Residential"],
  "onlyNew": false,
  "maxItems": 5
}

What each setting does:

  • cities picks portals by key, such as austin, san-francisco, seattle, new-york, chicago or boston. The input form lists all 22.
  • daysBack: 7 returns permits issued in the last 7 days. Cities often post permits a few days late, so keep 7 even on a daily schedule. onlyNew removes the overlap.
  • tradeTags matches the permit type and description against trade keywords: solar, roofing, hvac, electrical, plumbing, ev-charging, pool, adu, new-construction and more.
  • propertyClasses is Residential, Commercial or Mixed, a best-effort label based on each city's use or occupancy field.
  • maxItems: 5 keeps the test small.

You can also filter by zipCodes, keywords, excludeKeywords and minEstimatedCost. Note that many permits don't list a value, and setting minEstimatedCost skips those.

Step 2: Look at the output

Our run on Oct 29, 2026 took about 3 seconds. Its status read 5 new permits delivered (maxItems 5 reached). Here is one row, with the address and coordinates removed for this article:

{
  "city": "Austin, TX",
  "cityKey": "austin",
  "permitNumber": "2026-132017 EP",
  "permitType": "Electrical Permit",
  "workClass": "Auxiliary Power",
  "propertyClass": "Residential",
  "description": "Install new 5.7 kW rooftop solar system to existing residential ...",
  "status": "Active",
  "appliedDate": "2026-10-07",
  "issuedDate": "2026-10-28",
  "estimatedCost": null,
  "currency": "USD",
  "contractorCompany": "Power Home Remodeling",
  "contractorTrade": "Electrical Contractor",
  "tradeTags": ["solar", "electrical"],
  "url": "https://abc.austintexas.gov/web/permit/public-search-other?t_detail=1&t_selected_folderrsn=13785239",
  "sourceDataset": "https://data.austintexas.gov/Building-and-Development/Issued-Construction-Permits/3syk-w9eu",
  "licence": "Public Domain (U.S. Government Works)"
}

All five were residential permits issued in Austin on Oct 28, 2026:

Permit Type Work Contractor
2026-131052 EP Electrical Residential energy storage (solar) Aether Energy
2026-132017 EP Electrical 5.7 kW rooftop solar Power Home Remodeling
2026-138377 MP Mechanical Mini-split heat pump All Star HVAC
2026-139163 MP Mechanical Central heat and air change-out Radiant Plumbing and Air Conditioning
2026-137776 MP Mechanical Central heat and air change-out Greenleaf AC Heating & Plumbing

Things to notice:

  • estimatedCost is null on all five. Many trade permits don't declare a value. Don't build logic that assumes a number (see Step 3).
  • tradeTags can hold more than one trade. A solar install is also tagged electrical.
  • licence and sourceDataset record where each row came from and under what terms.
  • Rows also include the site address, ZIP and coordinates as the city publishes them, and contractorCompany when the city lists one. We left addresses out of this article. Treat them carefully and follow the laws that apply to how you contact anyone.

The run also writes a summary to its key-value store (record SUMMARY):

{
  "since": "2026-10-22",
  "pushed": 5,
  "skippedAlreadySeen": 0,
  "duplicateRowsMerged": 0,
  "cities": {
    "austin": {"scanned": 182, "pushed": 5, "error": null},
    "san-francisco": {"scanned": 0, "pushed": 0, "error": null},
    "seattle": {"scanned": 0, "pushed": 0, "error": null}
  }
}

San Francisco and Seattle show 0 scanned. The Actor reads portals biggest metro first (Austin comes before San Francisco and Seattle), and Austin alone filled maxItems: 5. In a wider test with the same filters, Austin produced 49 matching permits before the run hit our spending cap. If you want every city represented, either set maxPerCity (the most rows read from each portal per run) or save one task per city. Check the cities block in the summary to see how much of each portal was read.

Step 3: Call it from Python

This runs the Actor synchronously and prints each new permit, without addresses. It reads your Apify token from an environment variable (never paste it into code). maxTotalChargeUsd caps the run's charges.

import os
import requests

ACTOR = "fedsignals~building-permits-monitor"
URL = f"https://api.apify.com/v2/acts/{ACTOR}/run-sync-get-dataset-items"

run_input = {
    "cities": ["austin", "san-francisco"],
    "daysBack": 7,
    "tradeTags": ["solar", "roofing", "hvac"],
    "propertyClasses": ["Residential"],
    "onlyNew": True,                # only permits this stateKey hasn't returned before
    "stateKey": "solar-roof-hvac",  # one key per saved search
    "maxPerCity": 300,              # read at most 300 rows from each portal per run
    "maxItems": 4,
}

resp = requests.post(
    URL,
    params={"maxTotalChargeUsd": 0.05},
    headers={"Authorization": f"Bearer {os.environ['APIFY_TOKEN']}"},
    json=run_input,
    timeout=300,
)
resp.raise_for_status()

for n in resp.json():
    cost = n.get("estimatedCost")
    value = f"${cost:,.0f}" if cost else "value n/a"
    tags = ",".join(n.get("tradeTags") or [])
    who = n.get("contractorCompany") or "contractor not listed"
    print(f"{n['issuedDate']}  {n['city']}  {n['permitNumber']}  [{tags}]  {who}  {value}")

Run it twice. The second run doesn't repeat any permit from the first: onlyNew remembers every permit delivered for that stateKey.

Step 4: Schedule it daily

  1. In the Apify console, click Save as a new task with your cities and trades. Set daysBack: 7, onlyNew: true and a stateKey.
  2. Go to Schedules → Create new, use the cron expression 0 6 * * * (6:00 daily), set your timezone, and attach the task.

With daysBack: 7, a permit that a city posts three days late is still caught, and onlyNew stops it from being sent twice.

Step 5: Send new permits to Slack or a webhook

Add a webhook for ACTOR.RUN.SUCCEEDED that points at a small function you host. The payload includes resource.defaultDatasetId:

import os
import requests

def handler(payload: dict) -> None:
    dataset_id = payload["resource"]["defaultDatasetId"]
    items = requests.get(
        f"https://api.apify.com/v2/datasets/{dataset_id}/items",
        headers={"Authorization": f"Bearer {os.environ['APIFY_TOKEN']}"},
        timeout=60,
    ).json()
    if not items:
        return  # no new permits today

    lines = [f"*{len(items)} new permits*"]
    for n in items[:30]:
        link = n.get("url") or n.get("sourceDataset")  # some portals have no per-permit page
        tags = ", ".join(n.get("tradeTags") or []) or "untagged"
        who = n.get("contractorCompany") or "no contractor listed"
        lines.append(f"• <{link}|{n['permitNumber']}> {n['city']} ({tags}): {who}, issued {n['issuedDate']}")
    requests.post(os.environ["SLACK_WEBHOOK_URL"], json={"text": "\n".join(lines)}, timeout=30)

Some portals don't have a page per permit, so url can be null. The handler falls back to the dataset link.

What it costs

The Actor uses pay-per-event pricing: $0.002 per permit delivered ($2 per 1,000), plus Apify's $0.00005 run-start fee. The 5-permit test above costs about $0.01. The Python example is capped at 4 permits. A day with no new permits costs only the start fee. For busy cities, use maxItems and maxTotalChargeUsd to cap spend.

FAQ

Which cities are covered?
22 portals: New York City, Los Angeles, Chicago, San Antonio, San Jose, Austin, San Francisco, Columbus, Seattle, Washington DC, Boston, Raleigh, Minneapolis, Mesa, New Orleans, Pittsburgh, Cincinnati, Baton Rouge, Tempe, Cambridge MA, Montgomery County MD and New Jersey (statewide). Only datasets whose licence or terms allow commercial reuse are included.

How fresh is the data?
As fresh as each city's portal. Update schedules vary, and some portals post permits several days after issue. That's why daysBack: 7 is recommended.

Why does a permit have no value or contractor?
The city didn't publish one. It varies by city and permit type.

How does trade tagging work?
Keywords in the permit type, work class and description. For example, "heat pump", "furnace" or "mini-split" tags hvac, and "solar", "photovoltaic" or "PV system" tags solar. It's best-effort, so spot-check a sample for your trade.

Is there a Socrata rate limit?
Socrata portals allow more requests with a free app token. Set socrataAppToken if you run large pulls.

Related


Last updated: Nov 19, 2026 (tested against Actor build 0.1.15).

FedSignals Data builds small public-data monitors on Apify. FedSignals is not affiliated with, or endorsed by, any city, county or state government. Questions or feature requests: fedsignals.alerts@gmail.com.

來源:DEV Community · dev.to