{
  "openapi": "3.0.1",
  "info": {
    "title": "EPA ECHO Environmental Compliance Search",
    "description": "EPA ECHO Environmental Compliance Search is an Apify actor that queries the U.S. Environmental Protection Agency's Enforcement and Compliance History Online (ECHO) database for facility-level environmental compliance data.",
    "version": "0.1",
    "x-build-id": "VVdsDBjwm6Y8oAwDR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ryanclinton~epa-echo-search/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ryanclinton-epa-echo-search",
        "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/ryanclinton~epa-echo-search/runs": {
      "post": {
        "operationId": "runs-sync-ryanclinton-epa-echo-search",
        "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/ryanclinton~epa-echo-search/run-sync": {
      "post": {
        "operationId": "run-sync-ryanclinton-epa-echo-search",
        "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": {
          "facilityName": {
            "title": "Facility Name",
            "type": "string",
            "description": "Search by facility name (partial match). Examples: 'EXXON', 'DOW CHEMICAL', 'TYSON'"
          },
          "state": {
            "title": "State",
            "type": "string",
            "description": "Filter by U.S. state (2-letter code). Examples: 'TX', 'CA', 'OH'. Comma-separate for multiple: 'TX,CA'"
          },
          "city": {
            "title": "City",
            "type": "string",
            "description": "Filter by city name. Examples: 'HOUSTON', 'LOS ANGELES'"
          },
          "zipCode": {
            "title": "ZIP Code",
            "type": "string",
            "description": "Filter by 5-digit ZIP code. Comma-separate for multiple: '77001,77002'"
          },
          "county": {
            "title": "County",
            "type": "string",
            "description": "Filter by county name (use with State for best results)"
          },
          "epaRegion": {
            "title": "EPA Region",
            "enum": [
              "",
              "01",
              "02",
              "03",
              "04",
              "05",
              "06",
              "07",
              "08",
              "09",
              "10"
            ],
            "type": "string",
            "description": "Filter by EPA region number (01-10)"
          },
          "naicsCode": {
            "title": "NAICS Industry Code",
            "type": "string",
            "description": "Filter by NAICS code prefix (2-6 digits). Examples: '324' (Petroleum/Coal Mfg), '562' (Waste Management), '221' (Utilities)"
          },
          "sicCode": {
            "title": "SIC Industry Code",
            "type": "string",
            "description": "Filter by SIC code prefix (2-4 digits). Examples: '29' (Petroleum Refining), '49' (Electric/Gas/Sanitary)"
          },
          "program": {
            "title": "Environmental Program",
            "enum": [
              "",
              "A",
              "W",
              "R",
              "S",
              "T",
              "G",
              "M",
              "ALL"
            ],
            "type": "string",
            "description": "Filter by environmental program/media type"
          },
          "complianceStatus": {
            "title": "Compliance Status",
            "enum": [
              "",
              "2",
              "3",
              "4"
            ],
            "type": "string",
            "description": "Filter by compliance status"
          },
          "penaltyFilter": {
            "title": "Penalty Filter",
            "enum": [
              "",
              "ANY",
              "NEVER",
              "LE12",
              "GT12",
              "LE24",
              "GT24"
            ],
            "type": "string",
            "description": "Filter by penalty history"
          },
          "majorFacility": {
            "title": "Major Facility",
            "enum": [
              "",
              "Y",
              "N"
            ],
            "type": "string",
            "description": "Filter by major/minor facility status"
          },
          "federalFacility": {
            "title": "Federal Facility Only",
            "type": "boolean",
            "description": "Only show federal government facilities",
            "default": false
          },
          "formalEnforcement": {
            "title": "Formal Enforcement (5yr)",
            "type": "boolean",
            "description": "Only show facilities with formal enforcement actions in the last 5 years",
            "default": false
          },
          "inspectionFilter": {
            "title": "Inspection History",
            "enum": [
              "",
              "W",
              "N",
              "NV"
            ],
            "type": "string",
            "description": "Filter by inspection history"
          },
          "inspectionYears": {
            "title": "Inspection Years",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Number of years for inspection filter (1-5). Only used when Inspection History is 'Within' or 'Not Within'",
            "default": 3
          },
          "includeDetailedReport": {
            "title": "Include Detailed Report",
            "type": "boolean",
            "description": "Fetch the Detailed Facility Report (DFR) for each facility — includes permits, enforcement actions, inspections, and violations. Makes one extra API call per facility.",
            "default": false
          },
          "maxResults": {
            "title": "Max Results",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of facility records to return (1-10,000)",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}