{
  "openapi": "3.0.1",
  "info": {
    "title": "EPA ECHO Compliance Diff API — CAA, CWA, RCRA, SDWA Enforcement",
    "description": "Daily diff feed for EPA ECHO. Emits JSONL records for every change to facility compliance status, violations, inspections, federal enforcement cases, or CAA/CWA/RCRA/SDWA permit listings. Replaces $30-200k/yr enterprise EHS-watch (Enhesa, Enviance) at $20-500/mo. For ESG analysts and EJ litigators.",
    "version": "0.1",
    "x-build-id": "myRaO1Py0IN0qAGa8"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/changewire~epa-echo-compliance/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-changewire-epa-echo-compliance",
        "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/changewire~epa-echo-compliance/runs": {
      "post": {
        "operationId": "runs-sync-changewire-epa-echo-compliance",
        "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/changewire~epa-echo-compliance/run-sync": {
      "post": {
        "operationId": "run-sync-changewire-epa-echo-compliance",
        "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": {
          "registry_ids": {
            "title": "Registry ids",
            "type": "array",
            "description": "Specific EPA REGISTRY_ID values to track. If empty, falls through to state + program filters.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "state": {
            "title": "State filter (2-letter code)",
            "type": "string",
            "description": "Two-letter US state code (e.g. TX, CA). Empty = no state filter (use cautiously: full national crawl may exceed page budget).",
            "default": ""
          },
          "programs": {
            "title": "Program filter",
            "type": "array",
            "description": "Subset of CAA / CWA / RCRA / SDWA. Case-insensitive. Empty = all programs.",
            "default": [
              "CAA",
              "CWA"
            ],
            "items": {
              "type": "string"
            }
          },
          "only_in_violation": {
            "title": "Only emit facilities currently in violation",
            "type": "boolean",
            "description": "If true, drops facilities whose 12-quarter noncompliance count is 0 before diffing.",
            "default": false
          },
          "enable_enforcement_cases": {
            "title": "Walk enforcement-case detail",
            "type": "boolean",
            "description": "If true, fetch /case_rest_services.get_cases for every facility. Adds ~1 request per facility — set false for fast surveys.",
            "default": true
          },
          "max_pages": {
            "title": "Max pages of cross-program facility lookup",
            "minimum": 1,
            "maximum": 25,
            "type": "integer",
            "description": "Number of get_facilities pages to walk when no explicit registry_ids provided. Each page is up to page_size rows.",
            "default": 1
          },
          "page_size": {
            "title": "Page size for facility lookup",
            "minimum": 50,
            "maximum": 500,
            "type": "integer",
            "description": "ECHO accepts up to ~500 per page; default 200 is a polite middle ground.",
            "default": 200
          },
          "change_types": {
            "title": "Change types to emit",
            "type": "array",
            "description": "Subset of: compliance_status_change, violation_added, inspection_added, enforcement_case_added, enforcement_case_resolved, permit_change. Empty = emit all.",
            "default": [
              "compliance_status_change",
              "violation_added",
              "inspection_added",
              "enforcement_case_added",
              "enforcement_case_resolved",
              "permit_change"
            ],
            "items": {
              "type": "string"
            }
          },
          "snapshot_key": {
            "title": "Snapshot key",
            "type": "string",
            "description": "Key-value store key holding the previous snapshot. Default: 'echo-snapshot-latest'.",
            "default": ""
          },
          "echo_base_url": {
            "title": "ECHO base URL override",
            "type": "string",
            "description": "Override the ECHO REST base. Default https://echo.epa.gov/efservice. Useful for offline test mirrors.",
            "default": ""
          },
          "rate_limit_rps": {
            "title": "Polite rate limit (requests per second)",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "EPA ECHO does not publish a public RPS limit but throttles aggressive callers. Default 2 is polite.",
            "default": 2
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}