# 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
- **Stats:** 11 total users, 3 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/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 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("💾 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 '{
  "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": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crowdpull/osha-violations-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "OSHA Violations Scraper",
        "version": "1.0",
        "x-build-id": "N7OFp2Kz6yeBbR89i"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crowdpull~osha-violations-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crowdpull-osha-violations-scraper",
                "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/crowdpull~osha-violations-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crowdpull-osha-violations-scraper",
                "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/crowdpull~osha-violations-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crowdpull-osha-violations-scraper",
                "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": {
                    "state": {
                        "title": "State",
                        "type": "string",
                        "description": "Two-letter state abbreviation (e.g., TX, CA, IL)"
                    },
                    "city": {
                        "title": "City",
                        "type": "string",
                        "description": "City name (partial match, case-insensitive)"
                    },
                    "estab_name": {
                        "title": "Establishment Name",
                        "type": "string",
                        "description": "Employer or establishment name (partial match)"
                    },
                    "naics_code": {
                        "title": "NAICS Code",
                        "type": "string",
                        "description": "North American Industry Classification System code (e.g., 236220 for Commercial Construction)"
                    },
                    "sic_code": {
                        "title": "SIC Code",
                        "type": "string",
                        "description": "Standard Industrial Classification code (4-digit)"
                    },
                    "insp_type": {
                        "title": "Inspection Type",
                        "enum": [
                            "",
                            "A",
                            "B",
                            "C",
                            "D",
                            "E",
                            "F",
                            "G",
                            "H",
                            "I",
                            "J",
                            "K",
                            "L"
                        ],
                        "type": "string",
                        "description": "Inspection type code",
                        "default": ""
                    },
                    "insp_scope": {
                        "title": "Inspection Scope",
                        "enum": [
                            "",
                            "C",
                            "P",
                            "R"
                        ],
                        "type": "string",
                        "description": "Scope of the inspection",
                        "default": ""
                    },
                    "owner_type": {
                        "title": "Owner Type",
                        "type": "string",
                        "description": "Ownership type code"
                    },
                    "safety_hlth": {
                        "title": "Safety or Health",
                        "enum": [
                            "",
                            "S",
                            "H"
                        ],
                        "type": "string",
                        "description": "Filter by safety or health inspections",
                        "default": ""
                    },
                    "violation_type": {
                        "title": "Violation Type",
                        "enum": [
                            "",
                            "W",
                            "R",
                            "S",
                            "O",
                            "U"
                        ],
                        "type": "string",
                        "description": "Type of violation",
                        "default": ""
                    },
                    "open_date_from": {
                        "title": "Open Date From",
                        "type": "string",
                        "description": "Start date (YYYY-MM-DD)"
                    },
                    "open_date_to": {
                        "title": "Open Date To",
                        "type": "string",
                        "description": "End date (YYYY-MM-DD)"
                    },
                    "penalty_min": {
                        "title": "Minimum Penalty ($)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Minimum total penalty in dollars"
                    },
                    "penalty_max": {
                        "title": "Maximum Penalty ($)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum total penalty in dollars"
                    },
                    "has_violations": {
                        "title": "Has Violations Only",
                        "type": "boolean",
                        "description": "Only return inspections that have violations",
                        "default": false
                    },
                    "has_fatality": {
                        "title": "Has Fatality Only",
                        "type": "boolean",
                        "description": "Only return inspections linked to a fatality",
                        "default": false
                    },
                    "sort": {
                        "title": "Sort By",
                        "enum": [
                            "date",
                            "penalty",
                            "violations",
                            "establishment"
                        ],
                        "type": "string",
                        "description": "Sort order for results",
                        "default": "date"
                    },
                    "include_violations": {
                        "title": "Include Violations",
                        "type": "boolean",
                        "description": "Fetch full violation details for each inspection",
                        "default": true
                    },
                    "include_accidents": {
                        "title": "Include Accidents",
                        "type": "boolean",
                        "description": "Also search and include accident/injury records",
                        "default": false
                    },
                    "max_results": {
                        "title": "Max Results",
                        "minimum": -1,
                        "type": "integer",
                        "description": "Maximum number of inspection records to return. Use -1 for unlimited.",
                        "default": 1000
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
