Skip to main content

Documentation Index

Fetch the complete documentation index at: https://yieldxyz.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The Borrowing API is a unified layer for interacting with on-chain lending/borrowing protocols. It provides:
  • Normalized market data — rates, liquidity, and collateral parameters across venues
  • A consistent action model — supply, borrow, repay, withdraw, collateral toggles
  • Unified account state — positions, debt, health factor, and borrow power
  • Transaction construction — unsigned payloads ready for wallet signing
  • Step-based execution — multi-transaction flows (e.g., ERC-20 approval → supply/repay)
Request and response shapes are identical across protocols and networks. Whether the underlying venue is Aave on Ethereum or Morpho on Base, your integration does not change.

What you can build

Wallets & Super Apps

Embed borrowing flows directly into wallet UX — let users leverage their assets in one tap.

Exchanges & Trading Platforms

Offer margin-like borrowing powered by DeFi lending protocols with full self-custody.

Neobanks & Fintechs

Provide crypto-collateralized credit lines backed by on-chain lending markets.

Treasury & Corporate

Optimize capital efficiency by borrowing against idle collateral across protocols.

Core capabilities

  • Discoverability & capability introspection — List supported integrations (protocol + product type), see which networks each supports, and inspect available actions with argument schemas.
  • Market discovery (normalized MarketDto) — Browse markets across protocols and chains with a consistent shape. Compare rates, liquidity, and utilization using stable fields across venues.
  • Portfolio & risk state (positions) — Read supplied collateral, borrowed debt, and aggregated portfolio metrics: healthFactor, currentLtv, availableToBorrowUsd, liquidation thresholds, net APY, and accrued interest.
  • Transaction building (intent → signable payloads) — Convert an intent like “borrow 2.5 WETH from market X” into one or more unsigned on-chain transactions (approvals + protocol calls) ready for client-side signing.
  • Execution orchestration (step-based actions) — Actions that require multiple transactions follow a consistent state machine: create action → sign/submit → poll → step → repeat → success/failure.

Supported protocols

FieldValue
Integration IDaave-borrow
NameAave V3 Borrow
Market typePool — shared liquidity across assets; collateral types and debts live under the same pool context
NetworksEthereum, Optimism, Arbitrum, Polygon, Avalanche, Base, BNB Chain, Gnosis, Sonic, Linea, Plasma

Market types: Pool vs Isolated

  • Pool markets (Aave): shared liquidity across assets inside a pool; collateral types and debts live under the same pool context.
  • Isolated markets (Morpho Blue): each collateral–loan pair is a standalone market with isolated risk and liquidity.

Integration at a glance

1

Discover markets

Use GET /v1/markets to browse and filter available lending/borrowing markets across protocols and chains.
2

Fetch current account state (optional)

Use GET /v1/positions to show balances, risk metrics, and available actions for a user’s portfolio.
3

Create an action

Use POST /v1/actions with { integrationId, action, address, args } to get unsigned transaction(s).
4

Sign & submit transactions

For each returned TransactionDto, sign it with your wallet/custody infrastructure, then POST /v1/transactions/:transactionId/submit.
5

Advance multi-step actions

Poll GET /v1/actions/:id until WAITING_FOR_NEXT, then call POST /v1/actions/:id/step for the next transaction(s). Repeat until hasNextStep=false and status=SUCCESS.
6

Refresh positions

Confirm final state via GET /v1/positions.

Integration options

Option A — Drop-in Widget (React)

The Yield.xyz Borrowing Widget is a drop-in lending/borrowing frontend module built with React. It handles market discovery, live rates, portfolio state, action construction, and transaction signing — all out of the box.Best for: wallets, exchanges, and fintech apps that want a turnkey UI.

Option B — Direct API Integration

Integrate natively while keeping full UI control. Build your own market browser and position UI, use the API for normalized data and transaction construction, and use your own signing/broadcast pipeline.Best for: custom UX or product-specific abstractions.

Key concepts (risk & rates)

Health factor

healthFactor = (totalCollateral × liquidationThreshold) / totalBorrowedValue
ValueMeaning
> 1Safe
= 1At liquidation threshold
< 1Eligible for liquidation
The API returns healthFactor on positions and predictedHealthFactor in action metadata (preview before signing).

LTV and liquidation threshold

  • Max LTV — how much can be borrowed against collateral.
  • Liquidation threshold — the point where liquidation can occur (typically higher than max LTV, providing a buffer).
  • Liquidation penalty — bonus paid to liquidators from collateral during liquidation.

Rates

  • Supply APY accrues on supplied assets.
  • Borrow APR accrues on borrowed assets.
  • Rates are typically utilization-driven — higher utilization → higher borrow rates and supply yields.

API reference

Integrations

List integrations

