{
  "openapi": "3.1.0",
  "info": {
    "title": "FacilityProof API",
    "version": "1.0.0",
    "description": "Resolve one U.S. physical facility and return a bounded, source-reconciled environmental regulatory evidence report covering core program and permit coverage, inspections, reported violations, formal enforcement, penalties, freshness, source gaps, and explicit conflicts."
  },
  "servers": [
    {
      "url": "https://facilityproof.davisvillelabs.com"
    }
  ],
  "paths": {
    "/v1/facility/compliance-evidence": {
      "post": {
        "operationId": "checkFacilityComplianceEvidence",
        "summary": "Check source-reconciled facility compliance evidence",
        "description": "$15 specialist operation when commerce is enabled for the resolved production-ready state. Facility identity and state availability are resolved before payment. Ambiguous/not-found identity and unreleased states never receive a payment challenge. A completed report preserves source gaps and conflicts rather than converting missing data into a clean/compliant conclusion.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Facility or site name."
                  },
                  "city": {
                    "type": "string",
                    "minLength": 1
                  },
                  "state": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "zip": {
                    "type": "string",
                    "pattern": "^\\d{5}(?:-\\d{4})?$"
                  },
                  "address": {
                    "type": "string",
                    "minLength": 1
                  },
                  "frsId": {
                    "type": "string",
                    "pattern": "^\\d{12}$",
                    "description": "EPA Facility Registry Service identifier when known."
                  },
                  "programId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Authoritative program identifier such as an NPDES or RCRA ID when known."
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "name"
                    ]
                  },
                  {
                    "required": [
                      "frsId"
                    ]
                  },
                  {
                    "required": [
                      "programId"
                    ]
                  }
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "facility-compliance-evidence.v1",
            "headers": {
              "Payment-Receipt": {
                "description": "MPP receipt when commerce is active.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "schemaVersion",
                    "operation",
                    "reportId",
                    "asOf",
                    "generatedAt",
                    "facility",
                    "programs",
                    "inspections",
                    "violations",
                    "enforcementActions",
                    "penalties",
                    "freshness",
                    "sourceGaps",
                    "conflicts",
                    "evidence",
                    "quality",
                    "limitations"
                  ],
                  "properties": {
                    "schemaVersion": {
                      "const": "facility-compliance-evidence.v1"
                    },
                    "operation": {
                      "const": "facilityproof.check_facility_compliance_evidence"
                    },
                    "reportId": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string"
                    },
                    "generatedAt": {
                      "type": "string"
                    },
                    "facility": {
                      "type": "object"
                    },
                    "programs": {
                      "type": "array"
                    },
                    "inspections": {
                      "type": "array"
                    },
                    "violations": {
                      "type": "array"
                    },
                    "enforcementActions": {
                      "type": "array"
                    },
                    "penalties": {
                      "type": "array"
                    },
                    "freshness": {
                      "type": "array"
                    },
                    "sourceGaps": {
                      "type": "array"
                    },
                    "conflicts": {
                      "type": "array"
                    },
                    "evidence": {
                      "type": "array"
                    },
                    "quality": {
                      "type": "object"
                    },
                    "limitations": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "402": {
            "description": "MPP payment challenge after physical facility identity and production-ready state availability have been resolved."
          },
          "409": {
            "description": "Ambiguous physical facility identity. Non-billable."
          },
          "422": {
            "description": "No sufficiently reliable physical facility match, or paid service is not yet released for the resolved state. Non-billable."
          },
          "503": {
            "description": "Payment provider or paid delivery unavailable. Settled delivery failures are retryable with the same credential."
          }
        },
        "x-facilityproof-commerce": {
          "enabled": false,
          "configured": false,
          "mode": "unknown",
          "protocol": "MPP",
          "operation": "check_facility_compliance_evidence",
          "tool": "facilityproof.check_facility_compliance_evidence",
          "http": "/v1/facility/compliance-evidence",
          "priceCents": 1500,
          "currency": "USD",
          "methods": [
            "stripe"
          ],
          "availability": {
            "rollout": "state_by_state",
            "releasedStates": [
              "CA"
            ],
            "unreleasedStateRule": "When paid commerce is active, an unreleased state is rejected before any payment challenge and is non-billable."
          },
          "identityRule": "Physical facility identity and production-ready state availability are deterministically resolved before any payment challenge. Ambiguous, unresolved, or unreleased-state requests are non-billable.",
          "retryRule": "After a settled delivery failure, retry the identical request with the same credential to recover delivery without a second settlement."
        }
      }
    }
  },
  "x-facilityproof": {
    "contracts": {
      "report": "facility-compliance-evidence.v1",
      "preflight": "facilityproof-preflight.v1",
      "stateAvailability": "facilityproof-state-availability.v1"
    },
    "availability": {
      "rollout": "state_by_state",
      "releasedStates": [
        "CA"
      ],
      "unreleasedStateRule": "When paid commerce is active, an unreleased state is rejected before any payment challenge and is non-billable."
    },
    "commerce": {
      "enabled": false,
      "configured": false,
      "mode": "unknown",
      "protocol": "MPP",
      "operation": "check_facility_compliance_evidence",
      "tool": "facilityproof.check_facility_compliance_evidence",
      "http": "/v1/facility/compliance-evidence",
      "priceCents": 1500,
      "currency": "USD",
      "methods": [
        "stripe"
      ],
      "availability": {
        "rollout": "state_by_state",
        "releasedStates": [
          "CA"
        ],
        "unreleasedStateRule": "When paid commerce is active, an unreleased state is rejected before any payment challenge and is non-billable."
      },
      "identityRule": "Physical facility identity and production-ready state availability are deterministically resolved before any payment challenge. Ambiguous, unresolved, or unreleased-state requests are non-billable.",
      "retryRule": "After a settled delivery failure, retry the identical request with the same credential to recover delivery without a second settlement."
    },
    "sourcePolicy": "facilityproof-source-policy@2.0.0"
  }
}