{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/philidor-io/json-schema/philidor-io-stats-response-schema.json",
  "title": "StatsResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/philidor-io-stats-api-openapi.yml#/components/schemas/StatsResponse",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "totalVaults": {
          "type": "number"
        },
        "totalTvl": {
          "type": "number",
          "description": "Sum of indexed position values. Exposures can overlap across positions and protocols; this is not unique capital."
        },
        "avgApr": {
          "type": [
            "number",
            "null"
          ]
        },
        "activeLoansUsd": {
          "type": "number",
          "description": "Active loan size in USD: SUM(utilization × tvl_usd) over investable vaults — the real metric behind headline TVL (TVL actually lent out). Only money-market vaults reporting utilization contribute; MetaMorpho uses pro-rata market attribution (double-count-free across vaults sharing a market). 0 until adapters populate utilization."
        },
        "weightedUtilization": {
          "type": [
            "number",
            "null"
          ],
          "description": "TVL-weighted mean utilization across vaults that report it (denominator excludes NULL-utilization vaults so non-money-market TVL does not dilute it). Null when no vault reports utilization."
        },
        "curatorCount": {
          "type": "number"
        },
        "protocolCount": {
          "type": "number"
        },
        "chainCount": {
          "type": "number"
        },
        "riskDistribution": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "risk_tier": {
                "type": "string",
                "enum": [
                  "Prime",
                  "Core",
                  "Edge"
                ],
                "description": "Published tier (hysteresis-stabilized). May briefly differ from a naive derivation from risk_score while a boundary move is dwelling."
              },
              "count": {
                "type": "number"
              },
              "tvl": {
                "type": "number"
              }
            },
            "required": [
              "risk_tier",
              "count",
              "tvl"
            ]
          }
        },
        "tvlByProtocol": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "tvl_semantics": {
                "type": "string",
                "enum": [
                  "overlapping_position_value"
                ],
                "description": "Gross value of indexed PT and LP positions. PT supply includes tokens held in LP reserves, so these values overlap and are not unique capital."
              },
              "name": {
                "type": "string"
              },
              "logo_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vault_count": {
                "type": "number"
              },
              "tvl": {
                "type": "number"
              }
            },
            "required": [
              "id",
              "name",
              "logo_url",
              "vault_count",
              "tvl"
            ]
          }
        },
        "tvlByChain": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "number"
              },
              "name": {
                "type": "string"
              },
              "logo_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vault_count": {
                "type": "number"
              },
              "tvl": {
                "type": "number"
              }
            },
            "required": [
              "id",
              "name",
              "logo_url",
              "vault_count",
              "tvl"
            ]
          }
        },
        "lastSync": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "totalVaults",
        "totalTvl",
        "avgApr",
        "activeLoansUsd",
        "weightedUtilization",
        "curatorCount",
        "protocolCount",
        "chainCount",
        "riskDistribution",
        "tvlByProtocol",
        "tvlByChain",
        "lastSync"
      ]
    }
  },
  "required": [
    "data"
  ]
}