{
  "openapi": "3.1.0",
  "info": {
    "title": "Traverse Research API",
    "version": "1.0.0",
    "description": "Finalized Jupiter Lend liquidation research for Solana vaults 13 and 58."
  },
  "servers": [
    {
      "url": "https://api.traverseengine.com"
    }
  ],
  "paths": {
    "/v1/reports/jupiter-lend": {
      "get": {
        "operationId": "buyJupiterLendReport",
        "summary": "Purchase the latest liquidation report for 0.01 USDC",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "description": "Base64 x402 v2 signed payment. Omit to request a challenge.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Settled report purchase",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Report"
                },
                "example": {
                  "schemaVersion": 1,
                  "protocol": "jupiter-lend",
                  "commitment": "finalized",
                  "start": 1794495740,
                  "end": 1794506540,
                  "status": "complete",
                  "coverageBasis": "provider_address_index",
                  "vaults": {
                    "13": {
                      "indexedReferences": 35,
                      "failedAttempts": 19,
                      "failedNetworkFeesLamports": "758496"
                    },
                    "58": {
                      "indexedReferences": 59,
                      "failedAttempts": 52,
                      "failedNetworkFeesLamports": "1811940"
                    }
                  }
                }
              }
            },
            "headers": {
              "PAYMENT-RESPONSE": {
                "description": "Base64-encoded x402 v2 JSON",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "402": {
            "description": "Payment required or rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "PAYMENT-REQUIRED": {
                "description": "Base64-encoded x402 v2 JSON",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Report or payment service unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/jupiter-lend/status": {
      "get": {
        "operationId": "getJupiterLendReportStatus",
        "summary": "Check report freshness and price for free",
        "description": "The window uses Unix seconds, with an inclusive start and exclusive end.",
        "responses": {
          "200": {
            "description": "Latest report availability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          },
          "400": {
            "description": "Unexpected query parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Report": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "integer"
          },
          "protocol": {
            "type": "string"
          },
          "commitment": {
            "type": "string"
          },
          "start": {
            "type": "integer"
          },
          "end": {
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "coverageBasis": {
            "type": "string"
          },
          "vaults": {
            "type": "object",
            "additionalProperties": {
              "type": "object"
            }
          }
        },
        "required": [
          "schemaVersion",
          "protocol",
          "commitment",
          "start",
          "end",
          "status",
          "coverageBasis",
          "vaults"
        ]
      },
      "Status": {
        "type": "object",
        "properties": {
          "protocol": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["fresh", "stale", "unavailable"]
          },
          "window": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "start": {
                    "type": "integer"
                  },
                  "end": {
                    "type": "integer"
                  }
                },
                "required": ["start", "end"]
              },
              {
                "type": "null"
              }
            ]
          },
          "ageSeconds": {
            "type": ["integer", "null"]
          },
          "maximumAgeSeconds": {
            "type": "integer"
          },
          "vaultIds": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "price": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "networks": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": ["amount", "currency", "networks"]
          },
          "reportUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "protocol",
          "status",
          "window",
          "ageSeconds",
          "maximumAgeSeconds",
          "vaultIds",
          "price",
          "reportUrl"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": ["error"]
      }
    }
  }
}
