# US Restaurant Inspection & Food Establishment Scraper (`scrapesage/us-restaurant-inspection-scraper`) Actor

Scrape US restaurant & food-establishment leads with official health-inspection data from 5 city portals (NYC, Chicago, Seattle, Austin, SF): name, address, phone, cuisine, latest grade/score, violations, risk, closures, new-opening signals + lead score & monitoring. No browser.

- **URL**: https://apify.com/scrapesage/us-restaurant-inspection-scraper.md
- **Developed by:** [Scrape Sage](https://apify.com/scrapesage) (community)
- **Categories:** Lead generation, Agents, Integrations
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 food establishment leads

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?

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

## US Restaurant Inspection & Food Establishment Scraper — Leads + Health Inspections

> **Disclaimer:** This Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by US city and state health-inspection portals or any government body. All trademarks mentioned are the property of their respective owners. "US city and state health-inspection portals" is referenced only to describe the public data source this Actor collects from.

Turn official **city health-department open data** into the **richest US restaurant & food-establishment lead list anywhere** — every record is one food business with its firmographics **and** its full health-inspection intelligence: name, address, phone, cuisine / facility type, geo, the **latest letter grade & score**, **critical-violation counts**, **risk level**, **closures**, **inspection history**, a **new-opening signal**, and a 0–100 **lead score**.

Covers five major metros across NY, IL, WA, TX and CA — **New York City, Chicago, Seattle/King County, Austin/Travis County and San Francisco** — in one unified schema, with monitoring. No login, no API key, no browser.

### Why this food-establishment scraper?

Generic Google-Maps and directory scrapers give you a name and a pin — and **every** competitor already sells that exact list. This actor reads the **official regulatory record** straight from each city's health department, so you get the data no Maps scraper has: who just **opened**, who's a **high-risk** high-volume kitchen, who got **critical violations**, and who was **closed** — the signals that make a food-service lead list convert.

| Data | Google-Maps / directory scrapers | This actor |
|---|---|---|
| Business name + full address | ✅ | ✅ |
| Phone | ✅ | ✅ (NYC, Seattle, SF) |
| Cuisine / facility type | partial | ✅ |
| Latitude / longitude | ✅ | ✅ (where published) |
| **Latest health-inspection grade / score** | ❌ | ✅ |
| **Unified compliance tier** (good → closed) | ❌ | ✅ |
| **Critical vs non-critical violation counts + detail** | ❌ | ✅ |
| **Risk level** (high-volume kitchens) | ❌ | ✅ |
| **Closed-by-health-dept / out-of-business flag** | ❌ | ✅ |
| **Inspection history + accurate first-inspection date** | ❌ | ✅ |
| **Newly-opened signal** (GTM intent) | ❌ | ✅ |
| Official, citable government source | ❌ | ✅ |
| Lead score (0–100) | ❌ | ✅ |
| **Monitoring** — only new / re-inspected / changed | ❌ | ✅ |

### Use cases

- **Food-service B2B lead generation** — restaurants are active buyers of POS systems, online-ordering & delivery tech, broadline food distributors & suppliers, packaging, commercial kitchen equipment, payroll, insurance, pest control and marketing. Export name, address, phone, cuisine and lead score, filter with `withPhoneOnly`, and feed your CRM.
- **Reach new openings first** — a brand-new restaurant needs *everything*. Turn on `newlyOpenedOnly` to get establishments whose **first inspection** is recent — the highest-intent leads in the market, before your competitors find them.
- **Compliance, pest-control & remediation prospecting** — filter to `complianceTiers: ["needs_improvement","poor"]` or `hasCriticalViolationsOnly` to reach operators with an active hygiene problem and budget to fix it.
- **Food-safety & insurance risk scoring** — append official grades, scores, violation counts and risk levels to your underwriting or supplier-vetting models.
- **Market & competitor intelligence** — map every food venue in a metro by cuisine, facility type, grade distribution and closure rate; track openings and closures over time.
- **Turnover & distressed-asset signals** — `closedOnly` surfaces establishments shut by the health department or marked out of business (great for equipment liquidators, brokers and landlords).

### How to use

1. [Sign up for Apify](https://console.apify.com/sign-up) — the free plan is enough to try this actor.
2. Open the **US Restaurant Inspection & Food Establishment Scraper**, pick the **cities** you want, add any filters (cuisine, ZIP, compliance tier, newly-opened…), set **Max results**, and click **Start**.
3. Watch establishment leads stream into the dataset table.
4. **Export** as JSON, CSV, Excel, XML, or RSS — or pull results programmatically via the [Apify API](https://docs.apify.com/api/v2).

### Input

```json
{
    "sources": ["nyc", "chicago", "king-wa", "austin", "sf"],
    "categoryQuery": "Pizza",
    "complianceTiers": ["needs_improvement", "poor"],
    "withPhoneOnly": true,
    "sortBy": "recentInspection",
    "maxResults": 500
}
```

- **sources** *(default all 5)* — which city portals to query: `nyc`, `chicago`, `king-wa` (Seattle/King County), `austin`, `sf`.
- **nameQuery** — business name contains (e.g. `Starbucks`, `Taqueria`).
- **categoryQuery** — cuisine or facility type contains (`Italian`, `Bakery`, `Grocery Store`, `Mobile Food`).
- **cities / zipCodes** — narrow to boroughs / suburbs / ZIPs inside a metro.
- **complianceTiers** — `good`, `needs_improvement`, `poor`, `closed`, `unknown`.
- **grades** — source letter grades (NYC `A`/`B`/`C`; Seattle `1`–`4`).
- **hasCriticalViolationsOnly / highRiskOnly** — target operators with active problems / high-volume kitchens.
- **newlyOpenedOnly** *(+ `newOpeningDays`, default 365)* — only recently-opened establishments (top GTM intent).
- **excludeClosed / closedOnly / withPhoneOnly** — list hygiene.
- **inspectionDateFrom / inspectionDateTo** — inspection date window (`YYYY-MM-DD`).
- **includeInspectionHistory** *(default true)* — attach per-establishment history + the accurate first-inspection date & total inspection count.
- **sortBy** — `recentInspection`, `newlyOpened`, `leadScore`, `worstCompliance`, `none`.
- **maxResults / maxResultsPerSource** — caps (per source and overall).
- **monitorMode** *(+ `monitorKey`)* — only emit establishments new / re-inspected / changed since the last run.
- **proxyConfiguration** — optional; the government portals are fetched directly and need no proxy.

### Output

One clean record per establishment (`recordType: "establishment"`), aggregated from its entire inspection history:

```json
{
    "recordType": "establishment",
    "source": "nyc",
    "sourceLabel": "DOHMH New York City Restaurant Inspection Results",
    "city": "New York City",
    "state": "NY",
    "establishmentId": "50090295",
    "businessName": "Kabayan Restaurant And Bakery",
    "cuisine": "Filipino",
    "facilityType": null,
    "businessCategory": "Filipino",
    "address": "161-18 Union Turnpike, Queens, NY 11366",
    "street": "161-18 Union Turnpike",
    "addressCity": "Queens",
    "addressState": "NY",
    "zip": "11366",
    "latitude": 40.7211,
    "longitude": -73.7896,
    "phone": "(718) 380-0802",
    "hasPhone": true,
    "latestInspectionDate": "2026-06-17",
    "latestInspectionType": "Cycle Inspection / Initial Inspection",
    "latestResult": "Violations were cited in the following area(s).",
    "complianceTier": "poor",
    "latestScore": 41,
    "scoreScale": "lower_better",
    "latestGrade": "Z",
    "latestGradeLabel": "Grade Pending",
    "riskLevel": null,
    "isClosed": false,
    "criticalViolationCount": 6,
    "nonCriticalViolationCount": 3,
    "totalViolationsLatest": 9,
    "violations": [
        { "code": "06C", "description": "Food not protected from contamination during storage, preparation, transportation or display.", "critical": true, "points": null }
    ],
    "totalInspectionsOnRecord": 7,
    "firstInspectionDate": "2023-12-08",
    "historyScope": "complete",
    "inspectionHistory": [
        { "date": "2026-06-17", "type": "Cycle Inspection / Initial Inspection", "result": "Violations were cited in the following area(s).", "score": 41, "grade": "Z", "riskRaw": null, "closed": false, "criticalViolationCount": 6, "violationCount": 9 }
    ],
    "isNewlyOpened": false,
    "recentlyInspected": true,
    "hasCriticalViolations": true,
    "isHighRisk": false,
    "recentlyClosed": false,
    "leadScore": 72,
    "sourceFields": { "camis": "50090295", "dba": "BO's Bagels", "boro": "Manhattan" },
    "scrapedAt": "2026-06-20T18:00:00.000Z"
}
```

`sourceFields` carries the **full raw inspection row** from the portal, so nothing is lost.

#### What to expect (field coverage)

This is official government data, so each city publishes a different subset of fields. Across the five sources you can expect:

| Field | Source coverage |
|---|---|
| Business name, address, latest inspection, grade/score, compliance tier, lead score | **all sources, ~100%** |
| **Phone** | NYC, Seattle/King County, San Francisco |
| **Cuisine** | NYC |
| **Facility type** | Chicago, Seattle/King County |
| **Risk level** | Chicago, Seattle/King County, San Francisco |
| **Letter grade** | NYC (A/B/C), Seattle (1–4) |
| **Violation detail** | NYC, Chicago, Seattle/King County, San Francisco |
| **Closure flag** | NYC, Chicago, Seattle/King County |
| **Accurate first-inspection date & history** | all sources (resolved server-side) |

A field is blank only when that city doesn't publish it — never because scraping failed. **Note:** NYC, Chicago, Seattle and Austin update daily/weekly; San Francisco's LIVES dataset refreshes less often, so its records skew older.

#### Compliance tier

Every source grades differently (NYC = A/B/C letters + a *lower-is-better* score; Chicago = Pass/Fail; Seattle = 1–4 + score; Austin/SF = *higher-is-better* 0–100). The actor normalizes them into one portable **`complianceTier`** — `good` · `needs_improvement` · `poor` · `closed` · `unknown` — while always keeping the raw `latestGrade` / `latestScore` / `scoreScale` so you can read the original.

### How much does it cost to scrape US city and state health-inspection portals?

This Actor uses Apify's **pay-per-event** pricing: you are charged only for the results it delivers, with no monthly rental and no start fee. The events it can charge are:

- **Food establishment lead** - One food-establishment lead record aggregated from an official city/county health-inspection portal: business name, address, phone, cuisine / facility type & geo, plus the latest inspection (result, letter grade, score, compliance tier, risk level, violation counts and detail, closure flag), inspection history with the first-inspection date, GTM signals and a derived 0–100 lead score.

The current price of each event is shown on the **Pricing** tab of this page. Set a maximum total charge on the run if you want a hard cap on spend, and use the input limits to control how much the Actor fetches.

### Automate & schedule

Run this actor on autopilot and pull results into your own stack:

- **[Apify API](https://docs.apify.com/api/v2)** — start runs, fetch datasets, and manage schedules over REST.
- **[apify-client for JavaScript](https://docs.apify.com/api/client/js/)** and **[apify-client for Python](https://docs.apify.com/api/client/python/)** — official SDKs.
- **[Schedules](https://docs.apify.com/platform/schedules)** — run it daily/weekly with **monitor mode** to capture new openings, grade changes and closures as fresh leads.
- **[Webhooks](https://docs.apify.com/platform/integrations/webhooks)** — trigger downstream actions (CRM import, Slack alert, email sequence) the moment a run finishes.

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'MY_APIFY_TOKEN' });

const run = await client.actor('scrapesage/us-restaurant-inspection-scraper').call({
    sources: ['nyc', 'chicago'],
    newlyOpenedOnly: true,
    sortBy: 'newlyOpened',
    maxResults: 200,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Got ${items.length} food-establishment leads`);
```

### Integrate with any app

Connect the dataset to 5,000+ apps — no code required:

- **[Make](https://docs.apify.com/platform/integrations/make)** — multi-step automation scenarios.
- **[Zapier](https://docs.apify.com/platform/integrations/zapier)** — push new establishment leads straight into your CRM.
- **[Slack](https://docs.apify.com/platform/integrations/slack)** — get notified when a monitored city gets new openings or closures.
- **[Google Drive / Sheets](https://docs.apify.com/platform/integrations/drive)** — auto-export every run to a spreadsheet.
- **[Airbyte](https://docs.apify.com/platform/integrations/airbyte)** — pipe results into your data warehouse.
- **[GitHub](https://docs.apify.com/platform/integrations/github)** — trigger runs from commits or releases.

### Use with AI assistants (MCP)

The output is clean, LLM-ready JSON. Call this actor from Claude, ChatGPT, or any agent framework through the **[Apify MCP server](https://docs.apify.com/platform/integrations/mcp)** — ask your assistant to "list every restaurant in Chicago that just opened, with its address and latest inspection result" and let it run the scraper for you.

### Agent-ready: autonomous payments (x402 & Skyfire)

This actor is **agent-ready** — AI agents can discover it, run it, and **pay for it autonomously**, with no Apify account and no human in the loop. It uses [pay-per-event](https://docs.apify.com/platform/actors/publishing/monetize/pay-per-event) pricing and [limited permissions](https://docs.apify.com/platform/actors/development/permissions), so it qualifies for Apify's agentic-payment standards:

- **[x402](https://docs.apify.com/platform/integrations/x402)** — an open, HTTP-native payment protocol. Agents pay per run in USDC on the Base network directly through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp) — no account, no API key.
- **[Skyfire](https://docs.apify.com/platform/integrations/skyfire)** — agent-to-service payments for fully autonomous AI-agent workflows.

Building an AI agent, MCP tool, or autonomous data pipeline? This scraper is ready to plug in and pay as it goes.

### More scrapers from scrapesage

Build a complete **food-service & local-business lead-gen stack**:

- **[Website Contact Scraper](https://apify.com/scrapesage/website-contact-scraper)** — turn establishment names & websites into emails, phones & socials (the last-mile enricher for this list).
- **[Uber Eats Scraper](https://apify.com/scrapesage/ubereats-scraper)** — restaurants, full menus, prices & contact phones by city.
- **[Zomato Scraper](https://apify.com/scrapesage/zomato-scraper)** — restaurants, menus, ratings & phone leads.
- **[Foodpanda Scraper](https://apify.com/scrapesage/foodpanda-scraper)** — restaurants, menus & prices across Asia.
- **[Thumbtack Scraper](https://apify.com/scrapesage/thumbtack-scraper)** — home-service pro leads, reviews & hire data.
- **[BuildZoom Scraper](https://apify.com/scrapesage/buildzoom-scraper)** — US contractor leads, licenses & permits.
- **[US Property Records Scraper](https://apify.com/scrapesage/us-property-records-scraper)** — property & owner leads from official assessment data.
- **[TaxBuzz Scraper](https://apify.com/scrapesage/taxbuzz-scraper)** — CPAs, tax preparers & accountant leads with direct contacts.

### Tips

- **Newly-opened leads**: set `newlyOpenedOnly: true` and `sortBy: "newlyOpened"` to get the freshest, highest-intent restaurants first. For exhaustive coverage of a big metro, narrow with `cities`, `categoryQuery` or `zipCodes`.
- **Contactable lists**: turn on `withPhoneOnly` and prefer the `nyc`, `king-wa` and `sf` sources, which publish phone numbers. Then run the results through the **[Website Contact Scraper](https://apify.com/scrapesage/website-contact-scraper)** to add emails.
- **Compliance targeting**: `complianceTiers: ["poor"]` or `hasCriticalViolationsOnly: true` finds operators with an active problem — ideal for pest control, food-safety consulting and remediation.
- **Bigger free portals (NYC, Chicago)** are also rate-limit friendly. For very large recurring runs, add a free **Socrata app token** for higher limits.
- **Recurring monitoring**: combine [Schedules](https://docs.apify.com/platform/schedules) with `monitorMode` to capture only new openings, re-inspections, grade changes and closures each run.

### FAQ

**Which cities are covered?** New York City (DOHMH), Chicago, Seattle / King County WA, Austin / Travis County TX, and San Francisco — five major metros across five states, in one unified schema. More cities are added over time.

**Where does the data come from?** Each city's official health-department inspection dataset, served over the public Socrata open-data API. No key, login or browser required — and the source is fully citable.

**How is one establishment built from many inspections?** The raw data is one row per inspection (often one row per violation). The actor groups every row for a business into a single record: its latest inspection (grade, score, violations, result), its full inspection history, and — resolved directly from the portal — its **accurate first-inspection date and total inspection count**.

**What is the "newly opened" signal?** An establishment whose *first* inspection on record falls within `newOpeningDays` (default 365). New food businesses are inspected right after opening, so this is a reliable new-opening proxy and the strongest GTM-intent signal in the dataset.

**Do all records have a phone or email?** Phone is published by NYC, Seattle/King County and San Francisco. No city publishes business emails — pair this actor with the **[Website Contact Scraper](https://apify.com/scrapesage/website-contact-scraper)** to add emails and socials from each establishment's website.

**Can I export to Google Sheets, CSV, or Excel?** Yes — one click in the dataset view, or automatically on every run via the [Google Drive integration](https://docs.apify.com/platform/integrations/drive).

**How does monitoring mode work?** It remembers each establishment's inspection fingerprint in a named key-value store and re-emits a record only when it's new, re-inspected, or its grade/result changed — ideal for tracking openings and closures on a [Schedule](https://docs.apify.com/platform/schedules).

**Is this legal?** This actor collects publicly available government records only. You are responsible for using the data in compliance with applicable laws (e.g. CCPA, and CAN-SPAM/TCPA for outreach) and each portal's terms.

### Disclaimer

**This Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by US city and state health-inspection portals or any government body. All trademarks mentioned are the property of their respective owners.**

"US city and state health-inspection portals" is referenced only in a descriptive, nominative sense - to identify the public data source this Actor collects from. This Actor is not an official product or service of US city and state health-inspection portals and is not authorised or certified by it. It collects only publicly available records; you are responsible for ensuring your use of that data complies with applicable laws, regulations and the source's own terms of use or reuse conditions.

### Need help?

Open an issue on the actor's **Issues** tab, or visit the [Apify help center](https://help.apify.com/). Feature requests are welcome — this actor is actively maintained.

# Actor input Schema

## `sources` (type: `array`):

Which official city / county health-department open-data portals to query. <b>nyc</b> = New York City (DOHMH — phone, cuisine, A/B/C letter grade). <b>chicago</b> = Chicago (facility type, risk level, full violation text). <b>king-wa</b> = Seattle / King County, WA (phone, score, grade, closures). <b>austin</b> = Austin / Travis County, TX (inspection score). <b>sf</b> = San Francisco (phone, score — note: SF's dataset updates less frequently than the others). Leave empty for all.

## `nameQuery` (type: `string`):

Only return establishments whose name contains this text (case-insensitive), e.g. <code>Pizza</code>, <code>Starbucks</code>, or <code>Taqueria</code>.

## `categoryQuery` (type: `string`):

Filter by cuisine or facility type (case-insensitive contains). NYC uses cuisine (<code>Italian</code>, <code>Mexican</code>, <code>Bakery</code>, <code>Coffee/Tea</code>); Chicago & Seattle use facility type (<code>Restaurant</code>, <code>Grocery Store</code>, <code>Bakery</code>, <code>Mobile Food</code>, <code>School</code>).

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

Filter by the establishment's city / borough (case-insensitive exact match). Useful inside multi-city sources — e.g. <code>Manhattan</code>/<code>Brooklyn</code> (NYC), <code>Bellevue</code>/<code>Redmond</code>/<code>Kent</code> (King County), <code>Evanston</code> (Cook County). Single-city sources ignore this.

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

Filter by ZIP — full ZIP (<code>10001</code>) or a prefix (<code>100</code> matches all 100xx).

## `categoryFilters` (type: `string`):

The filters below target establishments by their latest health inspection.

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

Filter by the source's own letter grade. Applies to NYC (<code>A</code>, <code>B</code>, <code>C</code>, <code>P</code>=grade pending, <code>N</code>=not yet graded) and Seattle/King County (<code>1</code>=excellent … <code>4</code>=needs improvement). For a portable filter across all sources use <b>Compliance tiers</b> instead.

## `complianceTiers` (type: `array`):

Unified hygiene tier derived from each source's latest grade / score / result. <b>good</b> = passing / Grade A. <b>needs\_improvement</b> = conditional / Grade B. <b>poor</b> = failing / Grade C. <b>closed</b> = shut by the health department / out of business. <b>unknown</b> = no grade posted yet. Great for targeting clean operators (good) or compliance / pest-control / remediation prospects (needs\_improvement, poor).

## `hasCriticalViolationsOnly` (type: `boolean`):

Only establishments whose latest inspection has at least one critical / priority / high-risk violation. High-intent for pest control, food-safety consulting, remediation and compliance software.

## `highRiskOnly` (type: `boolean`):

Only establishments classified high-risk by the health department (Chicago Risk 1, Seattle Risk Category III–IV, SF high-risk). High-risk = high-volume food prep = bigger buyers.

## `excludeClosed` (type: `boolean`):

Drop establishments whose latest inspection shows they were closed by the health department or marked out of business. Recommended for active-lead lists.

## `closedOnly` (type: `boolean`):

Only establishments shut by the health department / out of business (turnover & distressed-asset intelligence). Overrides 'exclude closed'.

## `newlyOpenedOnly` (type: `boolean`):

Only establishments whose FIRST inspection on record is recent (a new opening). Brand-new restaurants are the highest-intent buyers — they need POS, suppliers, insurance, payroll, delivery, marketing & more. Uses the accurate first-inspection date from each portal.

## `newOpeningDays` (type: `integer`):

How recent the first inspection must be to count as 'newly opened'. Default 365 (opened within the last year).

## `withPhoneOnly` (type: `boolean`):

Only establishments that have a phone number (available from NYC, Seattle/King County and San Francisco). Best for tele-prospecting lists.

## `inspectionDateFrom` (type: `string`):

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

## `inspectionDateTo` (type: `string`):

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

## `includeInspectionHistory` (type: `boolean`):

Attach a per-establishment inspection history (dates, results, grades, violation counts) and resolve the accurate first-inspection date & total inspection count from the portal. Turn off for a slightly faster, latest-inspection-only run.

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

Maximum number of establishment records to return in this run (across all selected sources).

## `maxResultsPerSource` (type: `integer`):

Cap how many establishments are taken from each source before the global limit and sorting. Leave blank to use the same value as Max results.

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

Order of the returned records. <b>recentInspection</b> = most recently inspected first (freshest). <b>newlyOpened</b> = newest openings first (best GTM-intent leads). <b>leadScore</b> = best leads first. <b>worstCompliance</b> = closures & failing grades first (compliance/turnover targeting). <b>none</b> = natural order (fastest).

## `deduplicateResults` (type: `boolean`):

Skip duplicate establishment records within this run (recommended).

## `monitorMode` (type: `boolean`):

Remember which establishments were already returned (in a named key-value store) and emit ONLY records that are new since the last run — each tagged <code>monitorEvent: "new"</code>. A new inspection, a grade change or a brand-new establishment also surfaces as new. Run on a Schedule to capture new openings, grade changes and closures as fresh leads. Works alongside Apify Schedules (the schedule starts the run; monitoring decides what's new).

## `monitorKey` (type: `string`):

Names the memory used by monitoring mode. Use a distinct key per saved watch (e.g. per city or filter) so different monitors don't share state.

## `socrataAppToken` (type: `string`):

Optional Socrata app token for higher rate limits on very large runs. Not required — leave blank for normal use. Get one free at any of the open-data portals (e.g. data.cityofnewyork.us).

## `proxyConfiguration` (type: `object`):

Optional proxy. The government open-data portals are fetched directly and need no proxy — leave this off for the fastest runs. Enable Apify Proxy only if your network requires it.

## Actor input object example

```json
{
  "sources": [
    "nyc",
    "chicago",
    "king-wa",
    "austin",
    "sf"
  ],
  "hasCriticalViolationsOnly": false,
  "highRiskOnly": false,
  "excludeClosed": false,
  "closedOnly": false,
  "newlyOpenedOnly": false,
  "newOpeningDays": 365,
  "withPhoneOnly": false,
  "includeInspectionHistory": true,
  "maxResults": 1000,
  "sortBy": "recentInspection",
  "deduplicateResults": true,
  "monitorMode": false,
  "monitorKey": "default",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

All scraped establishment / inspection lead records as JSON items in the default dataset.

# 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 = {
    "sources": [
        "nyc",
        "chicago",
        "king-wa",
        "austin",
        "sf"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapesage/us-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 = {
    "sources": [
        "nyc",
        "chicago",
        "king-wa",
        "austin",
        "sf",
    ],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapesage/us-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 '{
  "sources": [
    "nyc",
    "chicago",
    "king-wa",
    "austin",
    "sf"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call scrapesage/us-restaurant-inspection-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapesage/us-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/cHGzOwbh7QXCq1TfU/builds/VJcGxrbQh5FILSIdp/openapi.json
