# Alameda County Restaurant Inspection Scraper (`crawlerbros/alameda-county-restaurant-inspection-scraper`) Actor

Scrape restaurant health inspection records for Alameda County, CA (Oakland, Berkeley, Fremont, Hayward + 15 more) - name, address, placard grade, violations, geolocation. Search by name, city, facility ID, or location.

- **URL**: https://apify.com/crawlerbros/alameda-county-restaurant-inspection-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, Developer tools, Integrations
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Alameda County Restaurant Inspection Scraper

Scrape restaurant and food-facility health inspection records for **Alameda County, California** — Oakland, Berkeley, Fremont, Hayward, Livermore, Pleasanton, San Leandro, Alameda, Albany, Emeryville, Dublin, Union City, Newark, Piedmont, Castro Valley, San Lorenzo, Ashland, Sunol, and Akron. Get facility name, address, ZIP code, inspection date, color-coded placard grade (Green/Yellow/Red), violation descriptions, and precise geolocation — sourced directly from the county's public health department open-data feed. No login, no cookies, no paid proxy required.

### What this actor does

- **Five lookup modes:** search by restaurant name, browse by city, look up an exact facility ID, browse by ZIP code, or find inspections near a lat/lon point
- **Rich filtering:** placard grade, inspection service code, ZIP code, and inspection-date range — usable together or in any combination, on top of any mode
- **Live county data** — pulled straight from Alameda County's public ArcGIS open-data feed, refreshed by the county on an ongoing basis
- **Geolocation on every record** — latitude/longitude plus a ready-to-click Google Maps link
- **Empty fields are omitted** — every emitted record only contains fields that could actually be populated

### Output per inspection record

- `facilityId` — county facility identifier (e.g. `FA0000154`)
- `externalId`, `objectId` — internal record identifiers
- `facilityName`, `address`, `city`, `state`, `zipCode`
- `latitude`, `longitude`
- `activityDate` — inspection date (`YYYY-MM-DD`)
- `inspectionServiceCode` — county inspection/activity service code
- `violationDescription` — the specific violation noted during this inspection
- `grade` — posted placard letter (`G`/`Y`/`R`/`C`/`M`)
- `gradeLabel` — friendly label for `G` (Green — Pass), `Y` (Yellow — Conditional Pass), `R` (Red — Closed/Failed)
- `mapUrl` — Google Maps link built from the facility's coordinates
- `sourceUrl` — the live county REST endpoint returning this exact record
- `recordType: "restaurantInspection"`, `scrapedAt`

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | select | `search` | `search` / `byCity` / `byFacilityId` / `byZip` / `nearby` |
| `searchQuery` | string | `pizza` | Facility-name keyword (mode=search) |
| `cities` | array (select) | – | Cities to browse or filter to (mode=byCity, or an extra filter on any mode) |
| `facilityIds` | array | – | Exact facility IDs (mode=byFacilityId) |
| `latitude` / `longitude` | number | `37.8044` / `-122.2712` | Center point (mode=nearby) |
| `radiusKm` | number | `2` | Search radius in km (mode=nearby) |
| `grades` | array (select) | – | Filter by placard grade(s) |
| `inspectionServiceCodes` | array (select) | – | Filter by county service code(s) |
| `zipCodes` | array | – | ZIP codes to browse (mode=byZip), or an extra filter on any mode |
| `dateFrom` / `dateTo` | string | – | Inspection date range (`YYYY-MM-DD`) |
| `sortBy` | select | `newest` | `newest` / `oldest` (by inspection date) |
| `maxItems` | integer | `100` | Hard cap on emitted records (1–5000) |

#### Example: search a keyword, restrict to one city and grade

```json
{
  "mode": "search",
  "searchQuery": "taqueria",
  "cities": ["OAKLAND"],
  "grades": ["G"],
  "maxItems": 100
}
```

#### Example: browse every inspection in a city within a date range

```json
{
  "mode": "byCity",
  "cities": ["BERKELEY", "ALBANY"],
  "dateFrom": "2025-01-01",
  "dateTo": "2025-12-31",
  "maxItems": 500
}
```

#### Example: browse every inspection in a ZIP code

```json
{
  "mode": "byZip",
  "zipCodes": ["94612", "94607"],
  "maxItems": 200
}
```

#### Example: exact facility lookup

```json
{
  "mode": "byFacilityId",
  "facilityIds": ["FA0000154"]
}
```

#### Example: inspections near a point

```json
{
  "mode": "nearby",
  "latitude": 37.8044,
  "longitude": -122.2712,
  "radiusKm": 1.5,
  "maxItems": 100
}
```

### Use cases

