{
  "openapi": "3.1.0",
  "info": {
    "title": "Arc Systems · Arc Credit Read API",
    "version": "1.0.0",
    "description": "Read-only API for Arc Systems market and account state on Arc."
  },
  "servers": [
    {
      "url": "/api",
      "description": "Same-origin API"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Service and Arc chain health",
        "responses": {
          "200": {
            "description": "Healthy"
          },
          "502": {
            "description": "Upstream RPC error"
          }
        }
      }
    },
    "/v1/meta": {
      "get": {
        "summary": "API and deployment metadata",
        "responses": {
          "200": {
            "description": "Metadata"
          }
        }
      }
    },
    "/v1/assets": {
      "get": {
        "summary": "Canonical Arc Systems assets",
        "responses": {
          "200": {
            "description": "Asset list"
          }
        }
      }
    },
    "/v1/market": {
      "get": {
        "summary": "Aggregate Arc Systems market state",
        "responses": {
          "200": {
            "description": "Market state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Market"
                }
              }
            }
          },
          "502": {
            "description": "Upstream RPC error"
          },
          "503": {
            "description": "Pool not configured"
          }
        }
      }
    },
    "/v1/account/{address}": {
      "get": {
        "summary": "Arc Systems account position",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Account state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "400": {
            "description": "Invalid address"
          },
          "502": {
            "description": "Upstream RPC error"
          },
          "503": {
            "description": "Pool not configured"
          }
        }
      }
    },
    "/v1/status": {
      "get": {
        "summary": "Price feed freshness and governance status",
        "responses": {
          "200": {
            "description": "Status"
          },
          "502": {
            "description": "RPC unavailable"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Market": {
        "type": "object",
        "properties": {
          "chainId": {
            "type": "integer",
            "const": 5042002
          },
          "pool": {
            "type": "string"
          },
          "paused": {
            "type": "boolean"
          },
          "liquidationsPaused": {
            "type": "boolean"
          },
          "totalAssetsUsdc": {
            "type": "string"
          },
          "totalBorrowsUsdc": {
            "type": "string"
          },
          "availableLiquidityUsdc": {
            "type": "string"
          },
          "utilization": {
            "type": "string",
            "description": "Decimal ratio, e.g. 0.72 = 72%"
          },
          "borrowApr": {
            "type": "string",
            "description": "Decimal APR"
          },
          "supplyApr": {
            "type": "string",
            "description": "Decimal APR"
          },
          "borrowCapUsdc": {
            "type": "string"
          },
          "protocolReservesUsdc": {
            "type": "string"
          },
          "cumulativeBadDebtWrittenOffUsdc": {
            "type": "string"
          },
          "cumulativeReservesUsedForBadDebtUsdc": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          }
        }
      },
      "Account": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "supplyUsdc": {
            "type": "string"
          },
          "debtUsdc": {
            "type": "string"
          },
          "healthFactor": {
            "type": "string",
            "description": "Decimal value or infinity"
          },
          "maxBorrowUsd": {
            "type": "string"
          },
          "collateral": {
            "type": "object",
            "properties": {
              "tWETH": {
                "type": "string"
              }
            }
          },
          "requestId": {
            "type": "string"
          }
        }
      }
    }
  }
}