Lending API
Endpoints for lending, borrowing, and managing DeFi lending positions.
EVM: aave, compound, euler, morpho, venus (multi-chain). Solana: kamino (chain ID 999). For Solana, pass protocol: "kamino", chainId: 999, SPL mint addresses, and a base58 wallet address. Solana lending endpoints return a base64-encoded transaction to sign.
Supply & Withdraw
Supply Assets
POST /lending/supply
Deposit assets into a lending protocol to earn interest.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Chain ID (use 999 for Solana) |
protocol | string | Yes | Lending protocol (aave, compound, euler, morpho, venus, kamino) |
tokenAddress | string | Yes | Token to supply (EVM address or SPL mint) |
amount | string | Yes | Amount to supply |
walletAddress | string | Yes | User wallet address (EVM or Solana) |
Withdraw Assets
POST /lending/withdraw
Withdraw supplied assets from a lending protocol.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Chain ID |
protocol | string | Yes | Lending protocol |
tokenAddress | string | Yes | Token to withdraw |
amount | string | Yes | Amount to withdraw |
walletAddress | string | Yes | User wallet address |
Borrowing
Borrow Assets
POST /lending/borrow
Borrow assets against supplied collateral.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Chain ID |
protocol | string | Yes | Lending protocol |
tokenAddress | string | Yes | Token to borrow |
amount | string | Yes | Amount to borrow |
walletAddress | string | Yes | User wallet address |
Repay Loan
POST /lending/repay
Repay borrowed assets.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Chain ID |
protocol | string | Yes | Lending protocol |
tokenAddress | string | Yes | Token to repay |
amount | string | Yes | Amount to repay |
walletAddress | string | Yes | User wallet address |
Position Management
Get User Positions
GET /lending/getUserPositions
Retrieve all lending positions for a user.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
walletAddress | string | Yes | User wallet address |
chainId | number | Yes | Chain ID |
protocol | string | No | Filter by protocol |
Response:
{
"positions": [
{
"protocol": "aave",
"tokenAddress": "0x...",
"symbol": "USDC",
"balance": "1000.00",
"assetsUsd": "1000.00",
"APY": "4.52",
"isCollateral": true,
"collateralFactor": "0.80"
}
]
}
Get Reserve List
GET /lending/getReserveList
Retrieve available lending reserves and their current rates.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Chain ID |
protocol | string | Yes | Lending protocol |
Set Collateral
POST /lending/setReserveAsCollateral
Enable or disable an asset as collateral.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Chain ID |
protocol | string | Yes | Lending protocol |
tokenAddress | string | Yes | Token address |
useAsCollateral | boolean | Yes | Enable/disable collateral |
Get Borrowable Assets
GET /lending/getBorrowableAssets
Get a list of assets available for borrowing.
Get Max Borrow Amount
GET /lending/getMaxBorrowAmount
Calculate the maximum amount a user can borrow based on their collateral.
Refresh User Positions
GET /lending/refreshUserPositions
Force a refresh and sync of user lending positions from on-chain data.
Get Market List
GET /lending/getMarketList
Retrieve available lending markets for a protocol/chain with supply and borrow rates (supports pagination).
Get Lending List Bundle
GET /lending/getLendingListBundle
Fetch reserves, user positions, borrowable assets, and borrowed assets in a single call. (Long-running; allow up to ~60s.)
Get Borrowed Assets List
GET /lending/getBorrowedAssetsList
Retrieve the user's current borrowed positions.
Sync Reserves
POST /lending/syncReserves
Sync all reserves for a user.
Protocol-Specific Endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /lending/morpho/marketList | Morpho market list |
| GET | /lending/morpho/checkLtv | Check loan-to-value for a Morpho market |
| GET | /lending/morpho/isAuthorised | Check Morpho authorization status |
| POST | /lending/morpho/setAuthorisation | Set Morpho authorization |
| GET | /lending/euler/checkLtv | Check loan-to-value for an Euler vault |
| GET | /lending/getCollateralTokens | Collateral tokens (Compound V3) |
| GET | /lending/exitMarket | Exit a market (Venus) |
| GET | /lending/getAggregatedLendingData | Aggregated lending data across protocols for a token |