- **Consumer safety apps** — surface up-to-date placard grades near a user's location
- **Real-estate / relocation research** — check food-safety history around a neighborhood before moving
- **Journalism & public-health research** — track violation trends across Alameda County cities over time
- **Restaurant discovery apps** — filter listings to Green-placard establishments only
- **Compliance monitoring** — franchise operators tracking inspection history for their own locations by facility ID

### FAQ

**What area does this cover?** All cities and unincorporated communities in Alameda County, CA served by the county's Department of Environmental Health (the City of Berkeley runs its own health department but is included in this feed where reported).

**What do the grade letters mean?** `G` (Green) = Pass, `Y` (Yellow) = Conditional Pass (two or more major violations), `R` (Red) = Notice of Closure. `C` and `M` are rarer county-specific categories (e.g. cottage-food/home-kitchen operations) without a documented public meaning — the raw letter is always included.

**Is one row per restaurant or per violation?** One output record = one violation line item tied to a specific inspection visit. A single inspection with 5 noted violations produces 5 records sharing the same `facilityId` and `activityDate`.

**How current is the data?** The county updates the feed on an ongoing basis; records typically appear within days of the inspection.

**Do I need a proxy or login?** No. This is a public, unauthenticated open-data API — no cookies, no paid proxy, no API key.

**Can I search multiple cities or grades at once?** Yes — `cities`, `grades`, `inspectionServiceCodes`, and `zipCodes` all accept multiple values and are combined with AND logic across filter types, OR logic within each filter.

**What if my filters match nothing?** The actor finishes cleanly with 0 records and a status message explaining that no matches were found — try widening the date range or removing a filter.

# Actor input Schema

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

What to fetch.

## `searchQuery` (type: `string`):

Free-text keyword matched against the facility name (case-insensitive, partial match).

## `cities` (type: `array`):

One or more Alameda County cities/unincorporated areas to browse. Also usable as an extra filter on other modes.

## `facilityIds` (type: `array`):

Exact Alameda County facility IDs, e.g. `FA0000154`. Returns the full inspection/violation history for each facility.

## `latitude` (type: `number`):

Center point latitude in decimal degrees, e.g. `37.8044` (Oakland).

## `longitude` (type: `number`):

Center point longitude in decimal degrees, e.g. `-122.2712` (Oakland).

## `radiusKm` (type: `number`):

Distance from the center point to search within.

## `grades` (type: `array`):

Restrict to one or more posted placard grades. Green = Pass, Yellow = Conditional Pass, Red = Closed/failed. C and M are rarer county-specific categories (e.g. cottage-food/home-kitchen operations).

## `inspectionServiceCodes` (type: `array`):

Restrict to one or more internal county service/activity codes recorded against the inspection.

## `zipCodes` (type: `array`):

One or more 5-digit ZIP codes to browse (mode=byZip). Also usable as an extra filter on other modes.

## `dateFrom` (type: `string`):

Only include inspections on or after this date.

## `dateTo` (type: `string`):

Only include inspections on or before this date.

## `sortBy` (type: `string`):

Order inspection records by activity date.

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

Hard cap on emitted records.

## Actor input object example

```json
{
  "mode": "search",
  "searchQuery": "pizza",
  "cities": [],
  "facilityIds": [],
  "latitude": 37.8044,
  "longitude": -122.2712,
  "radiusKm": 2,
  "grades": [],
  "inspectionServiceCodes": [],
  "zipCodes": [],
  "sortBy": "newest",
  "maxItems": 100
}
```

# Actor output Schema

## `inspections` (type: `string`):

Dataset containing all scraped restaurant inspection records.

# 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": "search",
    "searchQuery": "pizza",
    "cities": [],
    "facilityIds": [],
    "latitude": 37.8044,
    "longitude": -122.2712,
    "radiusKm": 2,
    "grades": [],
    "inspectionServiceCodes": [],
    "zipCodes": [],
    "sortBy": "newest",
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/alameda-county-restaurant-inspection-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 = {
    "mode": "search",
    "searchQuery": "pizza",
    "cities": [],
    "facilityIds": [],
    "latitude": 37.8044,
    "longitude": -122.2712,
    "radiusKm": 2,
    "grades": [],
    "inspectionServiceCodes": [],
    "zipCodes": [],
    "sortBy": "newest",
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/alameda-county-restaurant-inspection-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 '{
  "mode": "search",
  "searchQuery": "pizza",
  "cities": [],
  "facilityIds": [],
  "latitude": 37.8044,
  "longitude": -122.2712,
  "radiusKm": 2,
  "grades": [],
  "inspectionServiceCodes": [],
  "zipCodes": [],
  "sortBy": "newest",
  "maxItems": 100
}' |
apify call crawlerbros/alameda-county-restaurant-inspection-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crawlerbros/alameda-county-restaurant-inspection-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/WX2dOjUV2ccPzb5JD/builds/0i5HCEtM3OTt3rqB3/openapi.json
