> For the complete documentation index, see [llms.txt](https://docs.aqua.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aqua.network/developers/code-examples/withdraw-liquidity.md).

# Withdraw liquidity

Burn pool share tokens and receive the underlying tokens back. The SDK reads your share balance, derives per-token minimums from a simulation of your exact withdrawal, and returns the amounts you received.

This page continues from the client setup in [Deposit liquidity](/developers/code-examples/deposit-liquidity.md). For the raw router signature — `withdraw(user, tokens, pool_index, share_amount, min_amounts)` — see [Aquarius Soroban Functions](https://github.com/AquariusDeFi/gitbook-docs/tree/master/developers/aquarius-soroban-functions.md).

### 1. Read your share balance

{% tabs %}
{% tab title="Python" %}

```python
pool = next(p for p in aqua.pools_for_pair(XLM, AQUA) if p.type == "volatile" and p.fee_bps == 30)

shares = pool.share_balance()   # the signer's shares; pass an address to check another account
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const pool = (await aqua.pools.forPair(XLM, AQUA)).find(p => p.type === "volatile" && p.feeBps === 30);

const shares = await pool.shareBalance();   // the signer's shares; pass an address to check another account
```

{% endtab %}
{% endtabs %}

To find every pool where an account holds shares, use `positions()` — see [Get pools info](/developers/code-examples/get-pools-info.md#positions).

### 2. Withdraw

Pass the share amount to burn — all of it, or any part:

{% tabs %}
{% tab title="Python" %}

```python
result = pool.withdraw(shares, slippage=0.01)

print(f"received: {result.amounts}")    # base units returned, in sorted-token order
print(f"transaction: {result.tx_hash}")
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const result = await pool.withdraw({ shares, slippage: 0.01 });

console.log(`received: ${result.amounts}`);    // base units returned, in sorted-token order
console.log(`transaction: ${result.txHash}`);
```

{% endtab %}
{% endtabs %}

The `slippage` guard mirrors the deposit's: the SDK simulates the exact withdrawal, takes the estimated per-token amounts, and submits with minimums reduced by `slippage` (default 1%). Withdrawing does not claim accrued rewards — that is a separate call, and the rewards keep waiting for you either way: [Claim LP rewards](/developers/code-examples/claim-lp-rewards.md).

{% hint style="info" %}
The receiving account must hold a trustline for every classic asset the pool returns. Withdrawing a position you deposited from the same account always satisfies this; a missing trustline fails with a `NoTrustlineError` naming the fix.
{% endhint %}
