{
  "openapi": "3.1.0",
  "info": {
    "title": "SeniorCRE Public Platform API",
    "version": "2026.09.06",
    "summary": "Public, read-only description surfaces for the operator-controlled operating record.",
    "description": "SeniorCRE, LLC publishes operator-controlled operating infrastructure for senior housing & care. This specification documents the PUBLIC, read-only endpoints only. Operator data endpoints (clinical, workforce, financial, compliance) are authenticated, tenant-isolated, and not described here; they are disclosed under diligence.\n\nEvidence boundary (September 6, 2026): endpoints marked x-evidence-class BUILT respond today. No third-party integration is live in operator production. Deployment durations published elsewhere on seniorcre.com are design targets derived from the current implementation model, not observed deployment history.\n\nGovernance note: any number returned by any endpoint is a governed representation produced after Definitions, Source Authority and Reconciliation are applied, and carries lineage to the originating system. Canonical object schemas: https://seniorcre.com/data/canonical-objects.json. Lineage envelope: https://seniorcre.com/data/lineage-metadata.json.",
    "contact": {
      "name": "SeniorCRE Developer Relations",
      "url": "https://seniorcre.com/for-developers"
    },
    "license": {
      "name": "Proprietary — published for machine discovery",
      "url": "https://seniorcre.com/terms"
    }
  },
  "externalDocs": {
    "description": "Agent discovery manifest, canonical objects, lineage metadata and evidence record",
    "url": "https://seniorcre.com/.well-known/agents.json"
  },
  "servers": [
    {
      "url": "https://wfplmhgtdqwwabnjvben.supabase.co/functions/v1",
      "description": "Public read surfaces"
    }
  ],
  "tags": [
    { "name": "discovery", "description": "Machine-readable descriptions of the platform and its category position." },
    { "name": "governance", "description": "Canonical object definitions, source authority and lineage metadata." },
    { "name": "market", "description": "Public aggregated market and listing surfaces." }
  ],
  "paths": {
    "/platform-api": {
      "get": {
        "tags": ["discovery"],
        "operationId": "getPlatformDescription",
        "summary": "Platform description surfaces",
        "description": "Returns a machine-readable description of the platform. Selected with the `endpoint` query parameter.",
        "x-evidence-class": "BUILT",
        "parameters": [
          {
            "name": "endpoint",
            "in": "query",
            "required": false,
            "description": "Which description surface to return.",
            "schema": {
              "type": "string",
              "default": "overview",
              "enum": [
                "overview",
                "capabilities",
                "data-domains",
                "stats",
                "integrations",
                "openapi",
                "benchmarks"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Description JSON for the requested surface.",
            "content": {
              "application/json": {
                "schema": { "type": "object", "additionalProperties": true }
              }
            }
          },
          "400": {
            "description": "Unknown endpoint. Response lists available endpoints.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/public-listings-api": {
      "get": {
        "tags": ["market"],
        "operationId": "getPublicListings",
        "summary": "Public senior housing & care listings",
        "description": "Returns publicly listed senior housing & care properties. Marketplace data only. Contains no resident, clinical or PHI content.",
        "x-evidence-class": "BUILT",
        "responses": {
          "200": {
            "description": "Public listing collection.",
            "content": {
              "application/json": {
                "schema": { "type": "object", "additionalProperties": true }
              }
            }
          }
        }
      }
    },
    "/market-intelligence-api": {
      "get": {
        "tags": ["market"],
        "operationId": "getMarketIntelligence",
        "summary": "Public aggregated market intelligence",
        "description": "Returns aggregated submarket and sector reference data. Aggregated and public-source derived; not operator-identified.",
        "x-evidence-class": "BUILT",
        "responses": {
          "200": {
            "description": "Aggregated market intelligence JSON.",
            "content": {
              "application/json": {
                "schema": { "type": "object", "additionalProperties": true }
              }
            }
          }
        }
      }
    },
    "/mcp-server": {
      "post": {
        "tags": ["discovery"],
        "operationId": "callMcpServer",
        "summary": "Model Context Protocol endpoint",
        "description": "Streamable-HTTP MCP endpoint exposing public discovery and listing tools to MCP-compatible agents. Tool inventory and authentication scope: https://seniorcre.com/.well-known/mcp.json",
        "x-evidence-class": "BUILT",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "JSON-RPC 2.0 request as defined by the Model Context Protocol.",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 result.",
            "content": {
              "application/json": {
                "schema": { "type": "object", "additionalProperties": true }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Operator-scoped bearer token. Required for every non-public surface. Row-level security is enforced on every table; PHI is excluded from AI payloads."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": { "type": "string" },
          "available_endpoints": {
            "type": "array",
            "items": { "type": "string" }
          }
        },
        "required": ["error"]
      },
      "GovernedValue": {
        "type": "object",
        "description": "The shape every governed number takes. A value is not publishable without its definition, source authority and lineage.",
        "properties": {
          "value": { "description": "The governed value the enterprise acts on." },
          "definition_id": {
            "type": "string",
            "description": "Identifier of the operator-approved definition that produced this value."
          },
          "source_authority": {
            "type": "string",
            "description": "The system designated authoritative for this fact by the operator."
          },
          "reconciliation_state": {
            "type": "string",
            "enum": ["agreed", "reconciled", "in_dispute", "unreconciled"],
            "description": "Whether contributing systems agreed, were reconciled under operator-approved rules, or remain in disagreement."
          },
          "lineage": {
            "type": "array",
            "description": "Ordered lineage records back to the originating systems.",
            "items": { "type": "object", "additionalProperties": true }
          },
          "as_of": { "type": "string", "format": "date-time" },
          "approved_by": {
            "type": "string",
            "description": "The operator role that approved this value as authoritative."
          }
        },
        "required": ["value", "definition_id", "source_authority", "reconciliation_state", "as_of"]
      }
    }
  },
  "security": [{ "bearerAuth": [] }]
}
