> ## 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.

# Remove Liquidity

> Burn LP shares and withdraw the borrow asset

Redeems LP shares for the borrow asset at the current share price, which includes accrued interest. No approval is needed, so this is a single transaction.

<Warning>
  `shares` is always parsed at 18 decimals, regardless of the market's borrow asset. This is the one amount in the API that does not follow the borrow asset's precision. Read a provider's share balance from [Get Provider Balance](/endpoints/external-securities-lending/get-provider-balance) and pass it through unchanged.
</Warning>

## Path Parameters

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

## Body Parameters

<ParamField body="shares" type="string" required>
  LP shares to redeem as a decimal string with up to 18 decimal places, for example `"250000"`. Must be greater than zero.
</ParamField>

<ParamField body="txHash" type="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.
</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="txHash" type="string">Transaction hash. Returned when confirming with `txHash`.</ResponseField>
    <ResponseField name="sharesRedeemed" type="string">Shares burned, echoed back. Returned when confirming with `txHash`.</ResponseField>
    <ResponseField name="action" type="string">`SIGN_TRANSACTION` when `txHash` is omitted.</ResponseField>
    <ResponseField name="transaction" type="object">`{ to, data }` for the `removeLiquidity` call. Returned when `txHash` is omitted.</ResponseField>
  </Expandable>
</ResponseField>

<Note>
  Withdrawal is bounded by available liquidity, not by share balance. A provider holding shares worth more than the pool's idle balance cannot exit fully while borrowers hold the difference. The transaction reverts rather than partially filling. Check `availableLiquidity` on [Get Market Metrics](/endpoints/external-securities-lending/get-metrics) before redeeming a large position.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.trusset.org/lending-external-securities/api/positions/{marketId}/remove-liquidity" \
    -H "X-API-Key: trusset_your_key_here" \
    -H "Content-Type: application/json" \
    -d '{"shares": "50000"}'
  ```
</RequestExample>

<ResponseExample>
  ```json Calldata Response theme={null}
  {
    "success": true,
    "data": {
      "action": "SIGN_TRANSACTION",
      "transaction": { "to": "0x70A0...", "data": "0x..." },
      "functionName": "removeLiquidity"
    }
  }
  ```

  ```json Confirmed Response theme={null}
  {
    "success": true,
    "data": {
      "txHash": "0xabc...def",
      "sharesRedeemed": "50000"
    }
  }
  ```
</ResponseExample>
