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.
At least two transactions are required: an approval on the borrow asset, then the repayment. They come back as ordered steps.
Path Parameters
string
required
Market ID.
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
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. Required unless
all is true or you are confirming with txHash.boolean
Repay the loan in full. The API reads the current debt and sizes the approval with a small overshoot, so interest accruing between the quote and the mine cannot leave dust behind. Use this instead of computing a payoff yourself.
object
EIP-712 signed price from Sign Price, carried on-chain by the repayment. A repayment is the most frequent transaction a market sees, so carrying a price here keeps the oracle fresh without a separate write. Omit it and the repayment stays on the entry point that no price can block, which is the path a borrower must always have.
object
An EIP-2612 permit over the settlement asset, which collapses approve-then-repay into one signed transaction. Offered only where the settlement asset provably implements EIP-2612.
permitSupported on the standard response says whether this market’s asset does.The spender in the signature must be the market address.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.
Transaction Shape
A partial repayment returns two steps:approve on the borrow asset, then repay.
A full repayment (all: true) returns three. The third resets the allowance to zero. repay caps the pull at the true debt, so without it the unused approval would stay live against the payer’s funds after the loan closed.
With a permit, the approval disappears. A partial repayment is one step, repayWithPermit. A full repayment is two: repayWithPermit, then the same allowance reset, because the permit installs the overshoot as an allowance the repayment does not spend.
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.
