v1

latestOpenAPI 3.1.02026-07-24223580832.9 KB
lendborrow

Repay

Process the repayment of borrowed assets to the lending protocol. Whether you’re reducing your debt or fully repaying a loan, this endpoint lets you specify the asset, amount, and repayment mode. Customizable gas parameters allow you to tailor the transaction for cost efficiency and timely execution.

💡 Compute Unit Value: 255 (Fixed)

post/defi/v1/lendborrow/repay

Request body

lendborrowId'1000' | '1003' | '1005' | '1200' | '1202' | '1203' | '1204' | '1205' | '1206' | '1207' | '1100' | '1300' | '1302' | '1400' | '1401' | '1402' | '1403' | '1404'

The unique ID to specify the lending and borrowing protocol for routing relevant queries or transactions.

assetstring required

Token address of the asset to repay.

interestRateModestring required

Interest rate mode as defined by Aave. Default is 1.

onBehalfOfstring required

Public address of the user on whose behalf the repay action will be executed.

fromstring required

Sender's public address.

gasstring

Maximum gas to be approved for the transaction.

amountstring required

Number of tokens to be repaid.

gasPrioritystring

Specifies the priority level for gas fees (e.g., 'low', 'medium', or 'high'), which influences the transaction speed and cost.

enableFeeboolean

Flag to include a basis points fee transaction alongside the main transaction when set to true.

marketstring

The market of the asset, such as USDC or WETH. Defaults to USDC.

marketIdstring required

Specifies the market Id of any market in Morpho.

Example request

{
  "lendborrowId": "1000",
  "asset": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
  "interestRateMode": "1",
  "onBehalfOf": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "gas": "100000",
  "amount": "10000",
  "gasPriority": "low",
  "enableFee": false,
  "market": "USDC",
  "marketId": "0x3b3769cfca57be2eaed03fcc5299c25691b77781a1e124e7a8d520eb9a7eabb5"
}

Response

Successful response

statusnumber

Numeric status code indicating success or failure of the API call

msgstring

Human-readable message describing the API result or error

Example response

{
  "status": 200,
  "msg": "success",
  "data": {
    "chainId": "1",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "to": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2",
    "value": "0",
    "estimationCheck": true,
    "gas": "408298",
    "data": "0x573ade81000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000063056e00436da25bcf48a40dfbbdcc7089351006",
    "referenceId": "206365ea298a46c790b0ae51add101c3"
  }
}