{
  "openapi": "3.0.1",
  "info": {
    "title": "MSHA Mine, Quarry & Aggregates Operator Leads",
    "description": "Scrape US mine, quarry & aggregates operators from official MSHA data: operator & parent controller, commodity, employees, full address, geo, production & violation/penalty intel. Filter by state, commodity, status & size. B2B leads + monitoring, no browser.",
    "version": "0.1",
    "x-build-id": "ozqL7gqZbaGEgLqKG"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~msha-mine-operations-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-msha-mine-operations-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/scrapesage~msha-mine-operations-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-msha-mine-operations-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/scrapesage~msha-mine-operations-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-msha-mine-operations-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": {
          "states": {
            "title": "States",
            "type": "array",
            "description": "Filter by the state the mine is located in — two-letter USPS codes, e.g. <code>TX</code>, <code>WV</code>, <code>PA</code>, <code>CA</code>, <code>KY</code>. Leave empty for all states & territories.",
            "items": {
              "type": "string"
            }
          },
          "commodityGroups": {
            "title": "Commodity groups",
            "type": "array",
            "description": "Filter by what the operation mines. <b>Sand & Gravel</b> and <b>Stone</b> are the construction-aggregates producers (the largest, most accessible B2B segment); <b>Coal</b>, <b>Metal</b> and <b>Nonmetal</b> cover everything else. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "coal",
                "sandGravel",
                "stone",
                "nonmetal",
                "metal"
              ],
              "enumTitles": [
                "Coal",
                "Sand & Gravel",
                "Stone",
                "Nonmetal",
                "Metal"
              ]
            }
          },
          "coalOrMetal": {
            "title": "Coal or Metal/Nonmetal",
            "enum": [
              "any",
              "coal",
              "metalNonmetal"
            ],
            "type": "string",
            "description": "Quick high-level filter. Use the more specific <b>Commodity groups</b> above when you need it.",
            "default": "any"
          },
          "counties": {
            "title": "Counties",
            "type": "array",
            "description": "Filter by county name (case-insensitive), e.g. <code>Harris</code>, <code>Clearfield</code>, <code>Elko</code>.",
            "items": {
              "type": "string"
            }
          },
          "mineStatuses": {
            "title": "Mine statuses",
            "type": "array",
            "description": "Operational status. Defaults to <b>Active</b> — operating businesses that make the best leads. Add <b>New Mine</b> for brand-new, high-intent operations, or others to widen the net.",
            "items": {
              "type": "string",
              "enum": [
                "Active",
                "New Mine",
                "Intermittent",
                "NonProducing",
                "Temporarily Idled",
                "Abandoned",
                "Abandoned and Sealed"
              ],
              "enumTitles": [
                "Active",
                "New Mine (high intent)",
                "Intermittent",
                "Non-producing",
                "Temporarily idled",
                "Abandoned",
                "Abandoned & sealed"
              ]
            },
            "default": [
              "Active"
            ]
          },
          "mineTypes": {
            "title": "Mine types",
            "type": "array",
            "description": "Filter by mine type. <b>Facility</b> = a mill / preparation plant (no extraction).",
            "items": {
              "type": "string",
              "enum": [
                "Surface",
                "Underground",
                "Facility"
              ],
              "enumTitles": [
                "Surface",
                "Underground",
                "Facility / plant"
              ]
            }
          },
          "newMinesOnly": {
            "title": "New mines only (high intent)",
            "type": "boolean",
            "description": "Only return operations with status <b>New Mine</b> — brand-new mining operations just registering with MSHA. The highest-intent leads (they're buying equipment, services, insurance and PPE right now).",
            "default": false
          },
          "companyTypes": {
            "title": "Company types",
            "type": "array",
            "description": "Filter by the operator's legal entity type.",
            "items": {
              "type": "string",
              "enum": [
                "Corporation",
                "Limited Liability Corporation",
                "Partnership",
                "Sole Proprietor",
                "Other"
              ],
              "enumTitles": [
                "Corporation",
                "LLC",
                "Partnership",
                "Sole Proprietor",
                "Other"
              ]
            }
          },
          "minEmployees": {
            "title": "Min employees",
            "type": "integer",
            "description": "Only operations reporting at least this many employees (a proxy for deal size). Leave blank for any."
          },
          "maxEmployees": {
            "title": "Max employees",
            "type": "integer",
            "description": "Only operations reporting at most this many employees."
          },
          "operatorNameQuery": {
            "title": "Operator / mine name contains",
            "type": "string",
            "description": "Only return operations whose operator name or mine name contains this text (case-insensitive)."
          },
          "controllerNameQuery": {
            "title": "Parent controller contains",
            "type": "string",
            "description": "Only return operations whose parent / controlling company name contains this text — great for mapping every site owned by a target company."
          },
          "includeProduction": {
            "title": "Include production & employment",
            "type": "boolean",
            "description": "Enrich each record with the latest reported year's average employment, coal tonnage (coal mines) and hours worked from MSHA's annual employment/production data. Cheap and recommended — gives a fresh activity & size signal.",
            "default": true
          },
          "includeViolations": {
            "title": "Include violations & penalties (compliance intel)",
            "type": "boolean",
            "description": "Enrich each emitted record with MSHA citation counts, significant-and-substantial (S&S) counts, total proposed penalties, amounts due and the last violation date. High-intent signal for safety, PPE, compliance, consulting and insurance vendors. Downloads MSHA's full national citation history (large), so these runs take longer — for the fastest results give the run 4096 MB or more memory (1+ vCPU). Records are charged at the compliance rate when this is on.",
            "default": false
          },
          "violationsLookbackYears": {
            "title": "Violations lookback (years)",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many recent years count toward the 'recent violations' tally (the full all-time totals are always included).",
            "default": 5
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of mine/operator records to return in this run.",
            "default": 1000
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "leadScore",
              "employeesHigh",
              "recentStatus",
              "productionHigh",
              "penaltiesHigh"
            ],
            "type": "string",
            "description": "Ordering of the returned records.",
            "default": "leadScore"
          },
          "deduplicateResults": {
            "title": "Deduplicate within a run",
            "type": "boolean",
            "description": "Skip duplicate mine IDs within this run (recommended).",
            "default": true
          },
          "monitorMode": {
            "title": "Monitoring mode — only new / changed mines",
            "type": "boolean",
            "description": "Remember which operations were already returned (in a named key-value store) and emit ONLY mines that are new or whose status changed since the last run — each tagged <code>monitorEvent: \"new\"</code> or <code>\"status_change\"</code>. MSHA refreshes this data regularly; run on a Schedule to capture newly-registered operations as fresh leads. Works alongside Apify Schedules (the schedule starts the run; monitoring decides what's new).",
            "default": false
          },
          "monitorKey": {
            "title": "Monitor key",
            "type": "string",
            "description": "Names the memory used by monitoring mode. Use a distinct key per saved watch (e.g. per state/commodity) so different monitors don't share state.",
            "default": "default"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional proxy. MSHA open data is downloaded directly and needs no proxy — leave this off for the fastest downloads. Enable Apify Proxy only if your network requires it.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}