# US OSHA Workplace Inspection & Safety Penalty Leads (`afkdigital/newapi28-osha-inspection-penalty-leads`) Actor

Find U.S. OSHA inspection activities and published citations from complete official DOL snapshots. Join penalties by activity ID; distinguish inspections from violations and show source freshness.

- **URL**: https://apify.com/afkdigital/newapi28-osha-inspection-penalty-leads.md
- **Developed by:** [AFK Digital](https://apify.com/afkdigital) (community)
- **Categories:** Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 89.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$6.00 / 1,000 unique osha inspection records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

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

## US OSHA Workplace Inspection & Safety Penalty Leads (NEWAPI28)

One dataset item represents one unique OSHA inspection activity (`activity_nr`). The Actor joins the U.S. Department of Labor's public **inspection** and **violation** records on that exact identifier. An inspection does not imply a violation. It never imports person-level injury or accident records.

### Source and coverage

OSHA's [official Data page](https://www.osha.gov/data) links to the DOL Open Data Portal. The official [inspection ZIP](https://data.dol.gov/data-catalog/OSHA/inspection/OSHA_inspection.zip) and [violation ZIP](https://data.dol.gov/data-catalog/OSHA/violation/OSHA_violation.zip) are available without credentials. The default `publicZip` mode downloads both full daily snapshots, requires the same snapshot day, and streams **every CSV member** of both archives before writing any output. A truncated file, malformed row, missing column, transfer failure, or memory scope limit fails the run rather than treating unmatched records as citation-free. The selected inspection keys form an in-memory semi-join index; there is no persistent index or cache between Apify runs.

The optional `dolApi` mode uses the DOL v4 API at `https://apiprod.dol.gov/v4/get/OSHA/{inspection|violation}/json` and requires the user's private DOL API key. API pagination and the selected activity ID citation pages must complete. Do not paste a key into a URL or source file.

In the ZIP observed on October 25, 2026, the latest `open_date` was September 23, 2026. By default, ZIP mode uses the 30-day window ending on the latest date **in the snapshot**, not the machine's current date. The `source_snapshot_date` field records the archive publication day. `observed_at` records this run's UTC observation. The source may publish records late or revise them. A missing citation is reported as **no published citation in complete snapshot**, not compliance, no OSHA finding, or a future guarantee.

`total_violations` counts distinct active citation IDs. `initial_penalty_usd` and `current_penalty_usd` sum the corresponding matched citation amounts separately. `case_status` indicates open/closed, contest date, and penalty revision where published. Amounts are reported source values; they are neither live enforcement nor guaranteed final amounts. The source detail URL is a constructed OSHA inspection detail link; an occasional agency activity ID may not resolve on the public detail site.

### Input

`sourceMode` defaults to `publicZip`, `state` to CA, `maxResults` to 5, and `maxCostUsd` to $0.03. Optional filters: `naics` (2–6 digit prefix), `inspectionDateFrom`, `inspectionDateTo`, `violationType` (S/W/R/O/U), and `minReportedPenalty`. Explicit dates use the source `open_date`. A zero minimum includes inspections with no published citation. `dolApiKey` is secret and only needed when choosing `dolApi`; the publisher can instead supply `DOL_API_KEY` privately. API mode's omitted start date defaults to the last 30 days relative to today; the source may lag.

Example:

```json
{"sourceMode":"publicZip","state":"TX","naics":"238","inspectionDateFrom":"2025-01-01","inspectionDateTo":"2025-03-31","maxResults":5,"maxCostUsd":0.03}
```

### Output and pricing

The default Apify Dataset supports JSON and CSV export. Fields: `activity_nr`, `establishment_name`, `site_address`, `naics_code`, `inspection_date`, `violation_type`, `current_penalty_usd`, `initial_penalty_usd`, `total_violations`, `case_status`, `source_record_url`, `observed_at`, and `source_snapshot_date`.

**Store price:** $0.006 per unique dataset item, or $6 for 1,000 items. The `apify-default-dataset-item` synthetic event is configured as the sole primary paid event, with no paid start event. In a private Apify test on October 26, 2026, five items triggered five charged events ($0.030 at the configured rate); the run finished in 120 seconds and reported $0.02417 platform usage. Costs vary with the plan and source. `maxCostUsd` caps the Actor's intended *item charges* at this unit price; it does not cap platform resource usage, and the Apify run spending limit remains authoritative.

### Resource profile and limitations

The official October 25, 2026 pair totals 3,727,362,795 bytes (3.73 GB decimal), six inspection CSV members and 14 violation members. Apify memory is fixed at 4,096 MB to provide 8,192 MB of container disk and one CPU core for the complete pair. The files are temporary per run. An unbounded date range can exceed the in-memory candidate limit, in which case the run fails and asks for narrower filters; it does not deliver partial results. The current public ZIP snapshot is refreshed independently of the Actor; check `source_snapshot_date` and latest inspection date in logs for lag.

Run local tests with `python3 -m unittest discover -s tests -v`. Benchmarks and source measurements live under `evidence/`. Cloud test run IDs `KAdVntAaMkJAaozoX` (CA default, 141 seconds), `1DoqX6ETib9EdQRMf` (TX NAICS 424510, 114 seconds), and `DmcDuiAlU8BdV7jYX` (paid event check, 120 seconds) succeeded. The last run charged five dataset events. The ZIP snapshot date and latest inspection date are included in run logs.

# Actor input Schema

## `sourceMode` (type: `string`):

ZIP mode fully scans both official daily archives before producing results.

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

Two-letter state code.

## `naics` (type: `string`):

2–6 digits.

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

In ZIP mode, omitted means 30 days before the latest inspection in the source snapshot.

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

Omitted means no upper bound.

## `violationType` (type: `string`):

Filter by published citation type; empty includes inspections with no published citation.

## `minReportedPenalty` (type: `number`):

Zero includes inspections with no published citation. Penalties may be revised.

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

Maximum number of unique inspection activities to return.

## `maxCostUsd` (type: `number`):

Caps results at $0.006/item; this does not cap underlying platform usage. Use Apify run spending limits.

## `dolApiKey` (type: `string`):

Optional in public ZIP mode. For API mode, supply privately or set DOL_API_KEY in the Actor environment.

## Actor input object example

```json
{
  "sourceMode": "publicZip",
  "state": "CA",
  "violationType": "",
  "minReportedPenalty": 0,
  "maxResults": 5,
  "maxCostUsd": 0.03
}
```

# Actor output Schema

## `resultsJson` (type: `string`):

No description

## `resultsCsv` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("afkdigital/newapi28-osha-inspection-penalty-leads").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("afkdigital/newapi28-osha-inspection-penalty-leads").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 '{}' |
apify call afkdigital/newapi28-osha-inspection-penalty-leads --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,afkdigital/newapi28-osha-inspection-penalty-leads"
        }
    }
}
```

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/RmgVE3NeOajY0GleE/builds/6Caps6A59rhe9h88K/openapi.json
