Overview
Portal integrates with Yield.xyz Borrow so your users can supply collateral, borrow, repay and withdraw on leading lending protocols (Aave V3, Morpho Blue, SparkLend and Lista) with their Portal wallets. Portal proxies the Borrow API server-side using the API key you store in the Portal Dashboard, so the key never ships in your app.Borrowing uses the same Yield.xyz API key and the same Portal integration as Yield.xyz. If you have already enabled Yield.xyz in the Portal Dashboard, the Borrow endpoints below work right away; there is no separate card or key to add.
How lending and borrowing works
A lending market is a pool: suppliers deposit an asset and earn its supply APY; borrowers draw that asset out and pay the borrow APY. To borrow, a user first supplies collateral and can then borrow up to the market’smaxLtv of that collateral’s USD value (for example 75% for USDC on Aave V3 Base: supply $100, borrow up to $75). Same-asset positions are allowed: supply USDC, borrow USDC.
There is no term and no repayment schedule. Debt accrues interest continuously, and the position stays open until the user repays (repay, or repayAll: true to clear it) and withdraws. The only enforcement is liquidation: each position has a healthFactor (collateral value × liquidationThreshold ÷ debt). While it stays above 1 nothing happens; if accruing interest or a drop in the collateral’s price pushes it below 1, anyone can repay part of the debt and take the equivalent collateral plus a bonus (liquidationPenalty, typically 5-7.5%). Liquidations are partial, so the user keeps the remaining collateral. With stablecoin collateral this takes years of interest; with volatile collateral it can happen within hours of a price move.
Every
POST /actions response includes metadata.predictedHealthFactor and metadata.predictedLtv. Show them before the user signs, and treat a predicted health factor near 1 as a hard stop in your UI.Why offer it
- Liquidity without selling. Users who hold ETH, BTC or a yield-bearing token can borrow stablecoins against it to spend or invest without a taxable sale and without giving up upside, the on-chain equivalent of a margin loan or a securities-backed line of credit.
- Keeps balances in your product. Without it, a user who wants leverage or liquidity withdraws to a DeFi front-end. With it, collateral and debt live in the wallet you already manage, and you can add your own spread or origination fee (markets expose
originationFeeBps/feeWrapperAddress). - Same integration as earning. Yield.xyz’s lending markets are the other side of the yield opportunities you may already offer; it is one API key, one dashboard toggle and one set of Portal endpoints.
Steps to enable borrowing
1. Enable lending markets in Yield.xyz
- Create or access your Yield.xyz account here.
- In the Yield.xyz dashboard, enable the lending markets you want to offer (for example Aave V3 on Base). Only enabled markets are returned by
GET /marketsby default; passscope=allto browse every market Yield.xyz supports. - Generate an API key per Portal environment if you have not already (
DevelopmentandProduction). The same key is used for Yield.xyz’s Yield and Borrow APIs.
2. Enable the Yield.xyz integration in Portal
- Open the Portal Dashboard.
- Navigate to the
Integrationspage and findYield.xyzunderYield. It is one integration that covers both yield and lending & borrowing. - Add it and paste your Yield.xyz API key for the selected Portal environment, then save.
Yield.xyz Borrow integrations (Aave V3, Morpho Blue, SparkLend, Lista) are live on mainnets only; there are no Sepolia or other EVM testnet markets. Test with small amounts on an inexpensive chain such as Base.
Endpoints
All endpoints live underhttps://api.portalhq.io/api/v3/clients/me/integrations/yield-xyz-borrow and accept a Client API Key or Client Session Token as a bearer token.
Every success response is wrapped as
{ "data": ... }.
Typical flow
GET /integrationsandGET /markets?integrationId=aave-borrow&network=eip155:8453to discover what your user can do.POST /actionswith the wallet address, the action and itsargs(always includesmarketId, copied exactly asGET /marketsreturned it; Aavesupply/withdrawalso needtokenAddress). The response contains one or moretransactionswith asignablePayload.- Sign each transaction with the Portal SDK or Enclave MPC API, then
POST /transactions/{transactionId}/submitwith thesignedPayload(or thetransactionHashif you broadcast it yourself). - If the action has
hasNextStep: true, wait for confirmation and callPOST /actions/{id}/stepfor the next transaction(s). GET /positionsto show balances, health factor and available borrow.
Chain identifiers
Portal uses CAIP-2 chain ids everywhere. Passnetwork as CAIP-2 (for example eip155:1, eip155:8453, eip155:42161) and Portal translates it to the Yield.xyz network name; network values in responses are translated back to CAIP-2. Requests for a chain Portal does not support are rejected with a 400 before they reach Yield.xyz.
Vendor discovery responses (for example an integration’s networks list) can include chains Portal does not support; those keep the Yield.xyz network name so you can still recognize them.
Errors
Yield.xyz Borrow errors are returned as Portal errors:400: invalid request (the message names the field), an unsupported chain id, a request Yield.xyz rejected (its message is passed through), or a Yield.xyz API key that is missing or was rejected404: unknown market, integration, action or transaction id429: Yield.xyz rate limit hit; back off and retry503: Yield.xyz is unreachable or failed upstream500withid: INTEGRATION_RESPONSE_SCHEMA_DRIFT: Yield.xyz changed a response shape and Portal did not forward it. Treat it as a temporary outage of that feature; see Error codes
Guides
- Lend and borrow with Yield.xyz using the Enclave MPC API
API reference
Yield.xyz Borrow API Reference
Open the interactive Yield.xyz Borrow endpoints reference.