{
  "openapi": "3.1.0",
  "info": {
    "title": "Property Risk Passport API",
    "version": "0.1.0",
    "description": "Evaluate a US property address for parcel match, FEMA flood zone, flood proximity, taxing entities, school district, permit history, zoning/land-use context, insurance red flags, due-diligence risk score, quality score, recommended next steps, and official source links.",
    "keywords": [
      "property risk",
      "real estate due diligence",
      "flood zone",
      "FEMA NFHL",
      "parcel lookup",
      "tax entities",
      "school district",
      "permit history",
      "zoning",
      "homebuyer",
      "insurance risk",
      "Texas property",
      "Harris County",
      "Houston"
    ]
  },
  "servers": [
    {
      "url": "https://property-risk-passport-api.lifebite-app.workers.dev"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Health check",
        "responses": {
          "200": {
            "description": "Worker health status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "summary": "Health check alias",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/pricing": {
      "get": {
        "summary": "Pricing for paid property-risk endpoints",
        "responses": {
          "200": {
            "description": "Current pricing and accepted payment asset",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/property-risk-full/quote": {
      "get": {
        "summary": "Free quote and usage metadata for the paid full endpoint",
        "responses": {
          "200": {
            "description": "Price, input schema, output summary, coverage, and examples",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PropertyRiskQuote"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/evaluate_property_risk.tool.json": {
      "get": {
        "summary": "MCP-style tool descriptor",
        "responses": {
          "200": {
            "description": "Tool schema for evaluate_property_risk",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/coverage": {
      "get": {
        "responses": {
          "200": {
            "description": "Coverage"
          }
        }
      }
    },
    "/v1/proxy/agentic-search": {
      "get": {
        "summary": "CORS-safe proxy for Agentic.Market service search",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 300
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Agentic.Market search response"
          }
        }
      }
    },
    "/v1/proxy/bazaar-merchant": {
      "get": {
        "summary": "CORS-safe proxy for CDP Bazaar merchant discovery",
        "parameters": [
          {
            "name": "payTo",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CDP Bazaar merchant response"
          }
        }
      }
    },
    "/v1/property-risk-full": {
      "get": {
        "summary": "Human-readable method guidance",
        "description": "Returns guidance when the paid POST endpoint is opened in a browser.",
        "responses": {
          "405": {
            "description": "Use POST with a JSON body",
            "headers": {
              "Allow": {
                "schema": {
                  "type": "string"
                },
                "description": "Allowed methods"
              }
            }
          }
        }
      },
      "post": {
        "summary": "Full property risk passport",
        "description": "Evaluate a US property address for parcel match, FEMA flood zone, flood proximity, taxing entities, school district, permit history, zoning/land-use context, insurance red flags, due-diligence risk score, quality score, recommended next steps, and official source links.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 300,
                    "description": "Full US property street address to evaluate."
                  },
                  "response_mode": {
                    "type": "string",
                    "enum": [
                      "full",
                      "compact"
                    ],
                    "default": "full",
                    "description": "Use compact for a shorter agent-readable summary."
                  },
                  "includeOwner": {
                    "type": "boolean",
                    "description": "Optional. Include ownerName in the response when explicitly true.",
                    "default": false
                  }
                },
                "required": [
                  "address"
                ],
                "additionalProperties": false
              },
              "examples": {
                "compact": {
                  "summary": "Compact agent response",
                  "value": {
                    "address": "611 Walker St, Houston, TX 77002",
                    "response_mode": "compact"
                  }
                },
                "full": {
                  "summary": "Full response",
                  "value": {
                    "address": "611 Walker St, Houston, TX 77002"
                  }
                },
                "failedNewConstruction": {
                  "summary": "Failed/new-construction-style match",
                  "value": {
                    "address": "3413 Comice Lane, Pearland, TX 77581",
                    "response_mode": "compact"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Property risk response. Use response_mode=compact for summary shape.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PropertyRiskResponse"
                    },
                    {
                      "$ref": "#/components/schemas/PropertyRiskCompactResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "402": {
            "description": "x402 payment required unless a valid API key is supplied"
          }
        },
        "x-payment-info": {
          "protocol": "x402",
          "price": "$0.001",
          "asset": "USDC",
          "network": "eip155:8453"
        },
        "x-agentic-market": {
          "category": "Data",
          "keywords": [
            "property risk",
            "real estate due diligence",
            "flood zone",
            "FEMA NFHL",
            "parcel lookup",
            "tax entities",
            "school district",
            "permit history",
            "zoning",
            "homebuyer",
            "insurance risk",
            "Texas property",
            "Harris County",
            "Houston"
          ]
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HealthResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "service": {
            "type": "string"
          },
          "runtime": {
            "type": "string"
          },
          "x402_enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "service",
          "runtime",
          "x402_enabled"
        ]
      },
      "PricingResponse": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "asset": {
            "type": "string",
            "example": "USDC"
          },
          "network": {
            "type": "string",
            "example": "eip155:8453"
          },
          "endpoints": {
            "type": "object"
          }
        },
        "required": [
          "currency",
          "asset",
          "network",
          "endpoints"
        ]
      },
      "PropertyRiskQuote": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string"
          },
          "endpoint": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "const": "POST"
          },
          "price": {
            "type": "string",
            "example": "$0.001"
          },
          "asset": {
            "type": "string",
            "example": "USDC"
          },
          "network": {
            "type": "string",
            "example": "eip155:8453"
          },
          "input_schema": {
            "type": "object",
            "properties": {
              "address": {
                "type": "string",
                "minLength": 5,
                "maxLength": 300,
                "description": "Full US property street address to evaluate."
              },
              "response_mode": {
                "type": "string",
                "enum": [
                  "full",
                  "compact"
                ],
                "default": "full",
                "description": "Use compact for a shorter agent-readable summary."
              },
              "includeOwner": {
                "type": "boolean",
                "description": "Optional. Include ownerName in the response when explicitly true.",
                "default": false
              }
            },
            "required": [
              "address"
            ],
            "additionalProperties": false
          },
          "output_summary": {
            "type": "object"
          },
          "coverage": {
            "type": "object"
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "example_input": {
            "type": "object"
          }
        },
        "required": [
          "service",
          "endpoint",
          "method",
          "price",
          "asset",
          "network",
          "input_schema",
          "output_summary",
          "coverage",
          "limitations",
          "keywords",
          "example_input"
        ]
      },
      "PropertyRiskResponse": {
        "type": "object",
        "properties": {
          "schema_version": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "coverage": {
            "type": "object"
          },
          "result_status": {
            "enum": [
              "completed",
              "completed_with_warnings",
              "completed_with_blockers",
              "failed"
            ]
          },
          "address_input": {
            "type": "string"
          },
          "address_normalized": {
            "type": [
              "string",
              "null"
            ]
          },
          "geocode_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "match_status": {
            "type": "object"
          },
          "parcel": {
            "type": "object"
          },
          "flood_zone": {
            "type": "object"
          },
          "flood_proximity": {
            "type": "object"
          },
          "tax_jurisdictions": {
            "type": "object"
          },
          "taxing_entities": {
            "type": "object"
          },
          "school_district": {
            "type": "object"
          },
          "zoning": {
            "type": "object"
          },
          "land_use": {
            "type": [
              "object",
              "null"
            ]
          },
          "permit_history": {
            "type": "object"
          },
          "risk_score": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "risk_breakdown": {
            "type": "object"
          },
          "confidence_score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "data_quality_score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "recommended_next_steps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "official_source_links": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "metadata": {
            "type": "object"
          }
        },
        "required": [
          "schema_version",
          "request_id",
          "coverage",
          "result_status",
          "match_status",
          "parcel",
          "flood_zone",
          "risk_score",
          "confidence_score",
          "data_quality_score",
          "recommended_next_steps",
          "official_source_links"
        ]
      },
      "PropertyRiskCompactResponse": {
        "type": "object",
        "properties": {
          "schema_version": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "coverage": {
            "type": "object"
          },
          "result_status": {
            "type": "string"
          },
          "match_status": {
            "type": "object"
          },
          "parcel": {
            "type": "object"
          },
          "flood": {
            "type": "object"
          },
          "taxing": {
            "type": "object"
          },
          "risk_score": {
            "type": [
              "integer",
              "null"
            ]
          },
          "risk_level": {
            "type": [
              "string",
              "null"
            ]
          },
          "confidence_score": {
            "type": "integer"
          },
          "data_quality_score": {
            "type": "integer"
          },
          "top_warnings": {
            "type": "array"
          },
          "recommended_next_steps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "source_links": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "result_status",
          "match_status",
          "parcel",
          "flood",
          "taxing",
          "risk_score",
          "risk_level",
          "top_warnings",
          "recommended_next_steps",
          "source_links"
        ]
      }
    }
  }
}