> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trusset.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Withdraw Collateral

> Remove excess collateral while keeping the loan healthy

Withdraws collateral from a loan. Reverts if the withdrawal would push the health factor below 1.0.

## Path Parameters

<ParamField path="marketId" type="string" required>Market ID.</ParamField>

## Body Parameters

<ParamField body="loanId" type="integer" required>On-chain loan ID.</ParamField>
<ParamField body="amount" type="string" required>Stock tokens to withdraw.</ParamField>
<ParamField body="signedPrice" type="object">Optional EIP-712 signed price.</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.trusset.org/lending-stocks/api/positions/{marketId}/withdraw-collateral" \
    -H "X-API-Key: trusset_your_key_here" \
    -H "Content-Type: application/json" \
    -d '{"loanId": 5, "amount": "10"}'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": { "txHash": "0xabc...def", "loanId": 5, "amount": "10" }
  }
  ```
</ResponseExample>
