# City building permits — Socrata permit alerts (`mack2strategy/socrata-building-permit-alerts`) Actor

Building permit alerts for Seattle, Austin, New York City, and San Francisco. Filter by permit type, minimum job value, ZIP, and keyword. No street address. Schedule onlyNew for permits you have not stored.

- **URL**: https://apify.com/mack2strategy/socrata-building-permit-alerts.md
- **Developed by:** [Mack2 Strategy](https://apify.com/mack2strategy) (community)
- **Categories:** Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

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

## City building permits — Socrata permit alerts

Mack2 Strategy Socrata building permits alerts read public feeds for Seattle, Austin, New York City, and San Francisco. Pick the city, then filter by permit type, minimum valuation, ZIP, and keyword. Price is the city's estimated cost. Street addresses, coordinates, and contractor or owner names are not requested.

**Store description.** Building permit alerts for Seattle, Austin, New York City, and San Francisco. Filter by permit type, minimum job value, ZIP, and keyword. No street address. Schedule onlyNew for permits you have not stored.

Search this Actor by the source name **Socrata building permits**. It is a pay-per-event alerts Actor: a scheduled run with `onlyNew` returns records that were not seen on a previous run.

| | |
| --- | --- |
| Source | Socrata building permits |
| Niche | building-permits |
| Access | public_api |
| Pricing | $5.00 per 1,000 results (`result` = $0.005) plus $0.005 per run (`actor-start`) |
| Login | Not used. Login-walled pages are rejected. |
| Personal data | Not collected. Emails, phone numbers, and names of private individuals are blocked. |

### What you get

Every dataset item uses the same core fields, plus source-specific fields:

| Field | Meaning |
| --- | --- |
| `id` | Stable id used by `onlyNew` |
| `url` | Public https link, or null |
| `title` | Short label |
| `price` | Numeric amount, or null when the source has no price |
| `location` | Place text coarse enough to avoid a street address |
| `postedAt` | ISO date or datetime |
| `raw` | Allowlisted source values for the mapped fields. The upstream payload is not copied through. |
| `permitType` | Permit type published by the city. |
| `zip` | ZIP code. Street address is not stored. |
| `status` | Current permit status when the city publishes one. |

### Use cases

- A roofing company wants new Seattle alteration permits above a dollar amount.
- A supplier watches San Francisco permits in one ZIP.
- An agent needs a permit number, cost, ZIP, and the city open-data page.

### Example output

```json
{
  "id": "202611160821",
  "url": "https://data.sfgov.org/Housing-and-Buildings/Building-Permits/i98e-djp9",
  "title": "replace three windows",
  "price": 8000,
  "location": "San Francisco 94127",
  "postedAt": "2026-11-16T16:20:57.000",
  "permitType": "otc alterations permit",
  "zip": "94127"
}
```

### Input

```json
{
  "city": "seattle",
  "maxItems": 25,
  "onlyNew": false
}
```

- `keywords` filters records. Keywords are applied to the public fields after each page is fetched, so a daily run can scan the latest pages and keep matches.
- `searchUrl` replaces the default endpoint. It must be https, on an allowlisted host, and on an allowlisted path. It cannot point at a login or account page.
- `maxItems` caps how many records are returned (default 25, ceiling 200).
- `onlyNew` stores seen ids in the named Apify key-value store (`stateStoreName`, default `socrata-building-permit-alerts-seen`, key `SEEN_IDS`). The store keeps the most recent 50,000 ids. Turn this on for a daily schedule so each run behaves like an alert.
- `maxPages` limits how many result pages are requested (default 1, ceiling 4).

### Use from MCP / AI agents

Call this Actor when the user wants **Socrata building permits** records and the task is public data, not a logged-in account and not a person search.

- **Actor id (after publish):** `<your-username>/socrata-building-permit-alerts`
- **Pricing:** one `actor-start` event per run and one `result` event per dataset item. A run that returns 1,000 items costs about $5.00 before any Apify minimum charge.
- **Pass this input** when you only know the topic:

```json
{
  "keywords": "",
  "maxItems": 25,
  "onlyNew": false
}
```

- **Pass `onlyNew: true`** when the user wants an alert or a scheduled "what changed" run. Use the same `stateStoreName` on every run of that schedule.
- **Read** the default dataset. Ignore any field that is not in the table above unless you asked for that source-specific column.
- **Do not use** this Actor for emails, phone numbers, private individuals, or any host outside the allowlist.
- **Stop** when the dataset reaches `maxItems` or when a charge-limit response comes back from `Actor.pushData`.

### Compliance

Seattle dataset 76t5-zqzr is marked Public Domain. Austin dataset 3syk-w9eu is marked Public Domain U.S. Government. San Francisco dataset i98e-djp9 is marked Open Data Commons Public Domain Dedication and License. New York City publishes DOB NOW permits under its open-data law; this factory already uses that dataset. Each portal's robots.txt allows /resource/ and asks for a one-second delay. The locked $select for the chosen city omits street addresses, latitude, longitude, owner names, and contractor names. Chicago and Los Angeles were left out because their portal licence fields are empty or only say "See Terms of Use".

- Source: Seattle, Austin, New York City, and San Francisco open-data portals
- Licence: Public Domain, Public Domain U.S. Government, NYC Open Data, and Open Data Commons PDDL
- Terms URL: https://data.seattle.gov/Permitting/Building-Permits/76t5-zqzr
- Reviewed on: 2026-11-17
- `termsReviewed`: true
- robots.txt is fetched before the first request. A disallow, or a robots.txt that returns 401, 403, or 5xx, aborts the run. A missing robots.txt is treated as allowed. Crawl-delay is honored when it is longer than the configured delay.
- Concurrency 1, at least 1000 ms between requests, at most 20 requests per minute.
- User-Agent: `Mack2 Strategy john@mack2strategy.com`

### Run locally

From the repository root, with dependencies installed:

```bash
npm test -- actors/socrata-building-permit-alerts/test/extract.test.ts
npm run smoke -- actors/socrata-building-permit-alerts/test/smoke.test.ts
```

The offline test replays `test/fixtures`. The smoke test is the canary: it calls the live source (or the inline records, for the classifier), and it fails on zero results or a schema error.

To start the Actor the way Apify does:

```bash
cd actors/socrata-building-permit-alerts
npm install
npm run build
mkdir -p storage/key_value_stores/default
cp examples/default.json storage/key_value_stores/default/INPUT.json
node dist/main.js
```

### Publish

Do this only after `npm run publish-check -- targets/socrata-building-permit-alerts.yaml` prints no errors, and only from an Apify account you control:

```bash
cd actors/socrata-building-permit-alerts
npm install && npm run build
npx apify-cli push
```

Then confirm the Console monetization events match `.actor/pay_per_event.json`: `actor-start` at $0.005 and primary event `result` at $0.005. This repository does not publish anything.

# Actor input Schema

## `keywords` (type: `string`):

Words that must appear in the public fields from Socrata building permits. Leave empty to take the latest records.

## `searchUrl` (type: `string`):

Optional https URL on data.seattle.gov, data.austintexas.gov, data.cityofnewyork.us, data.sfgov.org. The path must start with /resource/76t5-zqzr.json or /resource/3syk-w9eu.json or /resource/rbx6-tga4.json or /resource/i98e-djp9.json.

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

Cap on records written to the dataset.

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

Skip ids already stored in the named key-value store. Enable this on a schedule to get alert-style runs.

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

Apify key-value store used when onlyNew is true.

## `maxPages` (type: `integer`):

How many result pages to request.

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

Open-data portal to read. Seattle, Austin, and San Francisco state a public-domain licence. NYC is the DOB NOW open-data feed.

## `permitType` (type: `string`):

Text that must appear in the city's permit type, such as electrical or alteration. Leave empty for every type.

## `minValuation` (type: `string`):

Keep permits whose estimated cost is at least this many dollars. Leave empty for every cost.

## `zipCode` (type: `string`):

ZIP or postal code that must appear on the permit. Leave empty for every ZIP.

## Actor input object example

```json
{
  "keywords": "",
  "maxItems": 25,
  "onlyNew": false,
  "stateStoreName": "socrata-building-permit-alerts-seen",
  "maxPages": 1,
  "city": "seattle"
}
```

# Actor output Schema

## `overview` (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 = {
    "keywords": "",
    "maxItems": 25,
    "stateStoreName": "socrata-building-permit-alerts-seen",
    "maxPages": 1,
    "city": "seattle"
};

// Run the Actor and wait for it to finish
const run = await client.actor("mack2strategy/socrata-building-permit-alerts").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 = {
    "keywords": "",
    "maxItems": 25,
    "stateStoreName": "socrata-building-permit-alerts-seen",
    "maxPages": 1,
    "city": "seattle",
}

# Run the Actor and wait for it to finish
run = client.actor("mack2strategy/socrata-building-permit-alerts").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 '{
  "keywords": "",
  "maxItems": 25,
  "stateStoreName": "socrata-building-permit-alerts-seen",
  "maxPages": 1,
  "city": "seattle"
}' |
apify call mack2strategy/socrata-building-permit-alerts --silent --output-dataset

```

## MCP server setup

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

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/70OOfQYevRZr25xHQ/builds/9esc3XCR7p8DJNbcF/openapi.json
