> For the complete documentation index, see [llms.txt](https://docs.kaiko.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kaiko.com/rest-api/data-feeds/level-1-and-level-2-data/level-2-aggregations/lending-users-positions.md).

# Lending Users Positions

## What is this endpoint for?

This endpoint returns a user's positions on lending and borrowing protocols. For a given wallet address, it reports the assets supplied and borrowed, their principal and accrued interest (in both token and USD terms), the applicable interest rates and APYs, and position-level health metrics such as the health factor and available borrowing capacity, at each block over the requested time range.

### Endpoint

{% code overflow="wrap" %}

```http
https://eu.market-api.kaiko.io/v2/data/lending.v1/addresses/{user_address}/positions
```

{% endcode %}

### Parameters

<table><thead><tr><th>Parameter</th><th width="88" data-type="checkbox">Mandatory?</th><th width="272">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>block_number</code></td><td>false</td><td>Block height.</td><td><code>21795593</code></td></tr><tr><td><code>start_block</code></td><td>false</td><td>Starting block height (inclusive).</td><td><code>21795593</code></td></tr><tr><td><code>end_block</code></td><td>false</td><td>Ending block height (inclusive).</td><td><code>22795593</code></td></tr><tr><td><code>datetime</code></td><td>false</td><td>Time in ISO 8601 (inclusive).</td><td><code>2022-04-01T00:00:00.000Z</code></td></tr><tr><td><code>start_time</code></td><td>false</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>false</td><td>Ending time in ISO 8601 (inclusive).</td><td><code>2022-05-01T00:00:00.000Z</code></td></tr><tr><td><code>interval</code></td><td>false</td><td>Interval between each snapshot. The suffixes are s (second), m (minute), h (hour), d (day), b (block), change (whenever a change happens). Default: 1d.</td><td><code>1h</code></td></tr><tr><td><code>sort</code></td><td>false</td><td>Returns the data in ascending or descending order. Default: desc.</td><td><code>ascending</code></td></tr><tr><td><code>page_size</code></td><td>false</td><td>Number of snapshots to return data for. <br><br>(default: <code>100</code>, min: 1, max: <code>1000</code>). <br><br>See <a data-mention href="/pages/mP3amLsYqKTsrRBoblxX">/pages/mP3amLsYqKTsrRBoblxX</a></td><td><code>1000</code></td></tr></tbody></table>

### Fields

| Field                               | Description                                                                                     | Example                                      |
| ----------------------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------- |
| `user_address`                      | Address of the user's wallet.                                                                   | `0x1d296f5efbbb235c7a90734c2469fe8dc21e132d` |
| `blockchain`                        | The blockchain on which the position exists.                                                    | `ethereum`                                   |
| `block_number`                      | The height of the block at which the position was read.                                         | `25225970`                                   |
| `timestamp`                         | The timestamp of the block.                                                                     | `2026-06-02T00:00:00Z`                       |
| `protocol`                          | Code of the L\&B protocol.                                                                      | `aav3`                                       |
| `health_factor`                     | The health factor of the position. A value below 1 makes the position eligible for liquidation. | `1.839684`                                   |
| `total_collateral_usd`              | Total value of collateral in USD.                                                               | `42075.46`                                   |
| `total_supplied_usd`                | Total value supplied in USD.                                                                    | `42075.46`                                   |
| `total_debt_usd`                    | Total value of debt in USD.                                                                     | `18982.95`                                   |
| `available_borrows_usd`             | The amount still available to borrow in USD.                                                    | `14887.79`                                   |
| `net_worth_usd`                     | The net worth of the position (collateral minus debt) in USD.                                   | `23092.51`                                   |
| `net_apy`                           | The net APY across the whole position.                                                          | `-0.003917`                                  |
| `total_supply_accrued_interest_usd` | Total accrued supply interest in USD.                                                           | `6.58`                                       |
| `total_borrow_accrued_interest_usd` | Total accrued borrow interest in USD.                                                           | `6.97`                                       |
| `total_principal_supplied_usd`      | Total principal supplied (excluding interest) in USD.                                           | `42068.88`                                   |
| `total_principal_borrowed_usd`      | Total principal borrowed (excluding interest) in USD.                                           | `18975.99`                                   |
| `roi`                               | Return on investment for the whole position.                                                    | `-0.000017`                                  |
| `supplies`                          | Array of supplied assets.                                                                       | More information below                       |
| `borrows`                           | Array of borrowed assets.                                                                       | More information below                       |

#### `supplies`

| Field                    | Description                                                  | Example                                      |
| ------------------------ | ------------------------------------------------------------ | -------------------------------------------- |
| `asset`                  | Symbol of the supplied asset.                                | `weth`                                       |
| `asset_address`          | Address of the underlying supplied asset.                    | `0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2` |
| `atoken_address`         | Address of the receipt (aToken) asset.                       | `0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8` |
| `scaled_balance`         | The scaled aToken balance (raw units).                       | `19697531323085677000`                       |
| `supplied_amount`        | The amount supplied, in token units.                         | `21.0032861479522399`                        |
| `supplied_amount_usd`    | The amount supplied, in USD.                                 | `42075.46`                                   |
| `principal_supplied`     | The principal supplied (excluding interest), in token units. | `21`                                         |
| `principal_supplied_usd` | The principal supplied (excluding interest), in USD.         | `42068.88`                                   |
| `accrued_interest`       | The accrued supply interest, in token units.                 | `0.0032861479522399`                         |
| `accrued_interest_usd`   | The accrued supply interest, in USD.                         | `6.58`                                       |
| `supply_apy`             | The supply APY for this asset.                               | `0.014136`                                   |
| `current_liquidity_rate` | The current liquidity rate for this asset.                   | `0.014037`                                   |
| `is_collateral`          | Whether the supplied asset is used as collateral.            | `True`                                       |
| `liquidation_threshold`  | The liquidation threshold for this asset.                    | `0.830000`                                   |
| `ltv`                    | The maximum loan-to-value ratio for this asset.              | `0.805000`                                   |
| `roi`                    | Return on investment for this supply.                        | `0.000156`                                   |

#### `borrows`

| Field                    | Description                                                  | Example                                      |
| ------------------------ | ------------------------------------------------------------ | -------------------------------------------- |
| `asset`                  | Symbol of the borrowed asset.                                | `usdt`                                       |
| `asset_address`          | Address of the underlying borrowed asset.                    | `0xdac17f958d2ee523a2206206994597c13d831ec7` |
| `borrow_type`            | The type of borrow (`stable` or `variable`).                 | `variable`                                   |
| `scaled_debt_balance`    | The scaled debt balance (raw units).                         | `15440253275`                                |
| `borrowed_amount`        | The amount borrowed, in token units.                         | `19006.977599660540473`                      |
| `borrowed_amount_usd`    | The amount borrowed, in USD.                                 | `18982.95`                                   |
| `principal_borrowed`     | The principal borrowed (excluding interest), in token units. | `19000`                                      |
| `principal_borrowed_usd` | The principal borrowed (excluding interest), in USD.         | `18975.99`                                   |
| `accrued_interest`       | The accrued borrow interest, in token units.                 | `6.977599660540473`                          |
| `accrued_interest_usd`   | The accrued borrow interest, in USD.                         | `6.97`                                       |
| `variable_borrow_rate`   | The variable borrow rate for this asset.                     | `0.035461`                                   |
| `borrow_apy`             | The borrow APY for this asset.                               | `0.036097`                                   |

### 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/lending.v1/addresses/0x1d296f5efbbb235c7a90734c2469fe8dc21e132d/positions?start_time=2026-06-01T00:00:00.000Z&end_time=2026-06-02T00:00:00.000Z&interval=1d'
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}

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

