Skip to main content
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

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

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.

Get integration by ID

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

Markets

List markets (paginated)

GET /v1/markets

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.

Actions

Create an action

POST /v1/actions Creates a lending/borrowing action and returns unsigned transaction(s) for signing. Request body — ActionRequestDto Action args (common)
Provide either amount or amountRaw, not both.

Get action

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

List actions (paginated)

GET /v1/actions

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

Reference tables

Action types

Transaction types

Transaction statuses


End-to-end examples

Supply → Borrow (step-based)

Repay → Withdraw

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