{
  "openapi": "3.0.1",
  "info": {
    "title": "EPA ECHO Scraper - Facilities, Violations & Compliance Leads",
    "description": "Scrape the official EPA ECHO database: regulated facilities with name, address, NAICS/SIC, Clean Air/Water/RCRA/SDWA compliance status, violations, inspections, enforcement, penalties & toxic releases. Filter by state, industry & noncompliance. B2B compliance leads + monitoring.",
    "version": "0.1",
    "x-build-id": "HPRU1XLa6NKn2EI7a"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~epa-echo-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-epa-echo-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~epa-echo-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-epa-echo-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~epa-echo-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-epa-echo-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": {
          "registryIds": {
            "title": "FRS Registry IDs (direct lookup)",
            "type": "array",
            "description": "Look up specific facilities by their EPA FRS Registry ID, e.g. <code>110000468075</code>. Leave empty to search the whole database with the filters below.",
            "items": {
              "type": "string"
            }
          },
          "states": {
            "title": "States",
            "type": "array",
            "description": "Filter by facility state — two-letter USPS codes, e.g. <code>CA</code>, <code>TX</code>, <code>NY</code>, <code>PA</code>. Leave empty for all states & territories.",
            "items": {
              "type": "string"
            }
          },
          "epaRegions": {
            "title": "EPA regions",
            "type": "array",
            "description": "Filter by EPA region number, <code>01</code>–<code>10</code> (e.g. <code>09</code> = AZ/CA/HI/NV). Use instead of, or together with, states.",
            "items": {
              "type": "string"
            }
          },
          "counties": {
            "title": "Counties",
            "type": "array",
            "description": "Filter by county name (case-insensitive), e.g. <code>Harris</code>, <code>Los Angeles</code>, <code>Cook</code>. Combine with a state for accuracy.",
            "items": {
              "type": "string"
            }
          },
          "cities": {
            "title": "Cities",
            "type": "array",
            "description": "Filter by city name (case-insensitive), e.g. <code>Houston</code>, <code>Newark</code>, <code>Chicago</code>.",
            "items": {
              "type": "string"
            }
          },
          "zipCodes": {
            "title": "ZIP codes (prefix)",
            "type": "array",
            "description": "Filter by facility ZIP — full ZIP (<code>77002</code>) or a prefix (<code>770</code> matches all 770xx).",
            "items": {
              "type": "string"
            }
          },
          "facilityNameQuery": {
            "title": "Facility name contains",
            "type": "string",
            "description": "Only return facilities whose name contains this text (case-insensitive), e.g. <code>chemical</code>, <code>refinery</code>, <code>steel</code>, or a specific company name."
          },
          "streetQuery": {
            "title": "Street address contains",
            "type": "string",
            "description": "Filter by street address (case-insensitive contains), e.g. <code>industrial</code>, <code>harbor</code>."
          },
          "naicsCodes": {
            "title": "NAICS codes",
            "type": "array",
            "description": "Filter by NAICS industry code — full or prefix, e.g. <code>325</code> (chemical mfg), <code>3241</code> (petroleum), <code>2211</code> (power generation), <code>562</code> (waste management). Add several to combine.",
            "items": {
              "type": "string"
            }
          },
          "sicCodes": {
            "title": "SIC codes",
            "type": "array",
            "description": "Filter by legacy SIC industry code — full or prefix, e.g. <code>2911</code> (petroleum refining), <code>4911</code> (electric services), <code>2800</code> (chemicals).",
            "items": {
              "type": "string"
            }
          },
          "programs": {
            "title": "Environmental programs",
            "type": "array",
            "description": "Keep only facilities regulated under the selected program(s). Leave empty for all. <b>CAA</b> = Clean Air Act, <b>NPDES</b> = Clean Water Act discharge permits, <b>RCRA</b> = hazardous waste, <b>SDWA</b> = Safe Drinking Water, <b>TRI</b> = Toxic Release Inventory, <b>GHG</b> = greenhouse-gas reporters, <b>SEMS</b> = Superfund sites.",
            "items": {
              "type": "string",
              "enum": [
                "CAA",
                "NPDES",
                "RCRA",
                "SDWA",
                "TRI",
                "GHG",
                "SEMS",
                "TSCA",
                "RMP"
              ],
              "enumTitles": [
                "Clean Air Act (CAA)",
                "Clean Water Act (NPDES)",
                "RCRA hazardous waste",
                "Safe Drinking Water (SDWA)",
                "Toxic Release Inventory (TRI)",
                "Greenhouse Gas (GHG)",
                "Superfund (SEMS)",
                "TSCA chemicals",
                "Risk Mgmt Plan (RMP)"
              ]
            }
          },
          "activeOnly": {
            "title": "Active facilities only",
            "type": "boolean",
            "description": "Only include facilities currently flagged as active in EPA systems (recommended for clean, contactable leads). Turn off to include inactive / historical facilities.",
            "default": true
          },
          "majorFacilitiesOnly": {
            "title": "Major facilities only",
            "type": "boolean",
            "description": "Only return facilities flagged as <b>major</b> under their program (large air or water dischargers) — the biggest, highest-value sites.",
            "default": false
          },
          "federalFacilitiesOnly": {
            "title": "Federal facilities only",
            "type": "boolean",
            "description": "Only return federally-owned facilities (military bases, federal agencies).",
            "default": false
          },
          "complianceStatus": {
            "title": "Compliance status",
            "type": "array",
            "description": "Keep only facilities with the selected current compliance status. Leave empty for all. Pick <b>Significant/High Priority Violation</b> + <b>Violation</b> for the strongest service / legal intent.",
            "items": {
              "type": "string",
              "enum": [
                "significant",
                "violation",
                "compliant",
                "noViolation"
              ],
              "enumTitles": [
                "Significant / High Priority Violation",
                "Violation identified",
                "In compliance",
                "No violation"
              ]
            }
          },
          "significantNoncomplianceOnly": {
            "title": "Significant noncompliance only",
            "type": "boolean",
            "description": "Only facilities flagged in <b>Significant Noncompliance (SNC)</b> / High Priority Violation — the most serious, highest-intent environmental enforcement targets.",
            "default": false
          },
          "currentViolationsOnly": {
            "title": "Has current violations",
            "type": "boolean",
            "description": "Only facilities with an open / current violation on record.",
            "default": false
          },
          "hasPenaltiesOnly": {
            "title": "Has penalties",
            "type": "boolean",
            "description": "Only facilities that have been assessed monetary penalties.",
            "default": false
          },
          "minPenaltyAmount": {
            "title": "Min total penalty ($)",
            "type": "integer",
            "description": "Only facilities whose total assessed penalties are at least this amount (USD)."
          },
          "hasFormalEnforcementOnly": {
            "title": "Has formal enforcement",
            "type": "boolean",
            "description": "Only facilities with at least one formal enforcement action (civil/administrative/judicial) on record.",
            "default": false
          },
          "minQuartersInNoncompliance": {
            "title": "Min quarters in noncompliance",
            "type": "integer",
            "description": "Only facilities that have been out of compliance for at least this many of the last 12 quarters (0–12)."
          },
          "inspectionRecency": {
            "title": "Inspection recency",
            "enum": [
              "any",
              "within5yr",
              "notWithin5yr",
              "neverInspected"
            ],
            "type": "string",
            "description": "Filter by when the facility was last inspected. <b>Not inspected in 5+ years</b> surfaces overdue sites; <b>Inspected in last 5 years</b> surfaces actively-monitored ones.",
            "default": "any"
          },
          "includeDetailedReport": {
            "title": "Include Detailed Facility Report (DFR)",
            "type": "boolean",
            "description": "Enrich each facility with its full EPA Detailed Facility Report — per-statute enforcement summaries, every formal action (type/agency/date/penalty), all environmental permits, and the multi-year Toxic Release Inventory chemical history. Adds one request per facility and is billed as a <i>detailedReport</i> instead of a <i>facilityRecord</i>.",
            "default": false
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of facility records to return in this run.",
            "default": 1000
          },
          "sortBy": {
            "title": "Sort order",
            "enum": [
              "leadScore",
              "penaltiesHigh",
              "recentEnforcement",
              "recentInspection",
              "source"
            ],
            "type": "string",
            "description": "<b>Lead score</b> = most contactable / highest-intent first (recommended). <b>Highest penalties</b> / <b>Recent enforcement</b> / <b>Recent inspection</b> rank by those signals. <b>Source order</b> = fastest on very large limits.",
            "default": "leadScore"
          },
          "deduplicateResults": {
            "title": "Deduplicate within a run",
            "type": "boolean",
            "description": "Skip duplicate facilities (same Registry ID) within this run (recommended).",
            "default": true
          },
          "monitorMode": {
            "title": "Monitoring mode — only new / changed facilities",
            "type": "boolean",
            "description": "Remember which facilities were already returned (in a named key-value store) and emit ONLY facilities that are <b>new</b> or whose compliance changed since the last run — each tagged with a <code>monitorEvent</code> (<code>new</code>, <code>new_violation</code>, <code>new_enforcement</code>, <code>new_penalty</code>, <code>status_change</code>). EPA refreshes ECHO regularly; run on a Schedule to capture fresh enforcement as 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 or industry) so different monitors don't share state.",
            "default": "default"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional proxy. The EPA ECHO API is queried directly and needs no proxy — leave this off for the fastest queries. 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}