MSHA Mine Safety Scraper
Pricing
Pay per event
MSHA Mine Safety Scraper
Extract official MSHA mine, inspection, violation, accident, and penalty assessment data for compliance and risk analysis.
Pricing
Pay per event
Rating
0.0
(0)
Developer
Stas Persiianenko
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
6 days ago
Last modified
Categories
Share
Extract public Mine Safety and Health Administration (MSHA) records from official government datasets.
Use this actor to build repeatable exports of mine profiles, inspections, violations, accidents, injuries, and penalty assessments without clicking through MSHA's reporting interface.
The actor downloads MSHA Open Government Data zip files, reads the pipe-delimited records, applies your filters, and saves normalized rows to the Apify dataset.
It is designed for compliance teams, industrial researchers, insurance analysts, ESG due-diligence teams, and data engineers who need mine safety intelligence in a clean API-ready format.
What does MSHA Mine Safety Scraper do?
MSHA Mine Safety Scraper turns public MSHA bulk files into a filtered dataset.
It supports five high-value source datasets:
- ๐ญ Mines
- ๐ Inspections
- โ ๏ธ Violations
- ๐ Accidents and injuries
- ๐ต Assessed violations / penalties
Each output row includes sourceUrl and scrapedAt so your downstream workflow can audit where the record came from.
The actor is HTTP-first and does not require Playwright, browser automation, login credentials, or an API key.
Who is it for?
Compliance teams
Monitor recent violations, penalties, and accident history for mines and operators.
Insurance underwriters
Review mine safety history before quoting or renewing coverage.
ESG and supply-chain analysts
Screen mining suppliers for enforcement, injury, and compliance risk.
Industrial sales teams
Find active mines and operators in target states or commodities.
Researchers and journalists
Download official government safety records into a structured dataset.
Data engineers
Schedule repeatable MSHA exports and connect them to BI tools, warehouses, or risk models.
Why use this actor?
MSHA provides public data, but raw downloads are large, pipe-delimited, and split across separate datasets.
This actor handles the repetitive work:
- โ Downloads official MSHA files
- โ Parses pipe-delimited text inside zip archives
- โ Normalizes important fields across datasets
- โ Filters by mine ID, names, state, and date range
- โ Emits clean JSON records through Apify
- โ Works with scheduled runs, API calls, webhooks, and integrations
Data sources
The actor uses official MSHA Open Government Data files:
Mines.zipInspections.zipViolations.zipAccidents.zipAssessedViolations.zip
These files are hosted by MSHA under arlweb.msha.gov/OpenGovernmentData/DataSets/.
No private data is accessed.
No scraping of logged-in pages is performed.
Supported dataset types
mines
Mine profile and operator/controller metadata.
inspections
Inspection events, dates, activity types, and inspection hours where available.
violations
Citation and order records, regulations, significant-and-substantial flags, proposed penalties, amounts due, and payment fields.
accidents
Accident, injury, equipment, occupation, activity, and narrative fields.
assessments
Assessed violation and penalty records from AssessedViolations.zip.
Data table
| Field | Description |
|---|---|
datasetType | Source dataset type: mines, inspections, violations, accidents, or assessments |
mineId | MSHA mine identifier |
mineName | Mine name where present |
operatorName | Current operator, event operator, or violator name |
controllerName | Mine controller name where present |
state | State code when provided by the source dataset |
county | County name for mine records |
mineType | Surface, underground, facility, or other MSHA mine type |
mineStatus | Current mine status |
eventNo | Inspection or enforcement event number |
violationNo | MSHA violation number |
violationIssueDate | Violation issue date in ISO format |
proposedPenalty | Proposed penalty amount when present |
accidentDate | Accident date in ISO format |
degreeInjury | MSHA degree of injury text |
assessmentCaseNo | Penalty assessment case number |
currentAssessmentAmount | Current assessment amount |
sourceUrl | Official MSHA dataset URL |
scrapedAt | Timestamp when this actor saved the row |
How much does it cost to scrape MSHA mine safety data?
This actor uses pay-per-event pricing.
A small start event is charged once per run.
A per-item event is charged for each dataset row saved.
Current formula-derived BRONZE item price is about $0.000031 per extracted record, with tier discounts for higher Apify plans. The start event is $0.005 per run.
The default Apify free tier may include platform credits, but final billing depends on your Apify plan and the live actor pricing shown on the Store page.
For best cost control, start with one dataset type and a small maxItems value.
How to use it
- Choose one or more dataset types.
- Add optional filters such as state, mine ID, operator name, or date range.
- Set
maxItemsto cap the export size. - Run the actor.
- Download results as JSON, CSV, Excel, XML, or via the Apify API.
Input options
datasetTypes
Array of MSHA datasets to scan.
Example: ["mines", "violations"]
state
Two-letter state code such as WV, PA, KY, NV, or AZ.
Some MSHA source files do not include a direct state column. In those cases, the actor does not reject otherwise matching rows just because the state field is absent.
mineId
Exact MSHA mine ID. Leading zeros are ignored for matching.
mineName
Case-insensitive substring filter for mine names.
operatorName
Case-insensitive substring filter for operator or violator names.
controllerName
Case-insensitive substring filter for controller names.
startDate and endDate
ISO dates such as 2024-01-01.
The actor maps these to relevant MSHA date fields for each dataset.
maxItems
Maximum records to save across all selected datasets.
Use a low value for testing and a higher value for production exports.
Example input
{"datasetTypes": ["violations"],"state": "WV","startDate": "2024-01-01","maxItems": 100}
Example output
{"datasetType": "violations","mineId": "4601436","mineName": "Example Mine","operatorName": "Example Operator LLC","eventNo": "1234567","violationNo": "9876543","violationIssueDate": "2024-05-12","regulation": "75.400","proposedPenalty": 942,"sourceUrl": "https://arlweb.msha.gov/OpenGovernmentData/DataSets/Violations.zip","scrapedAt": "2026-07-02T00:00:00.000Z"}
Tips for better results
- Start with a focused dataset type.
- Use
mineIdwhen you need exact history for a single mine. - Use
operatorNamefor due-diligence workflows. - Use date filters for inspections, violations, accidents, and assessments.
- Increase
maxItemsafter confirming the filters produce the data you expect.
Common workflows
Mine risk screening
Run mines, violations, accidents, and assessments for a target mine ID.
Operator compliance monitoring
Run inspections, violations, and assessments with an operator name filter.
State-level market research
Run mines with a state code to build a list of mines and operators in that region.
Accident trend analysis
Run accidents with a date range and export the dataset to a BI tool.
Integrations
You can connect this actor to:
- Google Sheets for compliance dashboards
- BigQuery or Snowflake for mine safety data warehouses
- Slack or email alerts through Apify webhooks
- CRM enrichment for industrial sales teams
- Risk models for underwriting and ESG screening
API usage with Node.js
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: process.env.APIFY_TOKEN });const run = await client.actor('automation-lab/msha-mine-safety-scraper').call({datasetTypes: ['violations'],startDate: '2024-01-01',maxItems: 100,});const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items);
API usage with Python
from apify_client import ApifyClientclient = ApifyClient('YOUR_APIFY_TOKEN')run = client.actor('automation-lab/msha-mine-safety-scraper').call(run_input={'datasetTypes': ['accidents'],'startDate': '2023-01-01','maxItems': 100,})items = client.dataset(run['defaultDatasetId']).list_items().itemsprint(items)
API usage with cURL
curl "https://api.apify.com/v2/acts/automation-lab~msha-mine-safety-scraper/runs?token=$APIFY_TOKEN" \-H 'Content-Type: application/json' \-d '{"datasetTypes":["mines"],"state":"WV","maxItems":100}'
MCP integration
Use the Apify MCP server to call this actor from Claude Desktop, Claude Code, or other MCP clients.
MCP URL:
https://mcp.apify.com/?tools=automation-lab/msha-mine-safety-scraper
Claude Code setup:
$claude mcp add apify-msha "https://mcp.apify.com/?tools=automation-lab/msha-mine-safety-scraper"
Claude Desktop JSON config:
{"mcpServers": {"apify-msha": {"url": "https://mcp.apify.com/?tools=automation-lab/msha-mine-safety-scraper"}}}
Example prompts:
- "Run the MSHA Mine Safety Scraper for recent West Virginia violations."
- "Get accident records from MSHA since 2023 and summarize injury categories."
- "Export mine records for Pennsylvania and list the top operators."
Scheduling
Schedule this actor daily, weekly, or monthly in Apify.
Common schedules:
- Weekly operator compliance monitor
- Monthly insurance portfolio refresh
- Quarterly ESG supplier screening
- Annual research dataset rebuild
Webhooks
Attach an Apify webhook to notify your system when a run succeeds.
You can send completed dataset links to Slack, email, Zapier, Make, or a custom API endpoint.
Performance notes
MSHA bulk files can be large.
The actor stops as soon as it reaches maxItems, but it still needs to download selected zip files before parsing.
For fastest test runs, select mines first or use exact filters.
For broad enforcement exports, expect larger downloads for violations and assessments.
Limitations
- The actor depends on MSHA public bulk file availability.
- Some source datasets do not include every normalized output field.
- State filtering applies only when the source row includes a state field.
- The actor does not infer state by joining non-mine datasets to the mines dataset during the same run.
- Very broad exports may take longer because MSHA files are large.
Troubleshooting
Why did I get fewer rows than expected?
Your filters may be too narrow, or the selected source dataset may not contain that field. Try removing optional filters or increasing maxItems.
Why is the state field missing on some rows?
Some MSHA enforcement datasets do not include a state column. Use mine ID joins downstream if state is required for every event record.
Why did the run download a large file?
MSHA publishes some datasets as large zip files. This actor downloads the official file and streams records until enough matching rows are found.
Data quality
Dates are converted from MSHA MM/DD/YYYY values to ISO YYYY-MM-DD where possible.
Currency and numeric fields are converted to numbers when source values are parseable.
Empty, unknown, and placeholder values are removed from output rows.
Legality
This actor extracts public government data from official MSHA datasets.
You are responsible for using the data in compliance with applicable laws, regulations, and Apify terms.
Do not use the data for unlawful discrimination, harassment, or unsafe operational decisions without appropriate verification.
Related scrapers
Related Automation Lab actors you may use with this dataset:
- https://apify.com/automation-lab/osha-inspections-scraper
- https://apify.com/automation-lab/epa-echo-scraper
- https://apify.com/automation-lab/epa-tri-scraper
- https://apify.com/automation-lab/fra-railroad-accidents-scraper
FAQ
Is this an official MSHA product?
No. It is an independent Apify actor that extracts public MSHA datasets.
Do I need an MSHA account?
No. The actor uses public bulk files.
Can I scrape all records?
Yes, set a high maxItems value and choose the datasets you need. Large exports may take longer.
Can I filter by operator?
Yes. Use operatorName for case-insensitive operator or violator matching.
Can I filter by mine ID?
Yes. Use mineId for exact matching.
Can I use it for monitoring?
Yes. Schedule runs and compare new dataset records against prior runs in your own storage.
Does it use proxies?
No proxy is required for normal operation.
Does it use a browser?
No. It uses HTTP downloads and local parsing.
Changelog
0.1
Initial version with mines, inspections, violations, accidents, and assessed violations support.