# CA County Sheriff Incidents - Marin & Sonoma (`j0401/ca-sheriff-incidents`) Actor

Two California county sheriff incident feeds in one actor - Marin County Sheriff Reported Crimes and Sonoma County Sheriff's Office Incident Data (383K incidents). Filter by county, city, incident type or date; aggregate by type, city or year. Both feeds are anonymous.

- **URL**: https://apify.com/j0401/ca-sheriff-incidents.md
- **Developed by:** [Wenhao Yang](https://apify.com/j0401) (community)
- **Categories:** Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.06 / 1,000 ca county sheriff incident records

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

## California County Sheriff Incidents - Marin & Sonoma

The Bay Area county sheriff's-office incident feeds - two counties in one
actor, live and queryable. Marin Sheriff Reported Crimes and Sonoma Sheriff's
Office Incident Data together cover ~383k incidents across the counties'
unincorporated areas and sheriff-contract cities.

### Data

California county public open data (Marin County + Sonoma County sheriff's
office feeds). Two sources, both anonymous and both actively updated:

- **Marin** - `~52,800` incidents (2013-present, latest September 2026):
  compact crime code (`THEFT` / `BURG RES` / `ASSAULT` / `DOM VIOL` ...), an
  FBI-style crime class (`Theft` / `Burglary - Residential` / `Assault - Other`
  ...), incident date/time, masked street address, city/community, jurisdiction
  and coordinates.
- **Sonoma** - `~329,900` incidents (2003-present, latest September 2026):
  plain-language incident type (`Burglary` / `Assault - Other` / `Larceny` /
  `Vandalism` / `Drug Offense` ...), location type (residence / highway /
  park ...), city and intersection.

### Low cost

**From $0.00006 per record**

Both counties publish these as wide flat tables where one is keyed by compact
crime abbreviations and the other by free-text type labels - each useful once
you know what you're looking at, painful to cut across a date range or a city.
We made the feeds directly queryable: pick a county, then filter by date
window / `city` / `incidentType` / (Marin) `incidentClass` before a record
returns, and `groupBy` (counts by city / type / class / year) comes back as
clean server counts. You query two sheriff's logs that behave like a database;
the cleanup stays on our side.

**Every record is one flat JSON object** - no PDFs, no portal pagination.

### Use cases

- **Claims & underwriting** - what incidents happened in a community or
  category over a window
- **Neighborhood-safety analysis** - aggregate by city / type / year to see
  incident patterns across the two counties
- **Diligence** - confirm an incident by its case number

### Inputs

| Field | What it does |
|---|---|
| `county` | marin or sonoma (default sonoma) |
| `incidentNumber` | exact incident / case lookup |
| `city` | city or community |
| `incidentType` | type substring (Sonoma text / Marin code) |
| `incidentClass` | Marin FBI-style class (ignored on Sonoma) |
| `fromDate` / `toDate` | incident-date window |
| `recentDays` | incidents in the last N days |
| `aggregate` + `groupBy` | counts by city / type / class / year |

### Output fields

`date` / `time` / `year` / `county` / `city` / `incidentType` /
`incidentClass` / `locationType` / `incidentNumber` / `address` /
`intersection` / `latitude` / `longitude` / `agency` / `jurisdiction`.

> Honesty note: both feeds are anonymous. Marin masks the street number
> (`XX ST VINCENTS DR`); Sonoma gives only an intersection (no street address)
> and no coordinates. Incident data supports geographic / statistical
> questions, not individual screening.

Source: Marin County open data (Sheriff Reported Crimes) + Sonoma County open
data (Sheriff's Office Incident Data), public records.

# Actor input Schema

## `county` (type: `string`):

County sheriff feed. sonoma (~330k, plain-language incident types) or marin (~52.8k, crime codes + FBI class + geo).

## `incidentNumber` (type: `string`):

Exact incident number (e.g. SD221215002, SO260002287).

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

City or community (e.g. 'SANTA ROSA', 'SAN RAFAEL', 'NOVATO').

## `incidentType` (type: `string`):

Incident-type substring. Sonoma: plain language ('Assault', 'Burglary', 'Vandalism'). Marin: compact code ('THEFT', 'BURG RES').

## `incidentClass` (type: `string`):

Marin-only FBI-style class substring (e.g. 'Burglary', 'Theft'). Ignored on Sonoma.

## `fromDate` (type: `string`):

Only incidents on/after this date (YYYY-MM-DD).

## `toDate` (type: `string`):

Only incidents on/before this date (YYYY-MM-DD).

## `recentDays` (type: `integer`):

Only incidents in the last N days.

## `aggregate` (type: `boolean`):

When on, returns one summary record per group (see groupBy) with a count instead of individual incidents.

## `groupBy` (type: `string`):

Which dimension to aggregate over. incidentClass is Marin-only (Sonoma has no class column). year = annual incident counts.

## `maxResults` (type: `integer`):

Cap the number of records pushed (0 = up to ~10k per run — practical page limit). Aggregates have a few hundred groups max.

## Actor input object example

```json
{
  "county": "sonoma",
  "incidentNumber": "",
  "city": "",
  "incidentType": "",
  "incidentClass": "",
  "fromDate": "",
  "toDate": "",
  "recentDays": 0,
  "aggregate": false,
  "groupBy": "city",
  "maxResults": 50
}
```

# Actor output Schema

## `recordsUrl` (type: `string`):

California county sheriff (Marin / Sonoma) incident records or aggregates - as JSON

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

No description

## `runUrl` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("j0401/ca-sheriff-incidents").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("j0401/ca-sheriff-incidents").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 j0401/ca-sheriff-incidents --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,j0401/ca-sheriff-incidents"
        }
    }
}
```

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/sRXtfePIdRP6wg6WI/builds/C22WA9TAX4ee8iTV2/openapi.json
