{
  "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": "VZHZWbexWOzcHa4q3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/owlabee~osha-epa-enforcement-report/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-owlabee-osha-epa-enforcement-report",
        "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-enforcement-report/runs": {
      "post": {
        "operationId": "runs-sync-owlabee-osha-epa-enforcement-report",
        "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-enforcement-report/run-sync": {
      "post": {
        "operationId": "run-sync-owlabee-osha-epa-enforcement-report",
        "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 or facility 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.",
            "items": {
              "type": "string"
            }
          },
          "identifiers": {
            "title": "Facility or inspection identifiers",
            "type": "array",
            "description": "Exact lookups, one per line: \"osha:<inspection activity number>\" (OSHA) or \"frs:<12-digit EPA FRS registry id>\" (EPA ECHO facility). Matched with high confidence.",
            "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 and EPA facilities to the facility state."
          },
          "zip": {
            "title": "ZIP code",
            "pattern": "^[0-9]{5}$",
            "type": "string",
            "description": "Five-digit ZIP code of the inspected site or EPA facility."
          },
          "dateFrom": {
            "title": "From date",
            "type": "string",
            "description": "Only records whose action date (OSHA inspection opening date; EPA case filing date, or settlement date when no filing date is published) is on or after this date. YYYY-MM-DD."
          },
          "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 needs your free DOL Data API key (below); EPA ECHO needs no key.",
            "items": {
              "type": "string",
              "enum": [
                "osha",
                "epa"
              ],
              "enumTitles": [
                "OSHA inspections, violations and penalties (DOL Data API, free key required)",
                "EPA enforcement cases (ECHO web services, no key)"
              ]
            },
            "default": [
              "osha",
              "epa"
            ]
          },
          "dolApiKey": {
            "title": "DOL Data API key (for OSHA)",
            "type": "string",
            "description": "Required for OSHA records. The U.S. Department of Labor gives these keys free at dataportal.dol.gov (sign in, then API keys). Stored encrypted and only sent to apiprod.dol.gov. Without it, OSHA is skipped with one error item and EPA still runs."
          },
          "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": "OSHA: add violations and penalties",
            "type": "boolean",
            "description": "Fetch OSHA citations for the inspections found (one extra request per 100 inspections) to fill violationCount, violationsByType, penaltyUsd and initialPenaltyUsd.",
            "default": true
          },
          "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 for each agency.",
            "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: 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}