GET /v1/integrations Returns all available lending/borrowing integrations with supported actions and argument schemas.
{
  "id": "aave-borrow",
  "providerId": "aave",
  "name": "Aave V3 Borrow",
  "networks": ["ethereum", "arbitrum", "optimism", "polygon", "avalanche", "base", "bsc", "gnosis", "sonic", "linea", "plasma"],
  "metadata": {
    "description": "Aave is a decentralized non-custodial liquidity protocol where users can participate as suppliers or borrowers.",
    "externalLink": "https://aave.com",
    "logoURI": "https://assets.stakek.it/providers/aave.svg"
  },
  "actions": [
    {
      "id": "supply",
      "label": "Supply",
      "schema": {
        "type": "object",
        "properties": {
          "marketId": { "type": "string" },
          "amount": { "type": "string" },
          "amountRaw": { "type": "string" }
        },
        "required": ["marketId"]
      }
    }
  ]
}

Get integration by ID

GET /v1/integrations/:integrationId Returns a single integration by ID.

Markets

List markets (paginated)

GET /v1/markets
ParameterTypeRequiredDescription
integrationIdstringNoFilter by integration
networkstringNoFilter by network
offsetnumberNoPagination offset (default 0)
limitnumberNoPage size (default 25, max 100)
{
  "items": [
    {
      "id": "aave-v3-ethereum-usdc",
      "integrationId": "aave-borrow",
      "network": "ethereum",
      "type": "pool",
      "poolAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2",
      "loanToken": {
        "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "symbol": "USDC",
        "name": "USD Coin",
        "decimals": 6,
        "logoURI": "https://assets.stakek.it/tokens/usdc.svg"
      },
      "collateralTokens": [
        {
          "token": {
            "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
            "symbol": "WETH",
            "name": "Wrapped Ether",
            "decimals": 18,
            "logoURI": "https://assets.stakek.it/tokens/weth.svg"
          },
          "priceUsd": "2750.00",
          "ltv": "0.80",
          "liquidationThreshold": "0.85",
          "liquidationPenalty": "0.05",
          "supplyRate": "0.0312"
        }
      ],
      "borrowRate": "0.0487",
      "totalSupply": "1250000000.00",
      "totalSupplyRaw": "1250000000000000",
      "totalBorrow": "890000000.00",
      "totalBorrowRaw": "890000000000000",
      "availableLiquidity": "360000000.00",
      "availableLiquidityRaw": "360000000000000",
      "utilizationRate": "0.712",
      "loanTokenPriceUsd": "1.00",
      "isBorrowEnabled": true
    }
  ],
  "total": 142,
  "offset": 0,
  "limit": 25
}

Get market by ID

GET /v1/markets/:marketId Returns a single market by ID.

Positions

Get user positions

GET /v1/positions Returns the user’s full supply + borrow state for a given integration + network.
ParameterTypeRequiredDescription
integrationIdstringYesIntegration identifier
networkstringYesNetwork identifier
addressstringYesUser wallet address
{
  "address": "0x1234...",
  "integrationId": "aave-borrow",
  "network": "ethereum",
  "totalSuppliedUsd": "10000.00",
  "totalBorrowedUsd": "8750.00",
  "netWorthUsd": "1250.00",
  "healthFactor": "1.37",
  "currentLtv": "0.72",
  "availableToBorrowUsd": "1250.00",
  "netApy": "0.0089",
  "supplyBalances": [
    {
      "marketId": "aave-v3-ethereum-usdc",
      "tokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "tokenSymbol": "USDC",
      "balance": "10000.000000",
      "balanceRaw": "10000000000",
      "balanceUsd": "10000.00",
      "apy": "0.0312",
      "isCollateral": true,
      "pendingActions": [
        {
          "type": "withdraw",
          "label": "Withdraw USDC",
          "args": { "marketId": "aave-v3-ethereum-usdc" }
        }
      ]
    }
  ],
  "debtBalances": [
    {
      "marketId": "aave-v3-ethereum-weth",
      "tokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
      "tokenSymbol": "WETH",
      "balance": "2.500000000000000000",
      "balanceRaw": "2500000000000000000",
      "balanceUsd": "8750.00",
      "apy": "0.0523",
      "pendingActions": [
        {
          "type": "repay",
          "label": "Repay WETH",
          "args": { "marketId": "aave-v3-ethereum-weth" }
        }
      ]
    }
  ]
}

Actions

Create an action

