MSHA Data API

RESTful API for MSHA mining safety data - accidents, violations, inspections, and mine details

Available Endpoints

POST/api/search-mines

Search for mines by name, operator, location, or material type

Parameters: query, state, status, material_type, limit
POST/api/mine-details

Get complete information about a specific mine

Parameters: mine_id (required)
POST/api/search-accidents

Search accident records with flexible filtering

Parameters: mine_id, start_year, end_year, degree_injury, accident_type, state, limit
POST/api/search-violations

Search violation and citation records

Parameters: mine_id, start_year, end_year, severity, s_and_s, section_of_act, limit

Quick Start

Search for mines:

curl -X POST http://localhost:3001/api/search-mines \
  -H "Content-Type: application/json" \
  -d '{"query": "coal", "state": "WV", "limit": 10}'

Get mine details:

curl -X POST http://localhost:3001/api/mine-details \
  -H "Content-Type: application/json" \
  -d '{"mine_id": "4104757"}'

Search accidents:

curl -X POST http://localhost:3001/api/search-accidents \
  -H "Content-Type: application/json" \
  -d '{"state": "PA", "start_year": 2020, "end_year": 2024, "limit": 50}'

Features

  • RESTful API with JSON responses
  • Direct access to PostgreSQL database
  • 20+ years of MSHA safety data
  • Flexible filtering and pagination
  • CORS enabled for web applications
  • Globally distributed for high availability