##### 2. Choose the value of the query's parameters #####
# ---- Required parameters ---- #
user_address = "0x1d296f5efbbb235c7a90734c2469fe8dc21e132d"

# ---- Optional parameters ---- #
start_time = "2026-06-01T00:00:00.000Z"
end_time = "2026-06-02T00:00:00.000Z"
interval = "1d"
page_size = 10
sort = "asc"

# ---- 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,
    user_address: str,
    start_time: str,
    end_time: str,
    interval: str,
    sort: str,
    page_size: int,
):
    headers = {"Accept": "application/json", "X-Api-Key": api_key}

    url = f"https://eu.market-api.kaiko.io/v2/data/lending.v1/addresses/{user_address}/positions"
    params = {
        "start_time": start_time,
        "end_time": end_time,
        "interval": interval,
        "sort": sort,
        "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 data.get("next_url"):
            res = requests.get(data["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,
    user_address=user_address,
    start_time=start_time,
    end_time=end_time,
    interval=interval,
    sort=sort,
    page_size=page_size,
)
print(df)
```

{% endtab %}
{% endtabs %}

### Response example

```json
{
    "query":
    {
        "user_address": "0x1d296f5efbbb235c7a90734c2469fe8dc21e132d",
        "start_time": "2026-06-01T00:00:00.000Z",
        "end_time": "2026-06-02T00:00:00.000Z",
        "interval": "1d"
    },
    "time": "2026-07-02T14:38:15.282665557Z",
    "timestamp": 1783003095,
    "data":
    [
        {
            "user_address": "0x1d296f5efbbb235c7a90734c2469fe8dc21e132d",
            "blockchain": "ethereum",
            "block_number": "25225970",
            "timestamp": "2026-06-02T00:00:00Z",
            "protocol": "aav3",
            "health_factor": "1.839684",
            "total_collateral_usd": "42075.46",
            "total_supplied_usd": "42075.46",
            "total_debt_usd": "18982.95",
            "available_borrows_usd": "14887.79",
            "net_worth_usd": "23092.51",
            "net_apy": "-0.003917",
            "total_supply_accrued_interest_usd": "6.58",
            "total_borrow_accrued_interest_usd": "6.97",
            "total_principal_supplied_usd": "42068.88",
            "total_principal_borrowed_usd": "18975.99",
            "roi": "-0.000017",
            "supplies":
            [
                {
                    "asset": "weth",
                    "asset_address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                    "atoken_address": "0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8",
                    "scaled_balance": "19697531323085677000",
                    "supplied_amount": "21.0032861479522399",
                    "supplied_amount_usd": "42075.46",
                    "principal_supplied": "21",
                    "principal_supplied_usd": "42068.88",
                    "accrued_interest": "0.0032861479522399",
                    "accrued_interest_usd": "6.58",
                    "supply_apy": "0.014136",
                    "current_liquidity_rate": "0.014037",
                    "is_collateral": "True",
                    "liquidation_threshold": "0.830000",
                    "ltv": "0.805000",
                    "roi": "0.000156"
                }
            ],
            "borrows":
            [
                {
                    "asset": "usdt",
                    "asset_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
                    "borrow_type": "variable",
                    "scaled_debt_balance": "15440253275",
                    "borrowed_amount": "19006.977599660540473",
                    "borrowed_amount_usd": "18982.95",
                    "principal_borrowed": "19000",
                    "principal_borrowed_usd": "18975.99",
                    "accrued_interest": "6.977599660540473",
                    "accrued_interest_usd": "6.97",
                    "variable_borrow_rate": "0.035461",
                    "borrow_apy": "0.036097"
                }
            ]
        },
    ],
    "result": "success",
    "access":
    {
        "access_range":
        {
            "start_timestamp": 1073001600000,
            "end_timestamp": 1861830000000
        },
        "data_range":
        {
            "start_timestamp": "None",
            "end_timestamp": 1861830000000
        }
    }
}
```


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.kaiko.com/rest-api/data-feeds/level-1-and-level-2-data/level-2-aggregations/lending-users-positions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
