{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vestiarion-xyz/json-schema/vestiarion-xyz-get-insights-response-schema.json",
  "title": "GetInsightsResponse",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vestiarion-xyz-openapi.json#/components/schemas/GetInsightsResponse",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "transfers": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "targetType": {
                "type": "string",
                "enum": [
                  "invoice",
                  "milestone"
                ]
              },
              "targetId": {
                "type": "string"
              },
              "txRef": {
                "type": "string"
              },
              "feeUsd": {
                "type": "number"
              },
              "feeSource": {
                "type": "string",
                "enum": [
                  "chain_reported",
                  "provider_estimate",
                  "simulated_profile"
                ]
              },
              "settledInMs": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "chain": {
                "type": "string"
              },
              "providerMode": {
                "type": "string",
                "enum": [
                  "live",
                  "simulate"
                ]
              },
              "executedAt": {
                "type": "string"
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "targetType",
              "targetId",
              "txRef",
              "feeUsd",
              "feeSource",
              "settledInMs",
              "chain",
              "providerMode",
              "executedAt",
              "status"
            ],
            "description": "One executed payment, with its fee and settlement time."
          }
        },
        "runs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "startedAt": {
                "type": "string"
              },
              "finishedAt": {
                "type": "string"
              },
              "durationMs": {
                "type": "number"
              },
              "decisionCount": {
                "type": "number"
              },
              "paidCount": {
                "type": "number"
              },
              "heldCount": {
                "type": "number"
              },
              "flaggedCount": {
                "type": "number"
              },
              "awaitingInfoCount": {
                "type": "number"
              },
              "releasedCount": {
                "type": "number"
              },
              "modelDecisionCount": {
                "type": "number"
              },
              "heuristicDecisionCount": {
                "type": "number"
              },
              "guardrailOverrideCount": {
                "type": "number"
              },
              "referenceDisagreementCount": {
                "description": "Model verdicts that chose a different action from the rule-based policy. Null for cycles run before the comparison existed, never zero, which would claim perfect agreement over decisions never compared.",
                "type": [
                  "number",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "running",
                  "completed",
                  "partial",
                  "failed"
                ],
                "description": "A cycle that failed partway is not a quiet cycle, and must not read as one. Its counts are real but partial: they cover the stages that ran before it stopped, and nothing after."
              },
              "failedStage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "errorMessage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "chainMode": {
                "type": "string",
                "enum": [
                  "live",
                  "simulate"
                ]
              },
              "screeningMode": {
                "type": "string",
                "enum": [
                  "live",
                  "simulate"
                ]
              }
            },
            "required": [
              "id",
              "startedAt",
              "finishedAt",
              "durationMs",
              "decisionCount",
              "paidCount",
              "heldCount",
              "flaggedCount",
              "awaitingInfoCount",
              "releasedCount",
              "modelDecisionCount",
              "heuristicDecisionCount",
              "guardrailOverrideCount",
              "referenceDisagreementCount",
              "status",
              "failedStage",
              "errorMessage",
              "chainMode",
              "screeningMode"
            ],
            "description": "One agent cycle: how long it took and what it decided."
          }
        },
        "snapshots": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "cycleRunId": {
                "type": "string"
              },
              "capturedAt": {
                "type": "string"
              },
              "totalLiquid": {
                "type": "number"
              },
              "openPayables": {
                "type": "number"
              },
              "openReceivables": {
                "type": "number"
              },
              "obligationsDue7d": {
                "type": "number"
              },
              "obligationsDue14d": {
                "type": "number"
              },
              "reservePosition": {
                "type": "number"
              },
              "chainMode": {
                "type": "string",
                "enum": [
                  "live",
                  "simulate"
                ]
              }
            },
            "required": [
              "id",
              "cycleRunId",
              "capturedAt",
              "totalLiquid",
              "openPayables",
              "openReceivables",
              "obligationsDue7d",
              "obligationsDue14d",
              "reservePosition",
              "chainMode"
            ],
            "description": "The treasury position a cycle captured."
          }
        },
        "treasuryMoves": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "action": {
                "type": "string",
                "enum": [
                  "sweep_to_usyc",
                  "redeem_from_usyc",
                  "rebalance"
                ]
              },
              "amount": {
                "type": "number"
              },
              "createdAt": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "action",
              "amount",
              "createdAt"
            ],
            "description": "One treasury move."
          }
        },
        "screenings": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "counterpartyId": {
                "type": "string"
              },
              "counterpartyName": {
                "type": "string"
              },
              "riskLevel": {
                "type": "string"
              },
              "previousRiskLevel": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tierChanged": {
                "type": "boolean"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "live",
                  "simulate"
                ]
              },
              "source": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "complete",
                  "failed"
                ]
              },
              "createdAt": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "counterpartyId",
              "counterpartyName",
              "riskLevel",
              "previousRiskLevel",
              "tierChanged",
              "mode",
              "source",
              "status",
              "createdAt"
            ],
            "description": "One compliance screening, and whether it changed the counterparty's risk tier."
          }
        }
      },
      "required": [
        "transfers",
        "runs",
        "snapshots",
        "treasuryMoves",
        "screenings"
      ],
      "description": "The telemetry behind the Insights charts: the most recent transfers, cycle runs, snapshots, treasury moves and screenings, each oldest first."
    }
  },
  "required": [
    "data"
  ]
}