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

# Removing liquidity

To remove the liquidity from a pool, the user needs to provide LP tokens.

### Step 1: **Check the allowance of the pool contract on both tokens.**

To initiate a swap, first determine if the DEX has the necessary allowance to access the tokens. This can be done using the following API endpoint:&#x20;

**API URL**: [﻿`https://api.expand.network/fungibletoken/getuserallowance`](https://docs.expand.network/how-to/provision-liquidity/﻿https:/api.expand.network/fungibletoken/getuserallowance)

***

**Sample Request:**

```url
﻿https://api.expand.network/fungibletoken/getuserallowance?owner=0x6Fb447Ae94F5180254D436A693907a1f57696900&tokenAddress=0x6b175474e89094c44da98b954eedeac495271d0f&spender=0xBA12222222228d8Ba445958a75a0704d566BF2C8
```

***

**Sample Response:**&#x20;

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "allowance": "999000000000000000000"
    }
}
```

### Step 2: **Approve the pool contract from the tokens**

This can be done using the following API endpoint:&#x20;

**API URL**: [`https://api.expand.network/fungibletoken/approve`](https://docs.expand.network/categories/fungible-tokens/erc20#approve)

***

**Sample Request:**

```json
{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006", 
    "tokenAddress":"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",  
    "amount": "1000000000000000000000",                  
    "to": "0x828b154032950c8ff7cf8085d841723db2696056", 
    "gas": "100000",
    "chainId": "1"
}
```

***

**Sample Response:**&#x20;

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "value": "0",
        "gas": "100000",
        "data": "0x095ea7b3000000000000000000000000828b154032950c8ff7cf8085d841723db269605600000000000000000000000000000000000000000000003635c9adc5dea00000"
    }
}
```

### Step 3: Remove Liquidity

This can be done using the following API endpoint:&#x20;

**API URL**: [﻿](https://docs.expand.network/how-to/provision-liquidity/﻿https:/api.expand.network/dex/addliquidity)[﻿`https://api.expand.network/dex/removeliquidity`](https://docs.expand.network/how-to/provision-liquidity/﻿https:/api.expand.network/dex/removeliquidity)

***

**Sample Request:**

```json
{
    "dexId": "1000",
    "tokenA": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "tokenB": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    "liquidity": "20759430672661383",
    "amountAMin": "0",
    "amountBMin": "0",
    "to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "deadline": "1669720626",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "420000"
}
```

***

**Sample Response:**&#x20;

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
        "value": "0",
        "gas": "420000",
        "data": "0xbaa2abde000000000000000000000000b4fbf271143f4fbf7b91a5ded31805e42b2208d600000000000000000000000011fe4b6ae13d2a6055c8d9cf65c55bac32b5d8440000000000000000000000000000000000000000000000000049c0979afbbb870000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063056e00436da25bcf48a40dfbbdcc7089351006000000000000000000000000000000000000000000000000000000006385ea32"
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.expand.network/how-to/provision-liquidity/removing-liquidity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
