Borrowing
Repay Loan
Repay loan debt, interest first then principal
POST
Repays part or all of a loan’s outstanding debt. Accrued interest is settled before principal. Anyone can repay any loan, so a third party can rescue a position approaching liquidation.
Two transactions are required: an approval on the borrow asset, then the repayment. Both come back as ordered steps.
Path Parameters
string
required
Market ID.
Body Parameters
integer
required
On-chain loan ID. Must be a positive integer sent as a JSON number.
string
required
Amount to repay as a decimal string in borrow asset units. The contract caps repayment at the total debt, so overpaying does not transfer more than owed.
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
Repaying the full debt does not release collateral on its own. Follow with Close Loan to unlock the pledged tokens and mark the position repaid.
