# Santa Monica CA Building Permits API — New Permit Feed (`themartygriffin/santa-monica-building-permits-feed`) Actor

Santa Monica building permit API — new permits since your last run with address, work description and valuation. Filter by ZIP, type or keyword.

- **URL**: https://apify.com/themartygriffin/santa-monica-building-permits-feed.md
- **Developed by:** [Marty Griffin](https://apify.com/themartygriffin) (community)
- **Categories:** Real estate, Business, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.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.

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

## New Santa Monica Building Permits Since Your Last Run

Get the **City of Santa Monica building permits issued since your last run**, without sorting through ones you have already seen. Each run returns only the new ones, with address, ZIP, valuation, work description, permit type and sub-type. Schedule it and you have a running list of where work is being permitted in Santa Monica. Pay per permit, once: $0.002 the first time a permit is reported to you, never again.

Useful if you sell roofing, solar or other services to property owners, or supply materials to jobs, or track local building activity. You get addresses and project details. You do not get who is doing the work.

### Not included: read this before you run it

> **No contractor, owner or applicant names.** The city's dataset has no such column. This Actor cannot tell you who pulled a permit.
>
> **Active permits only.** The source is the city's "Active Building & Safety Permits" list, not a permit history. Permits that are finished or closed drop out of it. A 30-day backfill therefore returns the permits issued in that window that are *still active*, which can be fewer than were issued.
>
> **City of Santa Monica only.** Not LA County or any other city.
>
> **Pressing Start twice does not bill twice.** The Start form is prefilled with `mode: backfill` and `include_already_reported: on`. On a repeat run that returns the permits again in the dataset, but only permits you have never been sent before are charged. Turn `include_already_reported` off if you want only new permits in the dataset.
> More limits you should know about:

- **`include_already_reported` changes the dataset, never the bill.** On, a backfill returns permits you were already sent (free, no charge event). Off, it leaves them out. It is prefilled on so Apify's automated daily test always gets a non-empty dataset.
- **A permit that disappears produces nothing.** If a permit leaves the active list (completed, closed, withdrawn) the Actor reports no event for it. It is not a "new permit", and "removed" or "closed" events are not part of this product. If it later reappears it is still not re-reported (and never charged twice).
- **Permits with no issue date are never reported.** The city stores a missing date as `1900-01-01`. The Actor treats that as no date, never as a real one. 10 of 1,919 rows had it at test time. A permit without a real issue date cannot be placed in time, so it is skipped (in both modes) until the city gives it one.
- **ZIP is not a source column.** It is read from the end of the address. About 125 of 1,919 permits have no usable ZIP (blank address, or the city's `00000` placeholder). Those never match a ZIP filter and have `zip: null`.
- **Many fields can be empty:** `description`, `valuation` (stored as 0.0 on some permits, which means "not stated" more often than "free"), `latitude`, `longitude`, `address`, `unit`.
- **Valuation is the applicant's stated figure, not a project cost.**
- **"Permit type" is coarse.** The city's `permit_type` is only Residential, Commercial or Mixed Use. The useful kind (Building Combo, Roofing, Electrical, Photovoltaic, Demolition...) is `permit_sub_type`. Both can be filtered.
- **Dates are dates, not times.** The source gives an issue date only.
- **Late-entered permits** are caught for 30 days behind the newest issue date. One entered with an older issue date than that is not caught.
- **"Already reported" memory lasts 3650 days of issue dates, the same as the maximum `lookback_days`.** No backfill can reach a permit the Actor has forgotten, so a permit is never billed twice because of memory expiry. Permits are also remembered account-wide, not per `state_key`, for billing (see Pricing).
- **Backfill is capped** by `max_results` (default 1000) charged permits, oldest first. Permits returned again for free do not count toward the cap.
- **The city can correct data at any time.** We do not re-report changed fields.
- **How often the city refreshes the file was not measured.** Do not assume daily. At test time the newest issue date was 2026-11-10, two days before the run.

### How it works

1. **`backfill`** (run once): returns permits issued in the last N days (`lookback_days`, default 30, 1 to 3650, equal to the memory window) and saves a watermark (the newest real issue date) plus the permit numbers already reported, in a named key-value store (`sm-permits-state`).
2. **`new`** (schedule this): returns permits issued since the watermark (re-reading 30 days behind it) that were not reported before, and advances the watermark. If there is no saved state it stops and tells you to run `backfill` first. It does not quietly return nothing.

The Start form shows `mode: backfill`. The default when a field is left out of the input is `new`.

The Actor downloads the city's **bulk CSV file once per run** (about 830 KB, about 1,900 rows). It does not call the city's `/api/` endpoints, because the city's `robots.txt` disallows them with a 10-second crawl delay.

### Filters (all optional)

| Input | Meaning |
|---|---|
| `mode` | `new` (default) or `backfill` (prefilled on the form). |
| `lookback_days` | Backfill only. Default 30, range 1 to 3650. |
| `include_already_reported` | Backfill only. Default off, **form prefill on** (see above). On also returns permits already reported, free of charge. Never changes what is billed. |
| `permit_types` | `Residential`, `Commercial`, `Mixed Use`. Empty means all. |
| `permit_sub_types` | e.g. `Building Combo`, `Electrical`, `Roofing`, `Mechanical`, `Plumbing`, `Photovoltaic`, `Demolition`, `Sign`, `EV Chargers`. Case-insensitive. |
| `min_valuation` / `max_valuation` | USD. Permits with no valuation are excluded when either is set. |
| `zip_codes` | List of 5-digit ZIPs (90401 to 90405 cover most permits). |
| `keywords` | Report a permit if its description contains any of these fragments (solar, ADU, roof). Substring, case-insensitive. |
| `max_results` | Safety cap on permits, and therefore charges, per run. Default 1000, oldest first. |
| `state_key` | Name of the saved state. Default `default`. **Use a separate name for each filter set you schedule.** |

"Already reported" is tracked per `state_key`, not per filter set. Changing filters under the same name will not re-report permits already sent.

### Output

One dataset item per permit. A real record (five records are in `sample-output.json`):

```json
{
  "permit_number": "25BLD-4492",
  "issue_date": "2026-10-13",
  "permit_type": "Residential",
  "permit_sub_type": "Building Combo",
  "status": "Issued",
  "description": "Unit #309 - Remove and replace the balcony coating over the replaced balcony sheathing. ...",
  "address": "1131 12TH ST SANTA MONICA, CA 90403",
  "zip": "90403",
  "unit": "#309",
  "valuation": 50000.0,
  "number_of_units": 0.0,
  "class_code": "434",
  "class_code_description": "Add or Alter Dwellings (No Increase or Decrease In Units)",
  "parcel_no": "4281019036",
  "date_entered": "2025-11-24",
  "date_expires": "2027-05-05",
  "latitude": 34.02610634,
  "longitude": -118.49121446,
  "source": "City of Santa Monica, Active Building & Safety Permits (ODC-BY 1.0)",
  "first_seen_at": "2026-11-12T13:21:13Z"
}
```

`first_seen_at` is when this Actor first reported the permit (UTC), not when the city issued it. `class_code` is passed through as the city publishes it; some rows hold the code only (`434`), others the code plus its text. Dates equal to the city's `1900-01-01` placeholder are `null`.

### Pricing

Pay per event. One **`permit-issued`** event is charged the first time a permit is written to your dataset. Permits already reported to you are written without the event.

- **Charged:** each permit not reported to you before.
- **Price:** $0.002 per permit.
- **Not charged:** permits already reported to you, whether they are skipped or (with `include_already_reported` on) returned again; a repeat backfill; the same permit under a different `state_key`; a permit listed twice in the city file; permits removed by your filters; runs that find nothing new. The record of charged permits is kept for 3650 days of issue dates and saved after every batch, so a crashed run that is restarted is not billed twice for what it already delivered.
- **Known limit:** two runs started at the same moment under the same account can both see a permit as new before either saves it. Do not run the same backfill concurrently.
- **Capping spend:** set `max_results` and use Apify's maximum cost per run. If the cost limit stops a run early, only the permits actually delivered are recorded as reported, and the rest come on the next run.
- **Testing cheaply:** a backfill is billed for every permit it reports for the first time, so start with a small `lookback_days` and your filters.

### Real run output

**On the Apify platform (2026-11-12):** a 30-day backfill emitted 330 permits, and a `new` run straight after emitted 0. The logs below are from the matching local run (Raspberry Pi, home internet, Apify SDK 4.2.1, Python 3.13, via `apify run`), where charging is a no-op, so there are no billing lines.

**Source check.** The bulk file returned HTTP 200, 1,919 data rows, 832 KB, in 0.6 s. Of those rows: 10 had `date_issued = 1900-01-01`, 1,918 had a blank `_id` (so permit number is the key; it was unique), `permit_type_desc` was blank on all rows, and the newest issue date was 2026-11-10.

**1. `mode: backfill`, `lookback_days: 30`:** 330 permits (the 10 placeholder-date rows excluded), watermark 2026-11-10:

```
mode=backfill state=default reading permits with issue date >= 2026-10-13 (watermark=None, known ids=0)
downloaded 1919 active permits
backfill: considered 330 permits in window, emitted 330 (charged 330, already reported and free 0), skipped 0 already reported, ignored 10 with no issue date; watermark=2026-11-10
```

**2. `mode: new`, immediately after:** zero permits:

```
mode=new state=default reading permits with issue date >= 2026-10-13 (watermark=2026-11-10, known ids=330)
new: considered 330 permits in window, emitted 0 (charged 0, already reported and free 0), skipped 330 already reported, ignored 10 with no issue date; watermark=2026-11-10 - nothing new since the last run
```

**3. Stored state** (key-value store `sm-permits-state`, key `STATE-default`): `{'watermark': '2026-11-10', 'floor': '2026-10-13', 'seen': 330 ids, 'last_mode': 'new'}`.

Other checks from the same session: with a local copy of the file in which one permit was added, one had a `1900-01-01` issue date and one active permit was removed, `new` emitted exactly the one added permit, ignored the placeholder-date one and reported nothing for the removed one; the next `new` run emitted 0. A repeat `backfill` with `include_already_reported` on returned all 330 again, none charged (the log line reads "charged 0, already reported and free 330"); with it off, 0. `new` with no saved state exits with the "run backfill first" message.

**Run time:** download 0.6 s and parsing 0.04 s for the whole file; a full local `apify run` took 4 to 9 s including Python and SDK start-up. Platform container start-up time is not reported here.

### Attribution and terms

Data: **City of Santa Monica**, "Active Building & Safety Permits", https://data.santamonica.gov/dataset/active-building-and-safety-permits, published under the **Open Data Commons Attribution License (ODC-BY 1.0)**. The data is used as published and attribution to the City of Santa Monica is required in anything you build from it. This Actor is not affiliated with or endorsed by the City of Santa Monica. No credentials or API key are used.

# Actor input Schema

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

'backfill' returns permits issued in the last N days and saves the state; it is the default, so a first run returns real results. 'new' returns only permits not reported by an earlier run and needs saved state - it exits with an empty dataset if you have never run 'backfill'.

## `lookback_days` (type: `integer`):

Backfill only. Return permits issued in the last this many days (1 to 3650, the same span the Actor remembers reported permits for). Only active permits are in the source, so older windows return fewer permits than were really issued.

## `include_already_reported` (type: `boolean`):

Backfill only. Controls whether permits an earlier run already reported appear in the dataset again. Off (the default): they are left out. On: they are returned again. It never changes what you are charged: a permit is billed once, the first time it is reported, and re-reported permits are free. Permits are remembered for 3650 days of issue dates, which covers the longest lookback.

## `permit_types` (type: `array`):

Exact values of the city's 'permit_type' column: Residential, Commercial, Mixed Use. Empty means all.

## `permit_sub_types` (type: `array`):

Exact values of the city's 'permit_sub_type' column, e.g. Building Combo, Electrical, Roofing, Mechanical, Plumbing, Photovoltaic, Demolition, Sign. Case-insensitive. Empty means all.

## `min_valuation` (type: `integer`):

Only permits with a stated valuation at or above this. Permits with no valuation are excluded when a valuation filter is set.

## `max_valuation` (type: `integer`):

Only permits with a stated valuation at or below this.

## `zip_codes` (type: `array`):

5-digit ZIPs, e.g. 90401, 90402, 90403, 90404, 90405. The source has no ZIP column; it is read from the end of the address, and is missing on some permits (those never match a ZIP filter).

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

Report a permit if its work description contains any of these text fragments (solar, ADU, roof). Substring match, case-insensitive, not whole-word.

## `max_results` (type: `integer`):

Safety cap on charged permits (new, never reported before) per run. Permits returned again for free do not count. Oldest first; the rest come on the next run.

## `state_key` (type: `string`):

Name of the saved state (watermark and reported permit numbers). Use a separate name for each filter set you schedule.

## Actor input object example

```json
{
  "mode": "backfill",
  "lookback_days": 30,
  "include_already_reported": true,
  "max_results": 1000,
  "state_key": "default"
}
```

# 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 = {
    "mode": "backfill",
    "lookback_days": 30,
    "include_already_reported": true,
    "max_results": 1000,
    "state_key": "default"
};

// Run the Actor and wait for it to finish
const run = await client.actor("themartygriffin/santa-monica-building-permits-feed").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 = {
    "mode": "backfill",
    "lookback_days": 30,
    "include_already_reported": True,
    "max_results": 1000,
    "state_key": "default",
}

# Run the Actor and wait for it to finish
run = client.actor("themartygriffin/santa-monica-building-permits-feed").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 '{
  "mode": "backfill",
  "lookback_days": 30,
  "include_already_reported": true,
  "max_results": 1000,
  "state_key": "default"
}' |
apify call themartygriffin/santa-monica-building-permits-feed --silent --output-dataset

```

## MCP server setup

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

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/jTvsGGZV0Smh5IcYT/builds/6Zx44WO32vXSo1rhW/openapi.json
