{
  "openapi": "3.0.1",
  "info": {
    "title": "MSHA Compliance Action (Assessed Violations) Data Scraper",
    "description": "Scrape the U.S. Mine Safety and Health Administration's (MSHA) full case-level Assessed Violations enforcement dataset - 3M+ citations and orders since 2000, joined with mine details (state, commodity, operator). Filter by mine, violator, state, commodity, penalty amount, date range, and more.",
    "version": "1.0",
    "x-build-id": "jtdLblz7Trtor7O7m"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawlerbros~msha-compliance-action-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawlerbros-msha-compliance-action-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/crawlerbros~msha-compliance-action-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawlerbros-msha-compliance-action-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/crawlerbros~msha-compliance-action-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawlerbros-msha-compliance-action-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "byMineId",
              "violations",
              "accidents",
              "inspections"
            ],
            "type": "string",
            "description": "What to fetch. `search`/`byMineId` use MSHA's Assessed Violations dataset (penalty-focused). `violations` uses MSHA's broader raw Violations dataset (adds negligence/likelihood/gravity detail, including violations still in process). `accidents` and `inspections` are separate MSHA datasets.",
            "default": "search"
          },
          "violatorName": {
            "title": "Violator / operator name contains",
            "type": "string",
            "description": "Case-insensitive substring match on the operator/contractor name cited (mode=search, byMineId, violations)."
          },
          "mineId": {
            "title": "Mine IDs",
            "type": "array",
            "description": "MSHA Mine ID numbers (e.g. `0800823`). Required for mode=byMineId. Optional exact-match filter for mode=violations/accidents/inspections. Ignored by mode=search.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "mineName": {
            "title": "Mine name contains",
            "type": "string",
            "description": "Case-insensitive substring match on the mine name (joined from MSHA's Mines dataset, or direct on mode=violations). Applies to all modes except byMineId."
          },
          "state": {
            "title": "State",
            "enum": [
              "AK",
              "AL",
              "AR",
              "AS",
              "AZ",
              "CA",
              "CO",
              "CT",
              "DE",
              "FL",
              "GA",
              "GU",
              "HI",
              "IA",
              "ID",
              "IL",
              "IN",
              "KS",
              "KY",
              "LA",
              "MA",
              "MD",
              "ME",
              "MI",
              "MN",
              "MO",
              "MP",
              "MS",
              "MT",
              "NC",
              "ND",
              "NE",
              "NH",
              "NJ",
              "NM",
              "NV",
              "NY",
              "OH",
              "OK",
              "OR",
              "PA",
              "PR",
              "RI",
              "SC",
              "SD",
              "TN",
              "TX",
              "UT",
              "VA",
              "VI",
              "VT",
              "WA",
              "WI",
              "WV",
              "WY"
            ],
            "type": "string",
            "description": "US state/territory where the mine is located (joined from the Mines dataset). All modes."
          },
          "commodityType": {
            "title": "Commodity type",
            "enum": [
              "Coal",
              "Metal",
              "Nonmetal",
              "SandAndGravel",
              "Stone"
            ],
            "type": "string",
            "description": "Mine commodity classification (joined from the Mines dataset's PRIMARY_CANVASS field). This is MSHA's own taxonomy, not NAICS. All modes."
          },
          "coalMetalInd": {
            "title": "Coal vs. Metal/Nonmetal",
            "enum": [
              "C",
              "M"
            ],
            "type": "string",
            "description": "Top-level MSHA sector split on the record itself. All modes."
          },
          "district": {
            "title": "MSHA district",
            "enum": [
              "C03",
              "C04",
              "C05",
              "C07",
              "C08",
              "C09",
              "C10",
              "M2",
              "M3",
              "M4",
              "M5",
              "M6",
              "M7"
            ],
            "type": "string",
            "description": "MSHA field district code that oversees the mine (joined from the Mines dataset). `C`-prefixed = Coal district, `M`-prefixed = Metal/Nonmetal district. All modes."
          },
          "mineStatus": {
            "title": "Mine status",
            "enum": [
              "Active",
              "Abandoned",
              "Abandoned and Sealed",
              "Intermittent",
              "Temporarily Idled",
              "NonProducing",
              "New Mine"
            ],
            "type": "string",
            "description": "Current operating status of the mine (joined from the Mines dataset). All modes."
          },
          "violatorType": {
            "title": "Violator type",
            "enum": [
              "Operator",
              "Contractor"
            ],
            "type": "string",
            "description": "Whether the violation was cited against the mine operator or an independent contractor (mode=search, byMineId, violations)."
          },
          "violationType": {
            "title": "Violation type (legal basis)",
            "enum": [
              "104(a)",
              "104(b)",
              "104(c)",
              "103(k)",
              "104(d)(1)",
              "104(d)(2)",
              "104(e)(1)",
              "104(e)(2)",
              "104(g)(1)",
              "107(a)"
            ],
            "type": "string",
            "description": "Section of the Mine Act under which the citation/order was issued (mode=search, byMineId, violations)."
          },
          "citationType": {
            "title": "Citation type",
            "enum": [
              "Citation",
              "Order",
              "Safeguard",
              "Notice",
              "Written Notice"
            ],
            "type": "string",
            "description": "Whether the issuance is a Citation, Order, Safeguard, Notice, or Written Notice (mode=search, byMineId, violations)."
          },
          "caseStatus": {
            "title": "Assessment case status",
            "enum": [
              "Received",
              "Closed",
              "Printed",
              "Invalid"
            ],
            "type": "string",
            "description": "Status of MSHA's penalty assessment case (mode=search, byMineId)."
          },
          "significantAndSubstantialOnly": {
            "title": "Significant & Substantial (S&S) only",
            "type": "boolean",
            "description": "Only include violations flagged by the inspector as reasonably likely to result in a serious injury (mode=search, byMineId, violations).",
            "default": false
          },
          "negligenceLevel": {
            "title": "Negligence level",
            "enum": [
              "NoNegligence",
              "LowNegligence",
              "ModNegligence",
              "HighNegligence",
              "Reckless"
            ],
            "type": "string",
            "description": "Degree of negligence the inspector assigned to the violator (mode=violations)."
          },
          "likelihood": {
            "title": "Likelihood of injury",
            "enum": [
              "NoLikelihood",
              "Unlikely",
              "Reasonably",
              "Highly",
              "Occurred"
            ],
            "type": "string",
            "description": "Inspector's assessment of how likely the cited condition was to result in an injury (mode=violations)."
          },
          "injuryIllnessPotential": {
            "title": "Injury/illness potential",
            "enum": [
              "NoLostDays",
              "LostDays",
              "Permanent",
              "Fatal"
            ],
            "type": "string",
            "description": "Gravity of the injury the inspector determined the violation could cause (mode=violations)."
          },
          "contestedOnly": {
            "title": "Contested only",
            "type": "boolean",
            "description": "Only include violations the violator formally contested with FMSHRC (mode=violations).",
            "default": false
          },
          "specialAssessmentOnly": {
            "title": "Special assessment only",
            "type": "boolean",
            "description": "Only include violations MSHA designated for Special Assessment (a heightened-scrutiny penalty process, bypassing the standard point formula) (mode=violations).",
            "default": false
          },
          "penaltyAmountMin": {
            "title": "Minimum penalty amount (USD)",
            "minimum": 0,
            "maximum": 1000000,
            "type": "integer",
            "description": "Only include violations with a current assessed penalty at or above this amount (mode=search, byMineId, violations)."
          },
          "penaltyAmountMax": {
            "title": "Maximum penalty amount (USD)",
            "minimum": 0,
            "maximum": 1000000,
            "type": "integer",
            "description": "Only include violations with a current assessed penalty at or below this amount (mode=search, byMineId, violations)."
          },
          "issueDateFrom": {
            "title": "Issued after (YYYY-MM-DD)",
            "type": "string",
            "description": "Only include violations issued on or after this date (mode=search, byMineId, violations)."
          },
          "issueDateTo": {
            "title": "Issued before (YYYY-MM-DD)",
            "type": "string",
            "description": "Only include violations issued on or before this date (mode=search, byMineId, violations)."
          },
          "mineType": {
            "title": "Mine type",
            "enum": [
              "Surface",
              "Underground",
              "Facility"
            ],
            "type": "string",
            "description": "Physical mine type (joined from the Mines dataset, or direct on mode=violations). All modes."
          },
          "accidentDateFrom": {
            "title": "Accident date after (YYYY-MM-DD)",
            "type": "string",
            "description": "Only include accidents that occurred on or after this date (mode=accidents)."
          },
          "accidentDateTo": {
            "title": "Accident date before (YYYY-MM-DD)",
            "type": "string",
            "description": "Only include accidents that occurred on or before this date (mode=accidents)."
          },
          "degreeOfInjury": {
            "title": "Degree of injury",
            "enum": [
              "00",
              "01",
              "02",
              "03",
              "04",
              "05",
              "06",
              "07",
              "08",
              "09",
              "10"
            ],
            "type": "string",
            "description": "Severity classification MSHA assigned to the accident (mode=accidents)."
          },
          "accidentClassification": {
            "title": "Accident classification",
            "enum": [
              "01",
              "02",
              "03",
              "04",
              "05",
              "06",
              "07",
              "08",
              "09",
              "10",
              "11",
              "12",
              "13",
              "14",
              "15",
              "16",
              "17",
              "18",
              "19",
              "20",
              "21",
              "26",
              "27",
              "28",
              "29",
              "30",
              "31",
              "32"
            ],
            "type": "string",
            "description": "Circumstance/hazard category MSHA assigned to the accident (mode=accidents)."
          },
          "accidentType": {
            "title": "Accident type (event)",
            "enum": [
              "01",
              "02",
              "03",
              "04",
              "05",
              "06",
              "07",
              "08",
              "09",
              "10",
              "11",
              "12",
              "13",
              "14",
              "15",
              "16",
              "17",
              "18",
              "19",
              "20",
              "21",
              "22",
              "23",
              "24",
              "25",
              "26",
              "27",
              "28",
              "29",
              "30",
              "31",
              "32",
              "33",
              "34",
              "35",
              "36",
              "37",
              "38",
              "39",
              "40",
              "41",
              "42",
              "43",
              "44"
            ],
            "type": "string",
            "description": "The specific event that directly caused the injury (mode=accidents)."
          },
          "immediateNotificationType": {
            "title": "Immediate notification type",
            "enum": [
              "01",
              "02",
              "03",
              "04",
              "05",
              "06",
              "07",
              "08",
              "09",
              "10",
              "11",
              "12",
              "13"
            ],
            "type": "string",
            "description": "Category of MSHA's immediate/emergency notification requirement the accident triggered (mode=accidents)."
          },
          "inspectionDateFrom": {
            "title": "Inspection end date after (YYYY-MM-DD)",
            "type": "string",
            "description": "Only include inspections that concluded on or after this date (mode=inspections)."
          },
          "inspectionDateTo": {
            "title": "Inspection end date before (YYYY-MM-DD)",
            "type": "string",
            "description": "Only include inspections that concluded on or before this date (mode=inspections)."
          },
          "activityCode": {
            "title": "Inspection activity code",
            "enum": [
              "01",
              "02",
              "07",
              "09",
              "10",
              "12",
              "13",
              "16",
              "30",
              "37",
              "40",
              "42",
              "44",
              "46",
              "82",
              "AAA",
              "AAB",
              "ABA",
              "ABB",
              "ABC",
              "ABD",
              "ABE",
              "ADA",
              "ADB",
              "AEA",
              "AFA",
              "AFB",
              "AFC",
              "BAA",
              "BAB",
              "BAC",
              "BAD",
              "BAE",
              "BAF",
              "BBA",
              "BBB",
              "BBC",
              "BBD",
              "BBE",
              "BBF",
              "CAA",
              "CAB",
              "CBA",
              "CBB",
              "CBC",
              "CBD",
              "CBE",
              "CCA",
              "CCB",
              "CCC",
              "CCD",
              "CCE",
              "CCF",
              "CDA",
              "CDB",
              "CEA",
              "CEB",
              "CEC",
              "CED",
              "CEE",
              "CEF",
              "CFA",
              "CFB",
              "CFC",
              "E01",
              "E02",
              "E03",
              "E04",
              "E05",
              "E06",
              "E07",
              "E08",
              "E15",
              "E16",
              "E17",
              "E18",
              "E19",
              "E20",
              "E21",
              "E22",
              "E23",
              "E24",
              "E25",
              "E27",
              "E28",
              "E33"
            ],
            "type": "string",
            "description": "MSHA's code for the type of enforcement activity performed (mode=inspections)."
          },
          "inspectOfficeCode": {
            "title": "Inspecting office code",
            "type": "string",
            "description": "Exact match on the MSHA field office code that conducted the inspection (e.g. `M5852`). MSHA's bulk export does not include individual inspector names, only the office code and inspector count (mode=inspections)."
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of records to return. The source files have millions of rows sorted oldest-first; restrictive/date-recent filters may require scanning most or all of the file, which can take several minutes.",
            "default": 50
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}