Skip to main content

Max debt swap range (with body)

POST 

/v1/data/loop/range/debt-swap

Compute the maximum amount for a debt swap.

The max swappable amount equals the user's total debt (variable + stable) in the source (input) asset.

Use denomination=exactInput (default) to base the range on the source debt, or exactOutput to base it on the target debt.

Requires positions[] in the POST body (or account for GET) to read the user's debt balances.

POST accepts a JSON body with the user's current portfolio state, avoiding an on-chain fetch.

Plain-text reference — POST /v1/data/loop/range/debt-swap

Parameters

ParameterInTypeRequiredDescription
marketUidInquerystringnoMarket identifier for the input (debt/short) side.
marketUidOutquerystringnoMarket identifier for the output (collateral/long) side.
accountquerystringnoWallet address. Required for GET (on-chain balance fetch).
accountIdquerystringnoSub-account ID (e.g. Euler V2, Init Capital).
denominationqueryexactInput, exactOutputnoWhich side is the base denomination for the range.

Request body

FieldTypeRequiredDescription
balanceDataobjectyesAggregated balance data for a sub-account.
balanceData.depositsnumbernoTotal deposits in USD
balanceData.debtnumbernoTotal debt in USD
balanceData.adjustedDebtnumbernoDebt adjusted for borrow factors
balanceData.collateralnumbernoCollateral value in USD
balanceData.collateralAllActivenumbernoCollateral if all assets were enabled
balanceData.borrowDiscountedCollateralnumbernoCollateral discounted by borrow factors
balanceData.borrowDiscountedCollateralAllActivenumbernoDiscounted collateral if all enabled
balanceData.navnumbernoNet asset value (deposits - debt)
balanceData.deposits24hnumbernoDeposits 24h ago (for change calculation)
balanceData.debt24hnumbernoDebt 24h ago
balanceData.nav24hnumbernoNAV 24h ago
balanceData.rewardsobject[]noPending reward token claims. Each entry represents a single reward program.
balanceData.rewards[].assetstringnoReward token contract address
balanceData.rewards[].totalRewardsnumbernoTotal accumulated rewards (token units)
balanceData.rewards[].claimableRewardsnumbernoImmediately claimable rewards (token units)
aprDataobjectyesAPR breakdown for a sub-account.
aprData.aprnumbernoNet APR (deposit - borrow)
aprData.depositAprnumbernoWeighted deposit APR
aprData.borrowAprnumbernoWeighted borrow APR
aprData.rewardAprnumbernoTotal reward APR
aprData.rewardDepositAprnumbernoReward APR on deposits
aprData.rewardBorrowAprnumbernoReward APR on borrows
aprData.intrinsicAprnumbernoIntrinsic yield APR (e.g., stETH staking)
aprData.intrinsicDepositAprnumbernoIntrinsic yield APR portion from deposits
aprData.intrinsicBorrowAprnumbernoIntrinsic yield APR portion from borrows
aprData.rewardsobjectnoPer-reward-token APR breakdown. Keys are reward token addresses.
modeIdstringnoMode/config key from userConfig.selectedMode (defaults to "0")
positionsobject[]noCurrent lending positions from the matching sub-account's positions array. The full LendingPosition objects returned by user-positions are accepted — only the fields in SimulationPosition are used. Always include this for accurate health-factor and borrow-capacity projections.
positions[].marketUidstringyesUnique market identifier (format: {lender}:{chainId}:{address})
positions[].depositsUSDnumberyesDeposit amount in USD
positions[].debtUSDnumberyesVariable debt in USD
positions[].debtStableUSDnumberyesStable debt in USD
positions[].collateralEnabledbooleanyesWhether this asset is enabled as collateral

Response 200

