{
  "openapi": "3.0.1",
  "info": {
    "title": "OSHA Inspections by Company + EPA Enforcement Report",
    "description": "Look up OSHA inspections, violations and penalties (DOL Data API) and EPA ECHO enforcement cases by company name, facility ID, state or ZIP. One normalized record per inspection or case, a per-company summary, name-match confidence, and new-record monitoring. Pay per record.",
    "version": "0.1",
    "x-build-id": "ccX3eA3Ru3EUENBKr"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/owlabee~osha-epa-inspections/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-owlabee-osha-epa-inspections",
        "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/owlabee~osha-epa-inspections/runs": {
      "post": {
        "operationId": "runs-sync-owlabee-osha-epa-inspections",
        "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/owlabee~osha-epa-inspections/run-sync": {
      "post": {
        "operationId": "run-sync-owlabee-osha-epa-inspections",
        "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": {
          "companies": {
            "title": "Company names",
            "type": "array",
            "description": "Company or establishment names to look up, one per line. Agencies index records by establishment, facility, mine operator or employer name, so every match carries a matchBasis and a matchConfidence (high, medium, low) and different firms are never merged. Add a state or ZIP to narrow common names. FMCSA carriers are looked up by USDOT number only (see identifiers), never by name.",
            "items": {
              "type": "string"
            }
          },
          "identifiers": {
            "title": "Facility or inspection identifiers",
            "type": "array",
            "description": "Exact lookups, one per line: \"osha:<inspection activity number>\" (OSHA), \"frs:<12-digit EPA FRS registry id>\" (EPA ECHO facility), \"msha:<7-digit MSHA mine id>\", \"whd:<WHD case id>\" or \"usdot:<USDOT number>\" (FMCSA carrier). Matched with high confidence. osha: and frs: need their agency in sources; msha:, whd: and usdot: query their own agency whatever sources says.",
            "items": {
              "type": "string"
            }
          },
          "state": {
            "title": "State",
            "pattern": "^[A-Za-z]{2}$",
            "type": "string",
            "description": "Two-letter USPS code (for example CA). Restricts OSHA inspections to the site state, EPA facilities to the facility state, MSHA inspections to the mine's state and WHD cases to the employer's state. Not applied to identifier lookups."
          },
          "zip": {
            "title": "ZIP code",
            "pattern": "^[0-9]{5}$",
            "type": "string",
            "description": "Five-digit ZIP code of the inspected site, EPA facility or WHD employer (MSHA publishes no ZIP; it is not applied there)."
          },
          "dateFrom": {
            "title": "From date",
            "type": "string",
            "description": "Only records whose action date is on or after this date. YYYY-MM-DD. Action date: OSHA and MSHA inspection opening date; EPA case filing date (settlement date when no filing date is published); WHD end of the findings period; FMCSA inspection date."
          },
          "dateTo": {
            "title": "To date",
            "type": "string",
            "description": "Only records whose action date is on or before this date. YYYY-MM-DD."
          },
          "sources": {
            "title": "Sources",
            "type": "array",
            "description": "Which agencies to query. OSHA, MSHA and WHD use your one free DOL Data API key (below); EPA ECHO and FMCSA need no key. The default stays OSHA + EPA; MSHA, WHD and FMCSA are opt-in. FMCSA answers usdot: identifiers only.",
            "items": {
              "type": "string",
              "enum": [
                "osha",
                "epa",
                "msha",
                "whd",
                "fmcsa"
              ],
              "enumTitles": [
                "OSHA inspections, violations and penalties (DOL Data API, free key required)",
                "EPA enforcement cases (ECHO web services, no key)",
                "MSHA mine inspections, violations and assessed penalties (DOL Data API, same key)",
                "WHD wage and hour cases: back wages, penalties, violations by law (DOL Data API, same key)",
                "FMCSA carrier profile and roadside inspections by USDOT number (data.transportation.gov, no key)"
              ]
            },
            "default": [
              "osha",
              "epa"
            ]
          },
          "dolApiKey": {
            "title": "DOL Data API key (for OSHA, MSHA and WHD)",
            "type": "string",
            "description": "Required for OSHA, MSHA and WHD records. The U.S. Department of Labor gives these keys free at dataportal.dol.gov (sign in, then API keys); DOL's terms do not allow sharing a key, so each user brings their own. Stored encrypted and only sent to apiprod.dol.gov. Without it, those sources are skipped with one error item each and EPA and FMCSA still run."
          },
          "minMatchConfidence": {
            "title": "Minimum name-match confidence",
            "enum": [
              "high",
              "medium",
              "low"
            ],
            "type": "string",
            "description": "high = names equal after removing punctuation and suffixes such as Inc or LLC; medium = your name is a whole-word prefix of the agency's name (\"Tesla\" → \"TESLA MOTORS INC\"); low = the words appear elsewhere in the name or only as a substring, including EPA cases filed under another party's name at a matched facility.",
            "default": "medium"
          },
          "includeSummary": {
            "title": "Add a per-company summary record",
            "type": "boolean",
            "description": "After each company, write one recordType \"company-summary\" item: counts and penalties per agency, open records, the most recent action, and every matched agency name listed separately.",
            "default": true
          },
          "includeViolations": {
            "title": "Add violations and penalties",
            "type": "boolean",
            "description": "OSHA: fetch citations for the inspections found (one extra request per 100 inspections) to fill violationCount, violationsByType, penaltyUsd and initialPenaltyUsd. MSHA: citations to the operator and assessed penalties (one request per 100 inspections plus one per 100 citations). FMCSA: the cited violations of inspections that have any (one request per 100 inspections).",
            "default": true
          },
          "includeAccidents": {
            "title": "OSHA: add accident and fatality investigations",
            "type": "boolean",
            "description": "For the OSHA inspections found, add the linked accident investigations (accident, accident_injury and accident_abstract tables): event date, description, keywords, a fatality flag, injury counts by degree and the abstract with personal names redacted. No injured person's age, sex or name is output. Two to three extra requests per 100 inspections.",
            "default": false
          },
          "epaAllFacilities": {
            "title": "EPA: check every matched facility",
            "type": "boolean",
            "description": "By default only facilities that ECHO flags with formal enforcement actions or penalties are checked for cases. Turn on to request the case list of every matched facility (slower; one extra request per facility).",
            "default": false
          },
          "maxRecordsPerCompany": {
            "title": "Max records per company and source",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Most recent records kept per company or identifier for each agency (FMCSA: inspections per USDOT number, plus the carrier profile).",
            "default": 100
          },
          "maxFacilitiesPerCompany": {
            "title": "EPA: max facilities per company",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Matched EPA facilities checked for enforcement cases per company, those with the most formal actions first.",
            "default": 25
          },
          "maxResults": {
            "title": "Max dataset items",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Upper bound on items written across the run (records, summaries and error items). Use it with the run's maximum cost to control spend.",
            "default": 1000
          },
          "timeBudgetSecs": {
            "title": "Time budget per source",
            "minimum": 30,
            "maximum": 1800,
            "type": "integer",
            "description": "Wall time each agency may take over the whole run. A source with 60 s in a row without a usable response is abandoned earlier. Raise it for long company lists.",
            "default": 300
          },
          "monitor": {
            "title": "Monitor mode (only new or changed since last run)",
            "type": "boolean",
            "description": "For schedules: remember every record seen per company in the state store and write only records that are new, or whose status, penalty or closing date changed (changeType new / changed). The first run is a baseline and writes, and charges for, everything.",
            "default": false
          },
          "stateStoreName": {
            "title": "State store name",
            "type": "string",
            "description": "Named key-value store that holds the monitor snapshots. Use a different name per schedule if two schedules share companies.",
            "default": "osha-epa-enforcement-report-state"
          },
          "webhookUrl": {
            "title": "Webhook URL (optional)",
            "pattern": "^https?://.+",
            "type": "string",
            "description": "After the run, the Actor POSTs one JSON document here: the notice, run counts, charges, and up to 500 of the items written (in monitor mode, only the new and changed records), without the nested raw fields. Failures are logged, never fatal."
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}