# OSHA Inspection & Citation Search (`ryanclinton/osha-inspection-search`) Actor

OSHA Inspection & Citation Search is an Apify actor that searches and retrieves workplace inspection records and violation citations from the U.S. Occupational Safety and Health Administration (OSHA) database.

- **URL**: https://apify.com/ryanclinton/osha-inspection-search.md
- **Developed by:** [ryan clinton](https://apify.com/ryanclinton) (community)
- **Categories:** Other, AI
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

$30.00 / 1,000 result returneds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## OSHA Inspection & Citation Search

### What does OSHA Inspection & Citation Search do?

OSHA Inspection & Citation Search is an Apify actor that searches and retrieves workplace inspection records and violation citations from the U.S. Occupational Safety and Health Administration (OSHA) database. The data comes from the official DOL Open Data Portal API, which is updated daily by OSHA and covers every federal OSHA inspection conducted at workplaces across the United States.

This actor automates the process of querying OSHA inspection data, joining violation records to their parent inspections, and producing clean, structured output ready for compliance monitoring, risk assessment, or investigative research. Each result includes the inspection details (site, dates, type, scope, industry codes) along with an optional array of violation citations showing the exact OSHA standards violated, penalty amounts, violation severity, and abatement status.

Whether you are a safety consultant auditing a contractor's history, an insurance underwriter assessing workplace risk, a journalist investigating employer safety records, or an ESG analyst building corporate responsibility profiles, this actor delivers normalized, machine-readable OSHA data without the complexity of managing the DOL API's filter syntax, pagination, or multi-dataset joins.

### Why use OSHA Inspection & Citation Search on Apify?

Searching OSHA inspection data through the DOL website is tedious. The public search tools have limited filtering, no bulk export, and no way to programmatically access results. The DOL Open Data API, while powerful, requires understanding a non-standard JSON filter syntax, managing pagination with offset parameters, and joining two separate datasets (inspections and violations) by activity number.

This actor handles all of that complexity for you:

- **Automatic violation joining** -- Inspections and violations live in separate API datasets. This actor fetches both and joins them by `activity_nr`, giving you a complete picture in a single record.
- **Batch violation fetching** -- Violations are retrieved in batches of 50 activity numbers using the DOL API's `in` operator, minimizing API calls while staying within request limits.
- **Smart filter construction** -- The actor builds the DOL API's JSON `filter_object` syntax automatically from your plain-text inputs, including wildcard matching for company names and cities.
- **Scheduled monitoring** -- Run daily or weekly on Apify's scheduler to track new inspections at a specific company, industry, or location. Pair with Slack or email integrations for alerts.
- **Clean, flat output** -- Raw DOL API responses use inconsistent field names and require post-processing. This actor normalizes everything into a consistent schema with human-readable descriptions for codes.
- **No infrastructure needed** -- Runs entirely in the Apify cloud. No servers, no Docker setup, no dependencies to manage.

### Key features

- Search by company name with automatic case-insensitive partial matching
- Filter by state, city, NAICS industry code, inspection type, and safety/health classification
- Date range filtering on inspection open dates
- Optional violation/citation details joined to each inspection record
- Human-readable descriptions for all coded fields (inspection type, scope, violation type)
- Penalty totals calculated per inspection
- Deleted violations automatically excluded
- Paginated fetching with up to 5,000 inspections per run
- Summary statistics logged after each run (type breakdown, state distribution, top companies, total penalties)
- Results sorted by inspection date (newest first)

### Use cases

**Workplace safety compliance monitoring** -- A safety director at a multi-site manufacturer runs weekly searches for their company name to catch new OSHA inspections before they escalate. They export results to Google Sheets and share with site managers.

**Supplier and vendor due diligence** -- A procurement team screens potential vendors by searching their company name and reviewing inspection history, violation types, and penalty amounts. They flag suppliers with willful or repeat violations for additional review.

**Insurance underwriting risk assessment** -- An insurance underwriter searches by NAICS code and state to benchmark workplace injury rates in a specific industry and geography. They use penalty data and violation severity to adjust risk premiums.

**Investigative journalism** -- A reporter searches for fatality/catastrophe inspections (type A) in a specific state to investigate workplace deaths. They cross-reference violation details with penalty amounts to identify cases where penalties seem disproportionately low.

**ESG and corporate social responsibility reporting** -- An ESG analyst builds a dataset of OSHA inspections and violations for publicly traded companies, using it alongside SEC filings and environmental data to score corporate safety performance.

**Real estate environmental due diligence** -- A commercial real estate firm searches construction-related NAICS codes (23xxxx) in a target city to assess the safety track record of general contractors before awarding site work.

**Union organizing research** -- A labor researcher searches for inspections at specific employers to document safety conditions. They use violation types and penalty data to support worker safety advocacy.

### How to use OSHA Inspection & Citation Search

1. **Get a free DOL API key** -- Visit [dataportal.dol.gov/registration](https://dataportal.dol.gov/registration) and register for a free account. Your API key will be provided immediately after registration.

2. **Configure your search** -- Enter your API key, then set your filters. At minimum, provide a company name, state, or NAICS code to focus your search. You can combine multiple filters for precise targeting.

3. **Run the actor** -- Click "Start" to execute your search. The actor will query the DOL API, paginate through all matching inspections, optionally fetch violations, and push clean data to the output dataset.

4. **Schedule recurring runs** -- Use Apify's scheduler to run the actor daily or weekly. Combine with integrations to receive alerts when new inspections or violations are found.

5. **Export or integrate** -- Download results as JSON, CSV, or Excel from the Dataset tab. Or use the Apify API, webhooks, Google Sheets, Slack, or Zapier integrations for automated workflows.

### Input parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `apiKey` | String | Yes | -- | DOL Open Data Portal API key. Free from [dataportal.dol.gov/registration](https://dataportal.dol.gov/registration). |
| `companyName` | String | No | `"WALMART"` (prefill) | Establishment name to search. Partial match with automatic uppercasing (e.g., "walmart" matches "WALMART STORES INC"). |
| `state` | String | No | -- | Two-letter US state code (e.g., "TX", "CA", "OH"). |
| `city` | String | No | -- | City name filter (partial match). |
| `naicsCode` | String | No | -- | NAICS industry code (2-6 digits). Partial matching: "23" matches all construction codes (23xxxx). |
| `inspectionType` | Select | No | -- | Inspection type code: A=Fatality/Catastrophe, B=Complaint, C=Referral, F=Follow-up, G=Unprogrammed Related, H=Planned, J=Unprogrammed Other, K=Programmed Other, L=Other. |
| `safetyHealth` | Select | No | -- | S=Safety inspections only, H=Health inspections only. Leave blank for both. |
| `dateFrom` | String | No | -- | Start date in YYYY-MM-DD format. |
| `dateTo` | String | No | -- | End date in YYYY-MM-DD format. |
| `includeViolations` | Boolean | No | `true` | Fetch violation/citation details for each inspection. Set to false for faster runs when you only need inspection metadata. |
| `maxResults` | Integer | No | `100` | Maximum number of inspections to return (1-5,000). |

#### Input examples

**Search a specific company's inspection history:**

```json
{
    "apiKey": "YOUR_DOL_API_KEY",
    "companyName": "WALMART",
    "includeViolations": true,
    "maxResults": 200
}
````

**Fatality inspections in Texas construction:**

```json
{
    "apiKey": "YOUR_DOL_API_KEY",
    "state": "TX",
    "naicsCode": "23",
    "inspectionType": "A",
    "dateFrom": "2024-01-01",
    "includeViolations": true,
    "maxResults": 500
}
```

**Health inspections in California restaurants:**

```json
{
    "apiKey": "YOUR_DOL_API_KEY",
    "state": "CA",
    "naicsCode": "722511",
    "safetyHealth": "H",
    "dateFrom": "2024-01-01",
    "dateTo": "2024-12-31",
    "maxResults": 300
}
```

**Quick scan -- inspections only, no violations:**

```json
{
    "apiKey": "YOUR_DOL_API_KEY",
    "companyName": "AMAZON",
    "state": "OH",
    "includeViolations": false,
    "maxResults": 100
}
```

#### Input tips

- **Combine company name with state** for targeted employer searches. Using company name alone may return thousands of results for large employers.
- **Use NAICS code "23" for all construction** -- This matches all 23xxxx codes including residential (2361), commercial (2362), highway (2373), and specialty trades (238x).
- **Set `includeViolations: false`** for faster runs when you only need inspection counts, dates, and locations without citation details.
- **Start with a broader date range** on your first run to understand the data volume before narrowing.
- **Inspection type "A" (Fatality/Catastrophe)** is triggered by a workplace death or hospitalization of 3 or more employees -- these are the most serious inspections.
- **NAICS partial matching** works at any length: "33" matches all manufacturing, "3361" matches motor vehicle manufacturing specifically.

### Output example

Each inspection in the output dataset contains the following fields:

```json
{
    "activityNumber": 1685394,
    "establishmentName": "WALMART STORES INC",
    "siteAddress": "1234 MAIN STREET",
    "siteCity": "HOUSTON",
    "siteState": "TX",
    "siteZip": "77001",
    "safetyOrHealth": "Safety",
    "naicsCode": "452210",
    "sicCode": "5311",
    "inspectionType": "B",
    "inspectionTypeDescription": "Complaint",
    "inspectionScope": "A",
    "inspectionScopeDescription": "Comprehensive",
    "unionStatus": "N",
    "employeesAtSite": 245,
    "openDate": "2024-09-15",
    "closeConferenceDate": "2024-10-01",
    "closeCaseDate": "2024-12-10",
    "violations": [
        {
            "citationId": "0101001",
            "standard": "19101037 A01",
            "violationType": "S",
            "violationTypeDescription": "Serious",
            "issuanceDate": "2024-11-20",
            "abateDate": "2025-01-15",
            "abateComplete": "X",
            "currentPenalty": 16131,
            "initialPenalty": 16131,
            "contested": false,
            "finalOrderDate": "2024-12-15",
            "instances": 1,
            "workersExposed": 12,
            "gravity": 10
        },
        {
            "citationId": "0101002",
            "standard": "19100303 B01",
            "violationType": "O",
            "violationTypeDescription": "Other-than-Serious",
            "issuanceDate": "2024-11-20",
            "abateDate": "2025-01-15",
            "abateComplete": null,
            "currentPenalty": 1036,
            "initialPenalty": 1036,
            "contested": false,
            "finalOrderDate": null,
            "instances": 1,
            "workersExposed": 5,
            "gravity": 5
        }
    ],
    "violationCount": 2,
    "totalPenalties": 17167,
    "extractedAt": "2025-06-10T14:30:00.000Z"
}
```

#### Output fields -- Inspection

| Field | Type | Description |
|-------|------|-------------|
| `activityNumber` | Number | Unique OSHA inspection identifier (links inspections to violations) |
| `establishmentName` | String | Name of the inspected workplace |
| `siteAddress` | String | Street address of the inspection site |
| `siteCity` | String | City of the inspection site |
| `siteState` | String | Two-letter state code |
| `siteZip` | String | ZIP code of the inspection site |
| `safetyOrHealth` | String | "Safety" or "Health" classification |
| `naicsCode` | String | NAICS industry classification code |
| `sicCode` | String | SIC industry classification code (legacy) |
| `inspectionType` | String | Single-letter inspection type code |
| `inspectionTypeDescription` | String | Human-readable inspection type (Fatality/Catastrophe, Complaint, Referral, etc.) |
| `inspectionScope` | String | Single-letter scope code |
| `inspectionScopeDescription` | String | Human-readable scope (Comprehensive, Partial, Records Only, No Inspection) |
| `unionStatus` | String | Whether employees at the site are unionized (Y/N) |
| `employeesAtSite` | Number | Number of employees at the inspected site |
| `openDate` | String | Date the inspection was opened (YYYY-MM-DD) |
| `closeConferenceDate` | String/null | Date of the closing conference |
| `closeCaseDate` | String/null | Date the case was closed |
| `violations` | Array/null | Array of ViolationRecord objects, or null if `includeViolations` is false |
| `violationCount` | Number | Count of violations found during the inspection |
| `totalPenalties` | Number | Sum of all current penalty amounts in dollars |
| `extractedAt` | String | ISO 8601 timestamp of when the data was extracted |

#### Output fields -- ViolationRecord

| Field | Type | Description |
|-------|------|-------------|
| `citationId` | String | Citation identifier within the inspection |
| `standard` | String | OSHA standard violated (e.g., "19260501 A" for fall protection) |
| `violationType` | String | Single-letter code: S, W, R, O, or U |
| `violationTypeDescription` | String | Human-readable type: Serious, Willful, Repeat, Other-than-Serious, or Unclassified |
| `issuanceDate` | String | Date the citation was issued |
| `abateDate` | String/null | Deadline for correcting the violation |
| `abateComplete` | String/null | Whether abatement is complete |
| `currentPenalty` | Number | Current penalty amount in dollars (may be adjusted from initial) |
| `initialPenalty` | Number | Originally proposed penalty amount in dollars |
| `contested` | Boolean | Whether the employer contested the citation |
| `finalOrderDate` | String/null | Date the citation became a final order |
| `instances` | Number | Number of instances of the violation |
| `workersExposed` | Number | Number of workers exposed to the hazard |
| `gravity` | Number | Gravity rating assigned by the inspector |

### How it works

1. **Filter construction** -- The actor reads your inputs and builds a DOL API `filter_object` JSON expression. Company names and cities use `like` with `%` wildcards for partial matching. States and inspection types use `eq` for exact matching. Dates use `gt`/`lt` operators. Multiple conditions are combined with `{"and":[...]}`.

2. **Inspection fetching** -- The actor queries the DOL OSHA inspection endpoint with pagination (`limit=1000`, incrementing `offset`). Results are sorted by `open_date` descending (newest first). Fetching continues until `maxResults` is reached or no more records are returned.

3. **Violation fetching** -- If `includeViolations` is true, the actor collects all `activity_nr` values from the fetched inspections, batches them into groups of 50, and queries the DOL OSHA violation endpoint using the `in` operator. Deleted violations (`delete_flag='X'`) are filtered out.

4. **Join and transform** -- Violations are mapped to their parent inspections by `activity_nr`. Code values are translated to human-readable descriptions (e.g., "A" to "Fatality/Catastrophe", "S" to "Serious"). `violationCount` and `totalPenalties` are calculated per inspection.

5. **Output and summary** -- Clean records are pushed to the Apify dataset. The actor logs a summary showing inspection type breakdown, state distribution, top companies, violation type counts, and total penalty amounts.

### Technical details

#### DOL API filter construction

The DOL Open Data Portal API (v4) uses a `filter_object` query parameter containing JSON filter expressions. The actor constructs these automatically from your inputs:

| Input | Filter operator | Example filter |
|-------|----------------|----------------|
| `companyName` | `like` with `%` wildcards | `{"field":"estab_name","operator":"like","value":"%WALMART%"}` |
| `state` | `eq` (exact match) | `{"field":"site_state","operator":"eq","value":"TX"}` |
| `city` | `like` with `%` wildcards | `{"field":"site_city","operator":"like","value":"%HOUSTON%"}` |
| `naicsCode` | `like` with trailing `%` | `{"field":"naics_code","operator":"like","value":"23%"}` |
| `inspectionType` | `eq` (exact match) | `{"field":"insp_type","operator":"eq","value":"A"}` |
| `safetyHealth` | `eq` (exact match) | `{"field":"safety_hlth","operator":"eq","value":"S"}` |
| `dateFrom` | `gt` (greater than) | `{"field":"open_date","operator":"gt","value":"2024-01-01"}` |
| `dateTo` | `lt` (less than) | `{"field":"open_date","operator":"lt","value":"2024-12-31"}` |

Multiple conditions are combined with `{"and":[...conditions...]}`.

#### Pagination

The DOL API supports `limit` (max 10,000) and `offset` parameters. The actor uses `limit=1000` per page and increments the offset until either the requested `maxResults` are collected or the API returns fewer results than the limit.

#### Violation joining

Violations are stored in a separate DOL dataset from inspections. Both share the `activity_nr` field as a foreign key. The actor:

1. Collects all `activity_nr` values from fetched inspections
2. Batches them into groups of 50
3. Queries the violation dataset using the `in` operator for each batch
4. Filters out deleted violations (`delete_flag = 'X'`)
5. Maps violations back to their parent inspections

### How much does it cost to use?

OSHA Inspection & Citation Search is lightweight. It runs with 256 MB of memory and makes REST API calls rather than scraping web pages.

| Scenario | Inspections | API Calls | Run Time | Estimated Cost |
|----------|------------|-----------|----------|----------------|
| Quick company search | 100 | 1-2 | ~10 sec | ~$0.002 |
| Company history + violations | 500 | 5-15 | ~30 sec | ~$0.008 |
| State-level analysis | 1,000 + violations | 15-25 | ~1 min | ~$0.01 |
| Maximum run | 5,000 + violations | 50-100+ | ~3 min | ~$0.03 |

**Apify Free Tier:** New Apify accounts receive $5 of free platform credits each month. This is enough to run the OSHA actor hundreds of times per month at no cost.

**DOL API:** The DOL Open Data Portal API key is completely free. There are no charges from the government side.

### Limitations

- **DOL API key required** -- A free API key is required from [dataportal.dol.gov/registration](https://dataportal.dol.gov/registration). Registration takes under a minute.
- **5,000 inspection cap per run** -- The actor limits output to 5,000 inspections per execution. For larger datasets, run multiple times with different date ranges or state filters.
- **10,000 record limit per API request** -- The DOL API enforces a maximum of 10,000 records per request. The actor handles this with pagination, but extremely broad queries may hit the ceiling.
- **Company name is case-insensitive** -- The actor auto-uppercases company names before searching. "walmart", "Walmart", and "WALMART" all produce the same results.
- **NAICS partial matching** -- Searching with "23" matches all 23xxxx codes. This is by design but may return more results than expected for short codes.
- **Violation data may lag** -- Violation records may be published days or weeks after the parent inspection record. Recent inspections may show zero violations even if citations are forthcoming.
- **API key sharing prohibited** -- Per DOL Terms of Service, API keys must not be shared publicly or embedded in client-side code.
- **Federal OSHA only** -- This dataset covers federal OSHA inspections. States that operate their own OSHA-approved plans (e.g., California, Michigan, Oregon) may have separate data for state-plan inspections.

### Responsible use

- **Public data** -- OSHA inspection and violation data is published by the U.S. Department of Labor as public information. All records returned by this actor are publicly available.
- **Inspections are not convictions** -- An OSHA inspection does not necessarily mean violations were found. Many inspections close without citations. Present data in context.
- **Fair interpretation of penalties** -- Penalty amounts reflect OSHA's assessment at the time and may be adjusted through settlement or contest. Do not present initial penalties as final unless `finalOrderDate` is populated.
- **No unsubstantiated claims** -- Do not use OSHA inspection data to make unsupported safety claims about employers without understanding the full context of each inspection.
- **Follow DOL Terms of Service** -- Use your API key in accordance with DOL terms. Avoid excessive request volumes and do not share your key publicly.
- **Attribution** -- When publishing OSHA data, attribute it to the U.S. Department of Labor OSHA program.

### Programmatic access

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_API_TOKEN")

run = client.actor("ryanclinton/osha-inspection-search").call(run_input={
    "apiKey": "YOUR_DOL_API_KEY",
    "companyName": "WALMART",
    "state": "TX",
    "includeViolations": True,
    "maxResults": 200,
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    violations = item.get("violations") or []
    print(f"{item['establishmentName']} — {item['siteCity']}, {item['siteState']}")
    print(f"  Opened: {item['openDate']} | Type: {item['inspectionTypeDescription']}")
    print(f"  Violations: {item['violationCount']} | Penalties: ${item['totalPenalties']:,.0f}")
    for v in violations:
        print(f"    [{v['violationTypeDescription']}] {v['standard']} — ${v['currentPenalty']:,.0f}")
```

#### JavaScript

```javascript
import { ApifyClient } from "apify-client";

const client = new ApifyClient({ token: "YOUR_APIFY_API_TOKEN" });

const run = await client.actor("ryanclinton/osha-inspection-search").call({
    apiKey: "YOUR_DOL_API_KEY",
    companyName: "WALMART",
    state: "TX",
    includeViolations: true,
    maxResults: 200,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.log(`${item.establishmentName} — ${item.siteCity}, ${item.siteState}`);
    console.log(`  Opened: ${item.openDate} | Type: ${item.inspectionTypeDescription}`);
    console.log(`  Violations: ${item.violationCount} | Penalties: $${item.totalPenalties}`);
    (item.violations || []).forEach((v) => {
        console.log(`    [${v.violationTypeDescription}] ${v.standard} — $${v.currentPenalty}`);
    });
});
```

#### cURL

```bash
## Start the actor
curl -X POST "https://api.apify.com/v2/acts/ryanclinton~osha-inspection-search/runs?token=YOUR_APIFY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "YOUR_DOL_API_KEY",
    "companyName": "WALMART",
    "state": "TX",
    "includeViolations": true,
    "maxResults": 100
  }'

## Retrieve results (use the defaultDatasetId from the run response)
curl "https://api.apify.com/v2/datasets/DATASET_ID/items?token=YOUR_APIFY_API_TOKEN&format=json"
```

### FAQ

**Do I need an API key?**
Yes, but it is free. Register at [dataportal.dol.gov/registration](https://dataportal.dol.gov/registration) to get your key immediately. There are no usage charges.

**How current is the data?**
OSHA updates the inspection and violation datasets daily. New inspections typically appear within a few days of the on-site activity. Violations may take additional time as citations are processed.

**What is a Fatality/Catastrophe inspection (type A)?**
Type A inspections are triggered by a workplace death or an incident that hospitalizes three or more employees. These are OSHA's highest-priority inspections and often result in the most significant penalties.

**What NAICS codes should I use?**
Common NAICS codes for OSHA searches: 23 = Construction, 31-33 = Manufacturing, 44-45 = Retail Trade, 48-49 = Transportation/Warehousing, 62 = Healthcare, 72 = Accommodation/Food Services. Use 2-digit codes for broad industry searches or 4-6 digit codes for specific sectors.

**Can I search by OSHA standard number?**
Not directly as an input filter. The DOL API filters inspections, not violations. However, every violation in the output includes the `standard` field (e.g., "19260501 A" for fall protection), which you can filter in post-processing.

**What do violation types mean?**
S = Serious (penalties $1,036-$16,131 per violation), W = Willful (up to $161,323 per violation), R = Repeat (up to $161,323), O = Other-than-Serious (up to $16,131), U = Unclassified. Willful and repeat violations carry the highest penalties.

**Why do some inspections show zero violations?**
Not all inspections result in citations. Planned inspections may find no hazards. Complaint-driven inspections may be resolved informally. Also, violation records may lag behind inspection records by days or weeks.

**What is the difference between Safety and Health inspections?**
Safety inspections focus on physical hazards (falls, electrical, machinery). Health inspections focus on exposure hazards (chemicals, noise, respiratory). You can filter by either using the `safetyHealth` parameter, or leave it blank for both.

**Can I get results in CSV or Excel format?**
Yes. After the actor completes, click "Export" on the dataset page and choose CSV, Excel, JSON, or other formats. The Apify API also supports `format=csv` and `format=xlsx` query parameters.

**Does this cover state OSHA plans?**
This dataset covers federal OSHA inspections. Some states operate their own OSHA-approved state plans (California Cal/OSHA, Michigan MIOSHA, Oregon OSHA, etc.). State-plan inspections may or may not be reflected in the federal dataset depending on data-sharing agreements.

**How do I monitor a company over time?**
Schedule the actor to run daily or weekly with the company name filter. Use Apify integrations to send results to Slack, email, or Google Sheets. Compare `openDate` values across runs to identify new inspections.

### Inspection type reference

| Code | Type | Description |
|------|------|-------------|
| A | Fatality/Catastrophe | Workplace death or 3+ hospitalizations |
| B | Complaint | Filed by employee or representative |
| C | Referral | Referred by another agency or inspector |
| F | Follow-up | Follow-up to a previous inspection |
| G | Unprogrammed Related | Related to another unprogrammed inspection |
| H | Planned | Scheduled programmed inspection |
| J | Unprogrammed Other | Other unprogrammed inspection |
| K | Programmed Other | Other programmed inspection |
| L | Other | Does not fit other categories |

### Violation type reference

| Code | Type | Maximum Penalty |
|------|------|-----------------|
| S | Serious | $16,131 per violation |
| W | Willful | $161,323 per violation |
| R | Repeat | $161,323 per violation |
| O | Other-than-Serious | $16,131 per violation |
| U | Unclassified | Varies |

### NAICS code quick reference

| Code | Industry |
|------|----------|
| 23 | Construction (all) |
| 236 | Construction of Buildings |
| 237 | Heavy and Civil Engineering |
| 238 | Specialty Trade Contractors |
| 31-33 | Manufacturing |
| 3361 | Motor Vehicle Manufacturing |
| 44-45 | Retail Trade |
| 48-49 | Transportation and Warehousing |
| 62 | Healthcare and Social Assistance |
| 72 | Accommodation and Food Services |
| 722511 | Full-Service Restaurants |

### Integrations

OSHA Inspection & Citation Search works with Apify's built-in integrations:

- **Google Sheets** -- Automatically export inspection data to a spreadsheet for team review and filtering.
- **Slack / Email** -- Get instant notifications when new inspections match your criteria.
- **Webhooks** -- Push results to your compliance system, risk management platform, or custom pipeline.
- **Zapier / Make** -- Connect to thousands of apps for custom automation workflows.
- **API access** -- Retrieve results programmatically via the Apify API for integration with your own applications.

### Related actors

| Actor | Description | Use together |
|-------|-------------|--------------|
| [SAM.gov Contract Monitor](https://apify.com/ryanclinton/sam-gov-contract-monitor) | Federal contract opportunities | Cross-reference contractor safety records with government procurement activity |
| [CFPB Consumer Complaints](https://apify.com/ryanclinton/cfpb-consumer-complaints) | Consumer financial complaints | Build multi-agency enforcement profiles for regulated companies |
| [FDA Medical Device Recall Search](https://apify.com/ryanclinton/fda-device-recalls) | Medical device recalls | Combine workplace safety with product safety for healthcare facilities |
| [CPSC Product Recall Monitor](https://apify.com/ryanclinton/cpsc-recall-monitor) | Consumer product recalls | Multi-agency safety monitoring across workplace and consumer products |
| [OpenCorporates Search](https://apify.com/ryanclinton/opencorporates-search) | Global company lookups | Identify parent companies and subsidiaries when researching employer inspection history |
| [Job Market Intelligence](https://apify.com/ryanclinton/job-market-intelligence) | Job posting analysis | Correlate employer safety records with hiring patterns and workforce growth |

# Actor input Schema

## `dryRun` (type: `boolean`):

When true (or when no API key is provided), returns realistic sample data without calling the DOL API. Set to false and provide an API key for real data.

## `apiKey` (type: `string`):

Your DOL Open Data Portal API key. Register free at https://dataportal.dol.gov/registration. Not needed for dry run mode.

## `companyName` (type: `string`):

Search by establishment name (partial match). Examples: 'WALMART', 'AMAZON', 'TYSON'

## `state` (type: `string`):

Filter by U.S. state (2-letter code). Examples: 'TX', 'CA', 'OH'

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

Filter by city name. Examples: 'HOUSTON', 'LOS ANGELES'

## `naicsCode` (type: `string`):

Filter by NAICS code (2-6 digits). Examples: '23' (Construction), '3361' (Motor Vehicle Mfg), '722511' (Full-Service Restaurants)

## `inspectionType` (type: `string`):

Filter by inspection type

## `safetyHealth` (type: `string`):

Filter by safety or health inspection

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

Start date for inspection open date (YYYY-MM-DD format)

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

End date for inspection open date (YYYY-MM-DD format)

## `includeViolations` (type: `boolean`):

Fetch violation/citation details for each inspection (penalties, standards, gravity). Requires additional API calls.

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

Maximum number of inspection records to return (1-5,000)

## Actor input object example

```json
{
  "dryRun": true,
  "companyName": "WALMART",
  "includeViolations": true,
  "maxResults": 100
}
```

# 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 = {
    "companyName": "WALMART"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ryanclinton/osha-inspection-search").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 = { "companyName": "WALMART" }

# Run the Actor and wait for it to finish
run = client.actor("ryanclinton/osha-inspection-search").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "companyName": "WALMART"
}' |
apify call ryanclinton/osha-inspection-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=ryanclinton/osha-inspection-search",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "OSHA Inspection & Citation Search",
        "description": "OSHA Inspection & Citation Search is an Apify actor that searches and retrieves workplace inspection records and violation citations from the U.S. Occupational Safety and Health Administration (OSHA) database.",
        "version": "1.0",
        "x-build-id": "4OpmRajCUGPhfzfH9"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/ryanclinton~osha-inspection-search/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-ryanclinton-osha-inspection-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/ryanclinton~osha-inspection-search/runs": {
            "post": {
                "operationId": "runs-sync-ryanclinton-osha-inspection-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/ryanclinton~osha-inspection-search/run-sync": {
            "post": {
                "operationId": "run-sync-ryanclinton-osha-inspection-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "dryRun": {
                        "title": "Dry Run (Sample Data)",
                        "type": "boolean",
                        "description": "When true (or when no API key is provided), returns realistic sample data without calling the DOL API. Set to false and provide an API key for real data.",
                        "default": true
                    },
                    "apiKey": {
                        "title": "DOL API Key",
                        "type": "string",
                        "description": "Your DOL Open Data Portal API key. Register free at https://dataportal.dol.gov/registration. Not needed for dry run mode."
                    },
                    "companyName": {
                        "title": "Company Name",
                        "type": "string",
                        "description": "Search by establishment name (partial match). Examples: 'WALMART', 'AMAZON', 'TYSON'"
                    },
                    "state": {
                        "title": "State",
                        "type": "string",
                        "description": "Filter by U.S. state (2-letter code). Examples: 'TX', 'CA', 'OH'"
                    },
                    "city": {
                        "title": "City",
                        "type": "string",
                        "description": "Filter by city name. Examples: 'HOUSTON', 'LOS ANGELES'"
                    },
                    "naicsCode": {
                        "title": "NAICS Industry Code",
                        "type": "string",
                        "description": "Filter by NAICS code (2-6 digits). Examples: '23' (Construction), '3361' (Motor Vehicle Mfg), '722511' (Full-Service Restaurants)"
                    },
                    "inspectionType": {
                        "title": "Inspection Type",
                        "enum": [
                            "",
                            "A",
                            "B",
                            "C",
                            "F",
                            "G",
                            "H",
                            "J",
                            "K",
                            "L"
                        ],
                        "type": "string",
                        "description": "Filter by inspection type"
                    },
                    "safetyHealth": {
                        "title": "Safety or Health",
                        "enum": [
                            "",
                            "S",
                            "H"
                        ],
                        "type": "string",
                        "description": "Filter by safety or health inspection"
                    },
                    "dateFrom": {
                        "title": "Date From",
                        "type": "string",
                        "description": "Start date for inspection open date (YYYY-MM-DD format)"
                    },
                    "dateTo": {
                        "title": "Date To",
                        "type": "string",
                        "description": "End date for inspection open date (YYYY-MM-DD format)"
                    },
                    "includeViolations": {
                        "title": "Include Violations",
                        "type": "boolean",
                        "description": "Fetch violation/citation details for each inspection (penalties, standards, gravity). Requires additional API calls.",
                        "default": true
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum number of inspection records to return (1-5,000)",
                        "default": 100
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
