v1

latestOpenAPI 3.1.02026-07-24223580832.9 KB
lendborrow

Withdraw

Process the withdrawal of your deposited assets from the lending protocol. Specify the asset, amount, and recipient address, and use customizable gas parameters to ensure that the withdrawal is executed efficiently. This endpoint allows you to retrieve funds when needed while managing your overall position.

💡 Compute Unit Value: 205 (Fixed)

post/defi/v1/lendborrow/withdraw

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

Token address of the asset to withdraw.

amountstring required

Number of tokens to be withdrawn.

tostring required

Public address of the recipient who will receive the tokens.

fromstring required

Public address of the sender initiating the transaction.

gasstring

Maximum gas to be approved for the transaction.

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.

useCustomVaultsboolean

A boolean flag to scope the API request. If true, the request will be processed using the partner's dedicated vaults. If false or omitted, it uses the standard public pools.

marketstring

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

marketIdstring

Specifies the market Id of any market in Morpho.

vaultAddressstring

Specifies the vaultAddress of any vault in Morpho.

onBehalfOfstring

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

collateralboolean

Specifies the condition for depositing the token as a supply to earn the yields only or use it as collateral to borrow loan asset.

Example request

{
  "lendborrowId": "1000",
  "asset": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
  "amount": "10000",
  "to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "gas": "100000",
  "gasPriority": "low",
  "enableFee": false,
  "useCustomVaults": false,
  "market": "USDC",
  "marketId": "0x3b3769cfca57be2eaed03fcc5299c25691b77781a1e124e7a8d520eb9a7eabb5",
  "vaultAddress": "0xa258C4606Ca8206D8aA700cE2143D7db854D168c",
  "onBehalfOf": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "collateral": false
}

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": "0x829bFB482331b9Dc2BEcb5483ecA79c0578c3A45",
    "to": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2",
    "value": "0",
    "gas": "408298",
    "estimationCheck": true,
    "data": "0x69328dec00000000000000000000000065afadd39029741b3b8f0756952c74678c9cec93000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000829bfb482331b9dc2becb5483eca79c0578c3a45",
    "referenceId": "934bca3df66d411ab6ed56ab879badd9"
  }
}