POST /v1/actions Creates a lending/borrowing action and returns unsigned transaction(s) for signing. Request body — ActionRequestDto
FieldTypeRequiredDescription
integrationIdstringYesIntegration identifier
actionstringYesAction type (see Action types)
addressstringYesUser wallet address
argsobjectYesAction arguments
Action args (common)
FieldTypeRequiredNotes
marketIdstringYesTarget market identifier
amountstringNo*Human amount (e.g. "1.5")
amountRawstringNo*Base units (e.g. "1500000")
tokenAddressstringNoUsed when market needs explicit token selection
collateralTokenAddressstringNoFor markets where collateral must be specified
collateralAmountstringNoHuman collateral amount
collateralAmountRawstringNoBase units collateral amount
Provide either amount or amountRaw, not both.
{
  "integrationId": "aave-borrow",
  "address": "0x1234...",
  "action": "supply",
  "args": {
    "marketId": "aave-v3-ethereum-usdc",
    "amount": "10000"
  }
}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "integrationId": "aave-borrow",
  "action": "supply",
  "address": "0x1234...",
  "status": "CREATED",
  "currentStep": 1,
  "totalSteps": 2,
  "hasNextStep": true,
  "transactions": [
    {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "network": "ethereum",
      "chainId": "1",
      "type": "APPROVAL",
      "status": "CREATED",
      "address": "0x1234...",
      "signingFormat": "EVM_TRANSACTION",
      "signablePayload": "0x..."
    }
  ],
  "metadata": {
    "currentHealthFactor": "1.82",
    "predictedHealthFactor": "1.37",
    "currentLtv": "0.55",
    "predictedLtv": "0.72",
    "liquidationThreshold": "0.85",
    "predictedTotalSupplyUsd": "20000.00",
    "predictedTotalDebtUsd": "8750.00"
  },
  "createdAt": "2026-02-23T12:00:00.000Z"
}

Get action

GET /v1/actions/:id Returns the current state of an action (use for polling).

List actions (paginated)

GET /v1/actions
ParameterTypeRequiredDescription
addressstringNoFilter by wallet
integrationIdstringNoFilter by integration
actionstringNoFilter by action type
statusstringNoFilter by action status
offsetnumberNoDefault 0
limitnumberNoDefault 25, max 100

Advance to next step

POST /v1/actions/:id/step For multi-step actions, call after the current step confirms. Returns the next transaction(s) to sign.

Transactions

Submit a signed transaction

POST /v1/transactions/:transactionId/submit Submit either a signedPayload (API broadcasts) or a transactionHash (client already broadcast). Request body — SubmitTransactionDto
FieldTypeDescription
signedPayloadstringSigned transaction payload (max 1 MB)
transactionHashstring0x + 64 hex chars
{
  "transactionHash": "0xabc123...",
  "link": "https://etherscan.io/tx/0xabc123...",
  "status": "BROADCASTED"
}

Reference tables

Action types

ActionDescription
supplyDeposit assets into a lending pool as collateral / to earn interest
borrowBorrow assets against supplied collateral
repayRepay borrowed debt (partial or full)
withdrawWithdraw supplied assets
enableCollateralEnable a supplied asset as collateral
disableCollateralDisable a supplied asset as collateral

Transaction types

TypeDescription
APPROVALERC-20 approval (before supply/repay)
SUPPLYDeposit into the protocol
BORROWBorrow from the protocol
REPAYRepay debt
WITHDRAWWithdraw supplied assets
ENABLE_COLLATERALEnable collateral usage
DISABLE_COLLATERALDisable collateral usage

Transaction statuses

StatusMeaning
CREATEDReady for signing
BLOCKEDWaiting on prior transaction
WAITING_FOR_SIGNATURESent to signer
SIGNEDSigned by user
BROADCASTEDBroadcast submitted
PENDINGAwaiting confirmations
CONFIRMEDConfirmed on-chain
FAILEDFailed on-chain
SKIPPEDNot needed (e.g., allowance already sufficient)

End-to-end examples

Supply → Borrow (step-based)

1) GET  /v1/markets?integrationId=aave-borrow&network=ethereum

2) POST /v1/actions
   { integrationId:"aave-borrow", action:"supply", address:"0x...",
     args:{ marketId:"...", amount:"10000" } }

3) Sign tx(s) in ActionDto.transactions

4) POST /v1/transactions/{transactionId}/submit
   { signedPayload:"0x..." }

5) Poll GET /v1/actions/{actionId} until status=WAITING_FOR_NEXT

6) POST /v1/actions/{actionId}/step
   → next tx(s) (e.g., SUPPLY)

7) Sign + submit, then poll until status=SUCCESS

8) POST /v1/actions
   { integrationId:"aave-borrow", action:"borrow", address:"0x...",
     args:{ marketId:"...", amount:"2.5" } }

9) Sign + submit borrow tx, poll until SUCCESS

10) GET /v1/positions?integrationId=aave-borrow&network=ethereum&address=0x...

Repay → Withdraw

1) POST /v1/actions (repay)
   → may return APPROVAL + REPAY as multi-step

2) For each step:
   - sign + submit tx(s)
   - poll until WAITING_FOR_NEXT
   - POST /v1/actions/{actionId}/step

3) POST /v1/actions (withdraw)
   - sign + submit
   - poll until SUCCESS

Multi-step action lifecycle

Some actions require multiple on-chain transactions (e.g., ERC-20 approval before supply/repay):
  1. POST /v1/actions → returns step 1 transaction(s)
  2. Submit step 1 → poll action
  3. When action is WAITING_FOR_NEXTPOST /v1/actions/:id/step
  4. Repeat until hasNextStep=false and status=SUCCESS

Where to go next

Quickstart

Make your first borrowing request

StakeKit

Explore staking infrastructure

DeFiKit

Explore DeFi yield infrastructure

Contact Us

Get in touch for integration support