# OSHA Violations Scraper (`crowdpull/osha-violations-scraper`) Actor

- **URL**: https://apify.com/crowdpull/osha-violations-scraper.md
- **Developed by:** [Crowd Pull](https://apify.com/crowdpull) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 21 total users, 4 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 record extracteds

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## OSHA Violations Scraper

Search and download OSHA workplace safety inspection records, violation citations, penalties, and accident reports for any US employer. Filter by state, city, employer name, industry code, date range, violation type, and more.

### What it does

This actor queries the federal OSHA inspection database (5+ million inspections, 13+ million violations, 165K+ accident reports) and returns structured, analysis-ready data. No more wrestling with bulk government CSV downloads.

**Use cases:**

- Compliance teams screening vendors and contractors
- Insurance underwriters assessing workplace risk
- Journalists investigating employer safety records
- Researchers analyzing enforcement trends by industry or region
- Real estate due diligence on commercial properties

### Input

| Parameter | Type | Description |
|-----------|------|-------------|
| `state` | string | Two-letter state code (e.g., `TX`, `CA`) |
| `city` | string | City name (fuzzy match) |
| `estab_name` | string | Employer/establishment name (fuzzy match) |
| `naics_code` | string | NAICS industry code |
| `sic_code` | string | SIC industry code |
| `insp_type` | string | Inspection type: `A` (accident), `B` (complaint), `C` (referral), etc. |
| `insp_scope` | string | Inspection scope: `C` (complete), `P` (partial) |
| `owner_type` | string | Owner type code |
| `safety_hlth` | string | `S` (safety) or `H` (health) |
| `violation_type` | string | `S` (serious), `W` (willful), `R` (repeat), `O` (other) |
| `open_date_from` | string | Start date (YYYY-MM-DD) |
| `open_date_to` | string | End date (YYYY-MM-DD) |
| `penalty_min` | number | Minimum total penalty amount |
| `penalty_max` | number | Maximum total penalty amount |
| `has_violations` | boolean | Only inspections with violations |
| `has_fatality` | boolean | Only inspections linked to fatalities |
| `include_violations` | boolean | Include individual violation citations per inspection |
| `include_accidents` | boolean | Also fetch accident/injury records |
| `max_results` | number | Maximum inspections to return (default: 1000) |

### Output

Each record is an OSHA inspection with optional violation details:

```json
{
  "activity_nr": 1234567890,
  "estab_name": "Acme Construction LLC",
  "site_address": "123 Main St",
  "site_city": "Houston",
  "site_state": "TX",
  "site_zip": "77001",
  "sic_code": "1522",
  "naics_code": "236220",
  "insp_type": "A",
  "insp_scope": "C",
  "open_date": "2024-03-15",
  "close_case_date": "2024-08-20",
  "violation_count": 3,
  "total_current_penalty": 45000,
  "total_initial_penalty": 60000,
  "violations": [
    {
      "citation_id": "0101",
      "standard": "19260501",
      "viol_type": "S",
      "current_penalty": 15000,
      "initial_penalty": 20000,
      "issuance_date": "2024-04-01",
      "abate_date": "2024-06-01",
      "nr_exposed": 5,
      "gravity": "10"
    }
  ]
}
```

Export as JSON, CSV, Excel, or XML from the Apify dataset.

### Data source

All data comes from the U.S. Department of Labor's OSHA enforcement database, updated daily. Records go back decades and cover every federal OSHA inspection conducted in the United States.

### Cost

Runs are very fast since data is pre-indexed. A typical run fetching 1,000 inspections with violations completes in under 30 seconds and costs fractions of a cent in compute.

# Actor input Schema

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

Two-letter state abbreviation (e.g., TX, CA, IL)

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

City name (partial match, case-insensitive)

## `estab_name` (type: `string`):

Employer or establishment name (partial match)

## `naics_code` (type: `string`):

North American Industry Classification System code (e.g., 236220 for Commercial Construction)

## `sic_code` (type: `string`):

Standard Industrial Classification code (4-digit)

## `insp_type` (type: `string`):

Inspection type code

## `insp_scope` (type: `string`):

Scope of the inspection

## `owner_type` (type: `string`):

Ownership type code

## `safety_hlth` (type: `string`):

Filter by safety or health inspections

## `violation_type` (type: `string`):

Type of violation

## `open_date_from` (type: `string`):

Start date (YYYY-MM-DD)

## `open_date_to` (type: `string`):

End date (YYYY-MM-DD)

## `penalty_min` (type: `integer`):

Minimum total penalty in dollars

## `penalty_max` (type: `integer`):

Maximum total penalty in dollars

## `has_violations` (type: `boolean`):

Only return inspections that have violations

## `has_fatality` (type: `boolean`):

Only return inspections linked to a fatality

## `sort` (type: `string`):

Sort order for results

## `include_violations` (type: `boolean`):

Fetch full violation details for each inspection

## `include_accidents` (type: `boolean`):

Also search and include accident/injury records

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

Maximum number of inspection records to return. Use -1 for unlimited.

## Actor input object example

```json
{
  "state": "IL",
  "city": "Chicago",
  "insp_type": "",
  "insp_scope": "",
  "safety_hlth": "",
  "violation_type": "",
  "open_date_from": "2024-01-01",
  "open_date_to": "2024-12-31",
  "has_violations": false,
  "has_fatality": false,
  "sort": "date",
  "include_violations": true,
  "include_accidents": false,
  "max_results": 100
}
```

# 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 = {
    "state": "IL",
    "city": "Chicago",
    "open_date_from": "2024-01-01",
    "open_date_to": "2024-12-31",
    "max_results": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("crowdpull/osha-violations-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 = {
    "state": "IL",
    "city": "Chicago",
    "open_date_from": "2024-01-01",
    "open_date_to": "2024-12-31",
    "max_results": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("crowdpull/osha-violations-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 '{
  "state": "IL",
  "city": "Chicago",
  "open_date_from": "2024-01-01",
  "open_date_to": "2024-12-31",
  "max_results": 100
}' |
apify call crowdpull/osha-violations-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crowdpull/osha-violations-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/ws4B8ERKrgV5Xojsc/builds/N7OFp2Kz6yeBbR89i/openapi.json
