{
  "openapi": "3.1.0",
  "info": {
    "title": "Key Real Estate Capital API",
    "version": "1.0.0",
    "description": "Public, unauthenticated, read-only API for Key Real Estate Capital. Every response contains only information already published on keyrealestatecapital.com. No customer, borrower, application, or internal data is exposed. Only GET is supported.",
    "contact": {
      "name": "Key Real Estate Capital",
      "url": "https://keyrealestatecapital.com/contact",
      "email": "lindsay@keyrealestatecapital.com"
    },
    "license": {
      "name": "Public website content - all rights reserved",
      "url": "https://keyrealestatecapital.com/terms-of-service"
    }
  },
  "servers": [{ "url": "https://keyrealestatecapital.com", "description": "Production" }],
  "externalDocs": {
    "description": "Human-readable API documentation",
    "url": "https://keyrealestatecapital.com/docs/api"
  },
  "paths": {
    "/api/": {
      "get": {
        "operationId": "getApiRoot",
        "summary": "API root",
        "description": "Service metadata and links to documentation and the OpenAPI description.",
        "tags": ["service"],
        "responses": {
          "200": {
            "description": "Service metadata",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ApiRoot" }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Health check",
        "description": "Returns ok when the API is being served. No infrastructure details are exposed.",
        "tags": ["service"],
        "responses": {
          "200": {
            "description": "Service is available",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Health" },
                "example": { "status": "ok" }
              }
            }
          }
        }
      }
    },
    "/api/loan-programs": {
      "get": {
        "operationId": "listLoanPrograms",
        "summary": "List public loan programs",
        "description": "The loan programs published on the Key Real Estate Capital website.",
        "tags": ["loan-programs"],
        "responses": {
          "200": {
            "description": "Publicly published loan programs",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/LoanProgramList" }
              }
            }
          }
        }
      }
    },
    "/api/openapi.json": {
      "get": {
        "operationId": "getOpenApiDocument",
        "summary": "OpenAPI description of this API",
        "tags": ["service"],
        "responses": {
          "200": {
            "description": "This OpenAPI document",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ApiRoot": {
        "type": "object",
        "required": ["name", "version", "description", "documentation", "openapi"],
        "properties": {
          "name": { "type": "string" },
          "version": { "type": "string" },
          "description": { "type": "string" },
          "documentation": { "type": "string", "format": "uri" },
          "openapi": { "type": "string", "format": "uri" },
          "authentication": { "type": "string", "enum": ["none"] },
          "methods": { "type": "array", "items": { "type": "string" } },
          "endpoints": {
            "type": "object",
            "additionalProperties": { "type": "string", "format": "uri" }
          }
        }
      },
      "Health": {
        "type": "object",
        "required": ["status"],
        "properties": { "status": { "type": "string", "enum": ["ok"] } }
      },
      "LoanProgramList": {
        "type": "object",
        "required": ["count", "loanPrograms"],
        "properties": {
          "count": { "type": "integer" },
          "source": { "type": "string", "format": "uri" },
          "disclaimer": { "type": "string" },
          "loanPrograms": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/LoanProgram" }
          },
          "additionalPrograms": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/AdditionalProgram" }
          }
        }
      },
      "LoanProgram": {
        "type": "object",
        "required": ["id", "name", "description", "url"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "loanAmountRange": { "type": "string" },
          "term": { "type": "string" },
          "startingRate": { "type": "string" },
          "features": { "type": "array", "items": { "type": "string" } },
          "url": { "type": "string", "format": "uri" }
        }
      },
      "AdditionalProgram": {
        "type": "object",
        "required": ["id", "name", "description"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "url": { "type": "string", "format": "uri" }
        }
      }
    }
  },
  "tags": [
    { "name": "service", "description": "Service metadata and health" },
    { "name": "loan-programs", "description": "Publicly published loan programs" }
  ]
}
