# Mints and burns

## What is this endpoint for?

This endpoint includes event data related to the addition (mint) and removal (burn) of tokens from a liquidity pool.&#x20;

Read our DEX liquidity event data methodology [here](https://25446524.fs1.hubspotusercontent-eu1.net/hubfs/25446524/Case%20Studies%20%2B%20Data%20Gudies/DEX%20Methodology.pdf).

### Endpoint

{% code overflow="wrap" %}

```http
https://eu.market-api.kaiko.io/v2/data/liquidity.v1/events
```

{% endcode %}

### Parameters

<table><thead><tr><th>Parameter</th><th width="98">Required</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><code>blockchain</code></td><td>No</td><td>Should be one of the currently supported blockchains.<br><br>See <a data-mention href="/pages/a2ImeIv5a9wmXExkWX8W">/pages/a2ImeIv5a9wmXExkWX8W</a></td><td><code>ethereum</code></td></tr><tr><td><code>protocol</code></td><td>No</td><td>Filter on a currently supported DEX.</td><td><code>usp2</code></td></tr><tr><td><code>pool_address</code></td><td>No</td><td>Pool address related to the liquidity event. <br><br>Default: all liquidity pools.</td><td><code>0x14de8287adc90f0f95bf567c0707670de52e3813</code></td></tr><tr><td><code>pool_contains</code></td><td>No</td><td>Mints and burns including the requested token. <br><br>Default: all available tokens.</td><td><code>weth</code> or <code>weth,usdt,usdc</code></td></tr><tr><td><code>block_number</code></td><td>No</td><td>Block height.</td><td><code>129876</code></td></tr><tr><td><code>user_addresses</code></td><td>No</td><td>Filter on specific user addresses (comma separated).</td><td><code>0x479bc**</code></td></tr><tr><td><code>live</code></td><td>No</td><td>Shows the data as soon as the block is validated. <br><br>(Default: <code>false</code>, in case of block reorganization).</td><td><code>true</code></td></tr><tr><td><code>tx_hash</code></td><td>No</td><td>Filter on a specific transaction hash.</td><td><code>0xe68b84740**</code></td></tr><tr><td><code>start_block</code></td><td>No</td><td>Starting block height (inclusive).</td><td><code>129870</code></td></tr><tr><td><code>end_block</code></td><td>No</td><td>Ending block height (inclusive).</td><td><code>130000</code></td></tr><tr><td><code>start_time</code></td><td>No</td><td>Starting time in ISO 8601 (inclusive).</td><td><code>2022-04-01T00:00:00.000Z</code></td></tr><tr><td><code>end_time</code></td><td>No</td><td>Ending time in ISO 8601 (inclusive).</td><td><code>2022-05-01T00:00:00.000Z</code></td></tr><tr><td><code>sort</code></td><td>No</td><td>Returns the data in ascending <code>asc</code> or descending <code>desc</code> order. <br><br>Default: <code>desc</code>.</td><td><code>asc</code></td></tr><tr><td><code>type</code></td><td>No</td><td>Event type. By default both burn and mint are shown.</td><td><code>burn</code> or <code>mint</code></td></tr><tr><td><code>page_size</code></td><td>No</td><td>Number of snapshots to return data for. (default: 1000, min: 1, max: 1000). <br><br>See <a data-mention href="/pages/mP3amLsYqKTsrRBoblxX">/pages/mP3amLsYqKTsrRBoblxX</a></td><td><code>500</code></td></tr></tbody></table>

### Fields

<table><thead><tr><th width="219">Field</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><code>blockchain</code></td><td>The blockchain on which the transaction happened.</td><td><code>ethereum</code></td></tr><tr><td><code>block_number</code></td><td>The height of the block in which the transaction happened.</td><td><code>129876</code></td></tr><tr><td><code>type</code></td><td>Event type: mint or burn.</td><td><code>burn</code> or <code>mint</code></td></tr><tr><td><code>pool_name</code></td><td>Name of the pool as it is written on the blockchain.</td><td><code>USDC-WETH-0.001</code></td></tr><tr><td><code>pool_address</code></td><td>Address of the contract of the pool.</td><td><code>0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640</code></td></tr><tr><td><code>exchange</code></td><td>Code of the DEX.</td><td><code>usp3</code></td></tr><tr><td><code>transaction_hash</code></td><td>Transaction hash</td><td><code>0x3d28ec9f35692ee6e9264735cd4f92c48bccda82487144d26ebc12376a418cdc</code></td></tr><tr><td><code>log_index</code></td><td>The log index of the transaction (in base 10)</td><td><code>152</code></td></tr><tr><td><code>user_address</code></td><td>Address that triggered the transaction.</td><td><code>0x479bc00624e58398f4cf59d78884d12fb515790a</code></td></tr><tr><td><code>price</code></td><td>Price of the token at the moment of the event.</td><td><code>0.000358096</code></td></tr><tr><td><code>amounts</code></td><td>Amounts of the tokens</td><td>See example</td></tr><tr><td><code>datetime</code></td><td>Timestamp at which the interval begins. In seconds.</td><td><code>1650441900</code></td></tr><tr><td><code>metadata</code></td><td>Only for Uniswap v3. Upper and lower ticker of the interval on which the liquidity is provided</td><td><code>{"lower_ticker": 190650, "upper_ticker": 195610}</code></td></tr></tbody></table>

### Request example

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```url
curl --compressed -H "Accept: application/json" -H "X-Api-Key: <client-api-key>" \
  "https://eu.market-api.kaiko.io/v2/data/liquidity.v1/events"
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
##### 1. Import dependencies #####
import requests
import pandas as pd

##### 2. Choose the value of the query's parameters #####
# ---- Required parameters ---- #
blockchain = "ethereum" 
protocol = "usp2"
pool_address = None
pool_contains = "weth"
block_number = None
user_addresses = None
live = "false"
tx_hash = None
start_block = None
end_block = None
start_time = "2025-03-05T13:00:00Z"
end_time = None
sort = "asc"
type = "burn"
page_size = 500

# ---- API key configuration ---- #
api_key = "YOUR_API_KEY"

##### 3. Get the data #####
# ---- Function to run an API call ---- # 
# Get the data in a dataframe --------- # 

def get_kaiko_data(api_key: str, blockchain: str, protocol: str, pool_address: str, pool_contains: str, block_number: int, user_addresses: str, live: str, tx_hash: str, start_block: int, end_block: int, start_time: str, end_time: str, sort: str, type: str, page_size: int):
    headers = {'Accept': 'application/json', 'X-Api-Key': api_key}
    
    url = f'https://eu.market-api.kaiko.io/v2/data/liquidity.v1/events'
    params = {
        "blockchain": blockchain,
        "protocol": protocol,
        "pool_address": pool_address,
        "pool_contains": pool_contains,
        "block_number": block_number,
        "user_addresses": user_addresses,
        "live": live,
        "tx_hash": tx_hash,
        "start_block": start_block,
        "end_block": end_block,
        "start_time": start_time,
        "end_time": end_time,
        "sort": sort,
        "type": type,
        "page_size": page_size
    }

    try:
        res = requests.get(url, headers=headers, params=params)
        res.raise_for_status() 
        data = res.json()
        if 'data' not in data:
            print("No data returned.")
            return pd.DataFrame() 
        df = pd.DataFrame(data['data'])

        # Handle pagination with continuation token
        while 'next_url' in data:
            next_url = data['next_url']
            if next_url is None:
                break
            res = requests.get(next_url, headers=headers)
            res.raise_for_status()
            data = res.json()
            if 'data' in data:
                df = pd.concat([df, pd.DataFrame(data['data'])], ignore_index=True)
        return df

    except requests.exceptions.RequestException as e:
        print(f"API request error: {e}")
        return pd.DataFrame() 

# ---- Get the data ---- #
df = get_kaiko_data(api_key=api_key, blockchain=blockchain, protocol=protocol, pool_address=pool_address, pool_contains=pool_contains, block_number=block_number, user_addresses=user_addresses, live=live, tx_hash=tx_hash, start_block=start_block, end_block=end_block, start_time=start_time, end_time=end_time, sort=sort, type=type, page_size=page_size)
print (df)
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Response example

```json
{
  "query": {
    "blockchain": "*",
    "exchange": "*",
    "pool_address": "0x7bea39867e4169dbe237d55c8242a8f2fcdcc387",
    "block_number": "*",
    "type": "*",
    "user_addresses": "*",
    "tx_hash": "*",
    "start_time": "2022-04-01 00:00:00 +0000 UTC",
    "end_time": "2022-05-01 00:00:00 +0000 UTC",
    "sort": "descending",
    "pool_contains": "*",
    "page_size": "1000"
  },
  "time": "2022-05-17T14:26:27.274Z",
  "timestamp": 1652797587,
  "data": [
    {
      "blockchain": "ethereum",
      "block_number": 14682526,
      "type": "mint",
      "pool_name": "USDC-WETH-0.010",
      "pool_address": "0x7bea39867e4169dbe237d55c8242a8f2fcdcc387",
      "exchange": "usp3",
      "transaction_hash": "0x02127cbf00c43fff6a1ec381703e66035b975e49f901ade55f1b12652e07b544",
      "log_index": 187,
      "user_address": "0x3cbd83d4a4ee504bf8b78d9c2927a9f22f27cce5",
      "price": 0.0003564194488230487,
      "amounts": [
        {"symbol": "USDC", "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "amount": 31.063585},
        {"symbol": "WETH", "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "amount": 0.5833806413127403}
      ],
      "datetime": 1651280001,
      "metadata": {"lower_ticker": 192600, "upper_ticker": 197000}
    }
    /* ... */
  ],
  "continuation_token": "xxx",
  "next_url": "https://eu.market-api.kaiko.io/v2/data/liquidity.v1/events?continuation_token=xxx"
}
```


---

# Agent Instructions: 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.kaiko.com/rest-api/data-feeds/level-1-and-level-2-data/level-2-tick-level/mints-and-burns.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.
