Skip to main content
POST
Removes collateral from a loan while leaving it open. Only the loan’s borrower can sign it. The contract reverts if the withdrawal would push the health factor below 1.0, measured at the liquidation threshold, so a loan can only shed collateral it does not need.
A CUSTODY withdrawal the collateral token refuses does not revert. The adapter escrows the balance instead, so the borrower signs a transaction that confirms and delivers nothing. When that is the case, or when the token’s verdict cannot be read, the response carries collateralRelease and warning. Surface them to the borrower before they sign.
The API applies a stricter bound than the contract. It refuses a withdrawal that would leave the debt above what the remaining collateral supports at the market’s collateral factor, the limit a new borrow faces. A withdrawal between that limit and the liquidation threshold is refused here with WOULD_BREACH_HEALTH_FACTOR, although the contract would accept it. Single transaction in both modes.

Path Parameters

string
required
The market’s record ID, as id on List Markets, not its contract address. See Market IDs.

Body Parameters

integer
required
On-chain loan ID. A positive integer. Accepted as a JSON number or as a numeric string, so the value Get Loan returns passes straight back.
string
Security tokens to release, as a positive decimal string. Parsed at the collateral token’s decimals. Required when building calldata, not needed on the confirm call. On a token whose ERC-1400 granularity() is above one base unit, it must be a whole multiple of the granularity.
object
EIP-712 signed price from Sign Price. Omit to price against the stored oracle value. A market that prices from an external feed refuses a signed price with EXTERNAL_FEED_ACTIVE, and a market with a fixed price with FIXED_PRICE_ACTIVE.
string
Hash of the transaction you broadcast for this operation. Send it to confirm the transaction and record the result. Omit it to receive the calldata.

Response Fields

object
A withdrawal that would breach that bound, exceed the posted collateral, or target an inactive loan is refused before a transaction is offered, with WOULD_BREACH_HEALTH_FACTOR, INSUFFICIENT_COLLATERAL or LOAN_NOT_ACTIVE. The price is only consulted while the loan still carries debt, so a debt-free withdrawal is never refused for a stale price.
Where the released tokens end up depends on the market mode. FREEZE markets unfreeze them in place, so the borrower’s balance does not change but the tokens become transferable again. CUSTODY markets transfer them out of the adapter back to the borrower.
While a Dutch auction is open against the loan, the contract reverts the withdrawal. The API does not check for an open auction before offering calldata.

Error Codes

Confirming with txHash can also return any transaction verification error.