Skip to main content
POST
/
lending-stocks
/
api
/
positions
/
{marketId}
/
repay
curl -X POST "https://api.trusset.org/lending-stocks/api/positions/{marketId}/repay" \
  -H "X-API-Key: trusset_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"loanId": 5, "amount": "1000", "useRelayer": true}'
{
  "success": true,
  "data": { "txHash": "0xabc...def", "loanId": 5, "repaidAmount": "1000" }
}
Repays part or all of a loan’s debt. Interest is paid first, then principal. Anyone can repay any loan. If the full debt is repaid, the loan closes automatically and collateral is returned.

Path Parameters

marketId
string
required
Market ID.

Body Parameters

loanId
integer
required
On-chain loan ID.
amount
string
required
USDC to repay (capped at total debt).
useRelayer
boolean
default:"false"
Execute via relayer or return calldata.
curl -X POST "https://api.trusset.org/lending-stocks/api/positions/{marketId}/repay" \
  -H "X-API-Key: trusset_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"loanId": 5, "amount": "1000", "useRelayer": true}'
{
  "success": true,
  "data": { "txHash": "0xabc...def", "loanId": 5, "repaidAmount": "1000" }
}