FieldTypeDescription
successTrue
dataobject[]Array of range results.
data[].chainIdstringEVM chain id, as a decimal string. See the ChainId schema.
data[].lenderstringProtocol identifier. See the LenderId schema.
data[].marketLongUidstringMarket UID of the collateral side
data[].marketShortUidstringMarket UID of the debt side
data[].marketNameLongstringDisplay name of the collateral market/vault (e.g. the Euler eVault name). Disambiguates rows that share the collateral/debt token symbols and lender.
data[].marketNameShortstringDisplay name of the debt market/vault. For Euler this is the controller (debt) eVault — the primary way to tell otherwise-identical WETH→USDC rows apart.
data[].curatorNameLongstringCurator/brand of the collateral market (Euler: resolved from the vault governor). Null for lenders without a curator, or until the curator registry is seeded. Render as "curatorName + symbol", falling back to marketNameLong.
data[].curatorNameShortstringCurator/brand of the debt (controller) market. Same semantics as curatorNameLong.
data[].assetLongstringCollateral asset address
data[].assetShortstringDebt asset address
data[].assetGroupLongstring
data[].assetGroupShortstring
data[].symbolLongstringCollateral token symbol
data[].nameLongstringCollateral token name
data[].symbolShortstringDebt token symbol
data[].nameShortstringDebt token name
data[].collateralFactorLongnumberLiquidation collateral factor for the long side
data[].borrowCollateralFactorLongnumberBorrow-adjusted collateral factor for the long side
data[].borrowFactorLongnumberBorrow factor for the long side
data[].collateralDisabledLongbooleanWhether collateral is disabled for the long asset
data[].debtDisabledLongbooleanWhether debt is disabled for the long asset
data[].collateralFactorShortnumberLiquidation collateral factor for the short side
data[].borrowCollateralFactorShortnumberBorrow-adjusted collateral factor for the short side
data[].borrowFactorShortnumberBorrow factor for the short side
data[].collateralDisabledShortbooleanWhether collateral is disabled for the short asset
data[].debtDisabledShortbooleanWhether debt is disabled for the short asset
data[].eModeConfigIdstringE-mode configuration ID
data[].eModestringE-mode category
data[].aprBasenumberBase APR (deposit - borrow + intrinsic, before rewards)
data[].aprTotalnumberTotal APR (base + rewards)
data[].maxLeveragenumberHighest leverage multiple reachable in this market.
data[].ltvnumberLoan-to-value ratio (0-1)
data[].depositRateLongnumber
data[].variableBorrowRateShortnumber
data[].intrinsicYieldLongnumber
data[].intrinsicYieldShortnumber
data[].variableBorrowDisabledShortbooleanTrue when the debt (short) market is a Lista DAO brokered market — it cannot be looped at a variable rate, only at one of the fixed terms in termsShort. variableBorrowRateShort is 0/undefined for such pairs.
data[].termsShortobject[]Fixed-term rate card for the debt (short) side when it is a Lista DAO brokered market. Each entry is one loop option — see the per-term net-APR recipe. null/empty for regular variable-rate pairs. For Term Finance an empty card means "not borrowable right now" rather than "no offers" — read fixedTerm.auction for why.

Example response

{
"success": true,
"data": [
{
"chainId": "1",
"lender": "AAVE_V3",
"marketLongUid": "string",
"marketShortUid": "string",
"marketNameLong": "string",
"marketNameShort": "string",
"curatorNameLong": "string",
"curatorNameShort": "string",
"assetLong": "string",
"assetShort": "string",
"assetGroupLong": "string",
"assetGroupShort": "string",
"symbolLong": "string",
"nameLong": "string",
"symbolShort": "string",
"nameShort": "string",
"collateralFactorLong": 0.94,
"borrowCollateralFactorLong": 0.92,
"borrowFactorLong": 1,
"collateralDisabledLong": true,
"debtDisabledLong": true,
"collateralFactorShort": 0.94,
"borrowCollateralFactorShort": 0.92,
"borrowFactorShort": 1,
"collateralDisabledShort": true,
"debtDisabledShort": true,
"eModeConfigId": "string",
"eMode": "string",
"aprBase": 1.0,
"aprTotal": 1.0,
"maxLeverage": 1.0,
"ltv": 1.0,
"depositRateLong": 1.0,
"variableBorrowRateShort": 1.0,
"intrinsicYieldLong": 1.0,
"intrinsicYieldShort": 1.0,
"variableBorrowDisabledShort": true,
"termsShort": [
{
"termId": 2,
"depositApr": 1.0,
"available": 1.0,
"durationDays": 7,
"durationSecs": 604800,
"apr": 3.85,
"aprAtAmount": 1.0,
"fillable": 1.0,
"capped": true,
"ladder": [
{
"apr": 1.0,
"units": "string",
"assets": 1.0
}
]
}
],
"fixedTerm": {
"model": "term",
"maturity": 1,
"fees": {},
"earlyRepay": {},
"provider": {},
"auction": {
"status": "open",
"canBorrow": true,
"canLend": true,
"secondsUntilClose": 263000,
"implications": [
"string"
],
"id": "string",
"startTime": 1,
"revealTime": 1,
"endTime": 1,
"minBorrowAmount": "1000000000",
"minLendAmount": "1000000000"
}
},
"rewardAprLong": 1.0,
"rewardAprShort": 1.0,
"rewardsLong": [
{}
],
"rewardsShort": [
{}
],
"totalDepositsLong": 1.0,
"totalDebtLong": 1.0,
"totalLiquidityLong": 1.0,
"totalDepositsShort": 1.0,
"totalDebtShort": 1.0,
"totalLiquidityShort": 1.0,
"totalDepositsUsdLong": 1.0,
"totalDebtUsdLong": 1.0,
"totalLiquidityUsdLong": 1.0,
"totalDepositsUsdShort": 1.0,
"totalDebtUsdShort": 1.0,
"totalLiquidityUsdShort": 1.0,
"borrowLiquidityShort": 1.0,
"withdrawLiquidityLong": 1.0,
"depositableLong": 1.0,
"utilizationLong": 1.0,
"utilizationShort": 1.0,
"underlyingInfoLong": {
"asset": {},
"prices": {},
"oraclePrice": {}
},
"underlyingInfoShort": {
"asset": {},
"prices": {},
"oraclePrice": {}
}
}
]
}

Request

Responses

Max debt swap range