> 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/defi-lending-and-borrowing-markets/market-data/events/lending-positions/lending-positions.md). Agents can also search and read this documentation through its [MCP server](https://docs.kaiko.com/~gitbook/mcp).

# Lending positions

{% hint style="info" %}

### This data is included in the following Kaiko packages:

* Level 1 & Level 2 Data \[Level 1 Tick-Level]
* Level 1 & Level 2 Data \[Level 2 Aggregations]
* Level 1 & Level 2 Data \[Level 2 Tick-Level]

*Subscriptions with "DeFi Lending & Borrowing" as the market type.*
{% endhint %}

## What is this endpoint for?

> Lending positions show what one wallet supplies to and borrows from a lending protocol: each supplied and borrowed asset, totals in US dollars, health factor, remaining borrowing capacity, accrued interest and rewards. Read the current position, the position at any past point, or its evolution over time, to monitor liquidation risk or rebuild a wallet's lending history.

```json
{"openapi":"3.1.1","info":{"title":"Kaiko API","version":"2026-10-01"},"tags":[{"name":"Lending","description":"Lending and borrowing protocols (Aave, Compound, Maker): the on-chain events of their markets, read from the protocols' own contracts."}],"servers":[{"url":"https://api.kaiko.io","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Your Kaiko API key. Sent on every request. Never in a query parameter.\n"}},"parameters":{"BlockchainQuery":{"name":"blockchain","in":"query","required":true,"description":"Kaiko blockchain code. An unknown chain is a 404 `unsupported_blockchain`.","schema":{"type":"string","pattern":"^[a-z0-9_]+$"}},"LendingProtocolRequiredQuery":{"name":"protocol","in":"query","required":true,"description":"Kaiko protocol code: `aav3` (Aave v3), `aav2` (Aave v2), `cmpd` (Compound v2), `cmp3` (Compound v3) or `mkr` (Maker). An unknown protocol, or one that does not run on `blockchain`, returns 404 `unknown_protocol`. `aav3` runs on `ethereum`, `polygon`, `avalanche`, `arbitrum` and `optimism`; `aav2` on `ethereum`, `polygon` and `avalanche`; `cmpd`, `cmp3` and `mkr` on `ethereum`. `/defi/lending/protocol-summaries` lists the protocols of a blockchain.","schema":{"type":"string","pattern":"^[a-z0-9]{1,16}$"}},"LendingPositionAddressesQuery":{"name":"addresses","in":"query","required":true,"description":"The account to read, `0x`-prefixed hex, matched in any letter case. One address in this version: a list parameter, so that a higher maximum later is an additive change.","style":"form","explode":false,"schema":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}}},"LendingPositionAtTimeQuery":{"name":"at_time","in":"query","required":false,"description":"Read the state as of this instant: the last state at or before the last block at or before it. ISO 8601 UTC, millisecond precision. Not with `at_block`, a window or `interval` (400). Before the key's entitled history it returns 403, as it does for a key whose history does not cover the last 90 days (a known limit).","schema":{"type":"string","format":"date-time"}},"LendingPositionAtBlockQuery":{"name":"at_block","in":"query","required":false,"description":"Read the position as of this block: the last one at or before it. Not with `at_time`, a window or `interval` (400). A block past the newest one indexed returns an empty `data`.","schema":{"type":"integer","format":"int64","minimum":1}},"StartTimeQuery":{"name":"start_time","in":"query","required":false,"description":"Inclusive start of the window, ISO 8601 UTC. The endpoint documents its precision and its default when omitted; a nanosecond endpoint accepts any precision from seconds to nanoseconds.\n","schema":{"type":"string","format":"date-time"}},"EndTimeQuery":{"name":"end_time","in":"query","required":false,"description":"Exclusive end of the window, ISO 8601 UTC, at the precision the endpoint documents. Defaults to now. Must be after `start_time`.\n","schema":{"type":"string","format":"date-time"}},"LendingPositionIntervalQuery":{"name":"interval","in":"query","required":false,"description":"Grid step of a windowed read. Omitted, a window reads every `1h`; with no window either, the read is the latest position.","schema":{"$ref":"#/components/schemas/LendingPositionInterval"}},"LendingPositionSortQuery":{"name":"sort","in":"query","required":false,"description":"Order on `timestamp`. Newest first by default.","schema":{"$ref":"#/components/schemas/Sort"}},"PageSizeQuery":{"name":"page_size","in":"query","required":false,"description":"Rows per page. A value above the maximum returns 400, never a silent cap. Endpoints needing other bounds define their own `PageSize<Resource>Query`.\n","schema":{"type":"integer","minimum":1,"maximum":1000,"default":100}},"ApiVersionQuery":{"name":"api_version","in":"query","required":false,"description":"Contract version to serve, as a date. Each endpoint serves its newest version released on or before it, so one date pins the whole API. When omitted, the endpoint's oldest version still served is used, so breaking changes only reach clients that raise their date. Append `-preview` (`2027-02-01-preview`) to also be served preview versions, which carry no stability promise. A date in the future, or one resolving to a retired version, returns 400 `unsupported_api_version`. The version served is echoed in `meta.api_version`, and `meta.url` and `meta.next_url` always carry this parameter. No `default` here on purpose: it differs per endpoint, and the request validator would otherwise fill in one date for all of them.","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(-preview)?$"}}},"schemas":{"LendingPositionInterval":{"type":"string","description":"Grid step of a positions read.","enum":["1m","5m","15m","30m","1h","4h","1d","1w"]},"Sort":{"type":"string","enum":["asc","desc"],"default":"desc","description":"Order on the time axis."},"ListLendingPositionsResponse":{"type":"object","description":"One page of `LendingPosition` rows.","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LendingPosition"}},"meta":{"$ref":"#/components/schemas/Meta"}}},"LendingPosition":{"type":"object","description":"The lending position of one account on one protocol at one point in time, with its supply and borrow legs. Unique on (`user_address`, `blockchain`, `protocol`, `block_number`). USD figures sum priced legs only. Column names are lending.v2's, decided with product on 2026-10-22: an exception to rule 11, so a concept can carry another name in a sibling dataset (the supply rate is `supply_rate` in market-snapshots, `lend_rate` in the metrics datasets and `current_liquidity_rate` in a position's supply leg). USD figures add across rows; `health_factor`, `net_apy` and `roi` do not add across protocols.","required":["user_address","blockchain","protocol","block_number","timestamp","emode_category_id","emode_category_label","health_factor","total_collateral_usd","total_supplied_usd","total_debt_usd","available_borrows_usd","net_worth_usd","net_apy","price_unavailable_assets","total_supply_accrued_interest_usd","total_borrow_accrued_interest_usd","total_principal_supplied_usd","total_principal_borrowed_usd","roi","change_in_lend_interest_usd","change_in_borrow_interest_usd","market_value_lend_interest_usd","market_value_borrow_interest_usd","cumulative_lend_interest_usd","cumulative_borrow_interest_usd","lifetime_rewards_usd","unclaimed_rewards_usd","supplies","borrows","total_liquidity_eth","total_collateral_eth","total_borrowed_eth","available_to_borrow_eth","net_worth_eth","total_lend_interest_eth","total_borrow_interest_eth","cumulative_lend_interest_eth","cumulative_borrow_interest_eth","lifetime_rewards_eth","unclaimed_rewards_eth"],"properties":{"user_address":{"type":"string","description":"Account the position is of, lowercase."},"blockchain":{"type":"string","description":"Kaiko blockchain code."},"protocol":{"type":"string","description":"Kaiko protocol code (`aav3`, `aav2`, `cmpd`, `cmp3`, `mkr`)."},"block_number":{"type":"integer","format":"int64","description":"Block the position is read at: the reference block on a latest or `at_*` read, the grid block (the last block at or before the grid time) otherwise."},"timestamp":{"type":"string","format":"date-time","description":"Time of the position: the grid time on a windowed read, the requested time on an `at_time` read, the time of `block_number` otherwise. ISO 8601 UTC, millisecond precision; always whole seconds (`.000Z`). lending.v2 sent `datetime`, unix seconds."},"emode_category_id":{"type":["integer","null"],"format":"int64","description":"Aave v3 efficiency-mode category of the account, `0` when eMode is off, as on `/defi/lending/events`. `null` on a protocol without eMode."},"emode_category_label":{"type":["string","null"],"description":"Label of `emode_category_id`. `null` when the category is `0` or `null`."},"health_factor":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Collateral at its liquidation threshold over debt; below 1 is liquidatable. 6 decimals. `null` on Maker, with no debt, with a collateral leg whose risk factors are unknown, or on Compound v3 when more than one market carries debt. Formula: Σ (collateral leg USD × its liquidation threshold) / `total_debt_usd`. On Compound v3, over the one market that carries debt: that market's collateral legs and debt only."},"total_collateral_usd":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Collateral-enabled supply, priced legs only. USD, 2 decimals."},"total_supplied_usd":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"All supply legs, priced legs only. USD, 2 decimals."},"total_debt_usd":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"All borrow legs, priced legs only. USD, 2 decimals."},"available_borrows_usd":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Borrowing headroom: collateral at LTV minus debt, floored at 0. USD, 2 decimals. Formula: Σ (collateral leg USD × its loan-to-value) − `total_debt_usd`, floored at 0. On Compound v3, computed per market with that market's collateral legs and debt, each floored at 0, then summed: collateral in one market does not back another market's debt."},"net_worth_usd":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`total_supplied_usd` − `total_debt_usd`. USD, 2 decimals."},"net_apy":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Net annual yield on net worth, as a fraction. 6 decimals. `null` when net worth is 0 or a price is missing."},"price_unavailable_assets":{"type":"array","description":"Addresses of the assets (and reward tokens) held with no price at the block, lowercase; their value is left out of every USD figure. Empty when every asset is priced.","items":{"type":"string"}},"total_supply_accrued_interest_usd":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Outstanding supply interest: balance minus principal. Can be negative. USD, 2 decimals."},"total_borrow_accrued_interest_usd":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Outstanding borrow interest. Can be negative. USD, 2 decimals."},"total_principal_supplied_usd":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Deposits minus withdrawals, priced. USD, 2 decimals."},"total_principal_borrowed_usd":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Borrows minus repayments, priced. USD, 2 decimals."},"roi":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"(supply − borrow accrued interest) / (principal supplied − principal borrowed), as a fraction. 6 decimals. `null` when the denominator is 0 or a principal is unknown."},"change_in_lend_interest_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Change of `cumulative_lend_interest_usd` since the previous grid point, which is sampled even before the window or the page. USD, 2 decimals. `null` on a latest or `at_*` read, and when that point would be before the protocol's genesis or the key's entitled history."},"change_in_borrow_interest_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Change of `cumulative_borrow_interest_usd` since the previous grid point. `null` as `change_in_lend_interest_usd`."},"market_value_lend_interest_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Equal to `total_supply_accrued_interest_usd`, kept from lending.v2."},"market_value_borrow_interest_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Equal to `total_borrow_accrued_interest_usd`, kept from lending.v2."},"cumulative_lend_interest_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Lifetime supply interest, realised and outstanding. USD, 2 decimals. `null` when a leg's principal is unknown."},"cumulative_borrow_interest_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Lifetime borrow interest. USD, 2 decimals. `null` as `cumulative_lend_interest_usd`."},"lifetime_rewards_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Incentive rewards accrued since genesis, each priced at its accrual block. USD, 2 decimals. `null` with no reward event or an unpriced reward token."},"unclaimed_rewards_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Rewards accrued and not yet claimed, priced at the block. USD, 2 decimals. `null` as `lifetime_rewards_usd`."},"supplies":{"type":"array","description":"The account's supply legs with a balance above 0, one per reserve (per market and asset on Compound v3, per urn and ilk on Maker). Empty when it supplies nothing.","items":{"$ref":"#/components/schemas/LendingSupplyPosition"}},"borrows":{"type":"array","description":"The account's borrow legs with a balance above 0. Empty when it borrows nothing.","items":{"$ref":"#/components/schemas/LendingBorrowPosition"}},"total_liquidity_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`total_supplied_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."},"total_collateral_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`total_collateral_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."},"total_borrowed_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`total_debt_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."},"available_to_borrow_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`available_borrows_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."},"net_worth_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`net_worth_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."},"total_lend_interest_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`total_supply_accrued_interest_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."},"total_borrow_interest_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`total_borrow_accrued_interest_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."},"cumulative_lend_interest_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`cumulative_lend_interest_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."},"cumulative_borrow_interest_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`cumulative_borrow_interest_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."},"lifetime_rewards_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`lifetime_rewards_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."},"unclaimed_rewards_eth":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`unclaimed_rewards_usd` in ETH: the USD figure over the protocol's own ETH (WETH) price at the block. 8 decimals. `null` when either price is missing."}}},"LendingSupplyPosition":{"type":"object","description":"One supply leg of a position.","required":["asset","asset_address","market_id","position_ref","supplied_amount","supplied_amount_usd","principal_supplied","principal_supplied_usd","accrued_interest","accrued_interest_usd","roi","atoken_address","scaled_balance","supply_apy","current_liquidity_rate","is_collateral","liquidation_threshold","ltv"],"properties":{"asset":{"type":"string","description":"Symbol of the underlying asset, lowercase."},"asset_address":{"type":"string","description":"Contract address of the underlying asset, lowercase."},"market_id":{"type":"string","description":"Market of the leg, `<protocol>/<version>/<market>` (the ilk on Maker)."},"position_ref":{"type":["string","null"],"description":"The Maker urn holding the leg. `null` outside Maker."},"supplied_amount":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Amount supplied, in units of the underlying (decimals applied)."},"supplied_amount_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`supplied_amount` in USD at the protocol's own oracle price, 2 decimals. `null` when the asset has no price."},"principal_supplied":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Amount supplied net of what came back, in units of the underlying, floored at 0."},"principal_supplied_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`principal_supplied` in USD, 2 decimals. `null` when unpriced."},"accrued_interest":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`supplied_amount` − `principal_supplied`, in units of the underlying. `null` when the principal is unknown."},"accrued_interest_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`accrued_interest` in USD, 2 decimals. `null` when unknown or unpriced."},"roi":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`accrued_interest` / `principal_supplied`, as a fraction. `null` when the principal is 0 or unknown."},"atoken_address":{"type":["string","null"],"description":"Receipt token of the leg (aToken, cToken, Compound v3 market), lowercase. `null` on Maker."},"scaled_balance":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Scaled balance in raw on-chain units (an integer): the pre-index aToken balance on Aave, the cToken quantity on Compound v2, the principal on Compound v3, the amount itself on Compound v3 collateral and Maker."},"supply_apy":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Annual supply yield compounded per second, as a fraction. 6 decimals."},"current_liquidity_rate":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Annual supply rate (APR), as a fraction. 6 decimals."},"is_collateral":{"type":"boolean","description":"Whether the leg backs the account's debt: the user toggle on Aave, market entry on Compound v2, true on Compound v3 collateral and Maker; false at a 0 balance."},"liquidation_threshold":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Liquidation threshold of the leg, as a fraction (eMode-aware on Aave). 0 on Maker."},"ltv":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Loan-to-value of the leg, as a fraction. 0 on Maker."}}},"LendingBorrowPosition":{"type":"object","description":"One borrow leg of a position.","required":["asset","asset_address","market_id","position_ref","borrowed_amount","borrowed_amount_usd","principal_borrowed","principal_borrowed_usd","accrued_interest","accrued_interest_usd","roi","variable_debt_token_address","stable_debt_token_address","borrow_type","scaled_debt_balance","variable_borrow_rate","stable_borrow_rate","borrow_apy"],"properties":{"asset":{"type":"string","description":"Symbol of the underlying asset, lowercase."},"asset_address":{"type":"string","description":"Contract address of the underlying asset, lowercase."},"market_id":{"type":"string","description":"Market of the leg, `<protocol>/<version>/<market>` (the ilk on Maker)."},"position_ref":{"type":["string","null"],"description":"The Maker urn holding the leg. `null` outside Maker."},"borrowed_amount":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Amount borrowed, in units of the underlying (decimals applied)."},"borrowed_amount_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`borrowed_amount` in USD at the protocol's own oracle price, 2 decimals. `null` when the asset has no price."},"principal_borrowed":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Amount borrowed net of what came back, in units of the underlying, floored at 0."},"principal_borrowed_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`principal_borrowed` in USD, 2 decimals. `null` when unpriced."},"accrued_interest":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`borrowed_amount` − `principal_borrowed`, in units of the underlying. `null` when the principal is unknown."},"accrued_interest_usd":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`accrued_interest` in USD, 2 decimals. `null` when unknown or unpriced."},"roi":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"`accrued_interest` / `principal_borrowed`, as a fraction. `null` when the principal is 0 or unknown."},"variable_debt_token_address":{"type":["string","null"],"description":"Variable debt token of the reserve (Aave), lowercase. `null` elsewhere."},"stable_debt_token_address":{"type":["string","null"],"description":"Stable debt token of the reserve (Aave), lowercase. `null` elsewhere."},"borrow_type":{"type":"string","description":"Interest mode of the leg: always `variable` today."},"scaled_debt_balance":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Scaled debt in raw on-chain units (an integer); on Maker normalised art × 10^18."},"variable_borrow_rate":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Annual variable borrow rate, as a fraction. 6 decimals."},"stable_borrow_rate":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Annual stable borrow rate. `null` today: every leg is variable."},"borrow_apy":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Annual borrow cost compounded per second, as a fraction. 6 decimals."}}},"Meta":{"type":"object","description":"Metadata of a collection response.","required":["api_version","url","count","next_url"],"properties":{"api_version":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(-preview)?$","description":"Version this endpoint served: its version released on or before the requested `api_version`, or its oldest version still served when the request omitted it. Suffixed `-preview` when a preview version served it."},"url":{"type":"string","format":"uri","description":"Absolute URL of the request that produced this response, as received: path and query string unchanged, defaults not filled in, except `api_version`, which is always present (the version served when the request omitted it). Lets a stored response say what it answers, in the shape it was answered."},"count":{"type":"integer","minimum":0,"description":"Number of items in `data` on this page."},"next_url":{"type":["string","null"],"format":"uri","description":"Absolute URL of the next page, `null` on the last page. It holds only public parameters: the original query with every default made explicit (`api_version` included) and the time bound moved past the last row, plus the dataset's tie-breaker (`after_<key>`) where timestamps can tie. An operation that pages on another keyset (a block position, a snapshot) says so in its description, and its `next_url` carries that keyset's parameters instead."}}},"Problem":{"type":"object","description":"RFC 9457 problem details. Served as application/problem+json.","required":["type","title","status","code"],"properties":{"type":{"type":"string","format":"uri-reference","const":"about:blank","description":"Always `about:blank`; the reason is carried by `code`."},"title":{"type":"string","description":"HTTP reason phrase."},"status":{"type":"integer","minimum":400,"maximum":599,"description":"HTTP status code, repeated for clients that lose the status line."},"detail":{"type":"string","description":"Human-readable explanation specific to this occurrence. Do not parse it."},"instance":{"type":"string","format":"uri-reference","description":"Request path and request id, to quote to support."},"code":{"type":"string","pattern":"^[a-z][a-z0-9_]*$","description":"Stable machine-readable reason. Clients branch on this. New values are additive; renaming one is breaking. Values in use: invalid_parameter, unsupported_api_version, missing_api_key, invalid_api_key, not_entitled, history_out_of_entitlement, unknown_instrument, pair_not_covered, unknown_asset, unknown_index, unsupported_blockchain, chain_capability_unsupported, token_not_found, unknown_contract, unknown_protocol, unknown_pool, query_too_large, snapshot_expired, resource_not_found, method_not_allowed, not_acceptable, rate_limited, internal_error, service_unavailable."},"errors":{"type":"array","description":"On 400, one entry per invalid parameter.","items":{"$ref":"#/components/schemas/ParameterError"}}}},"ParameterError":{"type":"object","description":"One invalid parameter in a 400 response.","required":["parameter","detail"],"properties":{"parameter":{"type":"string","description":"Name of the offending parameter."},"detail":{"type":"string","description":"What is wrong with it."}}}},"responses":{"BadRequest":{"description":"Invalid parameter, window or API version.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unauthorized":{"description":"Missing or unknown X-Api-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Forbidden":{"description":"The key is valid but not entitled to this product, instrument or history depth.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotAcceptable":{"description":"The Accept header excludes application/json.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"TooManyRequests":{"description":"Rate limited. Retry after the delay in Retry-After.","headers":{"Retry-After":{"$ref":"#/components/headers/Retry-After"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"InternalError":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"ServiceUnavailable":{"description":"A dependency is down or the data is not available yet.","headers":{"Retry-After":{"$ref":"#/components/headers/Retry-After"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","minimum":0}}}},"paths":{"/defi/lending/positions":{"get":{"operationId":"ListLendingPositions","tags":["Lending"],"summary":"What is this endpoint for?","description":"Lending positions show what one wallet supplies to and borrows from a lending protocol: each supplied and borrowed asset, totals in US dollars, health factor, remaining borrowing capacity, accrued interest and rewards. Read the current position, the position at any past point, or its evolution over time, to monitor liquidation risk or rebuild a wallet's lending history.","parameters":[{"$ref":"#/components/parameters/BlockchainQuery"},{"$ref":"#/components/parameters/LendingProtocolRequiredQuery"},{"$ref":"#/components/parameters/LendingPositionAddressesQuery"},{"$ref":"#/components/parameters/LendingPositionAtTimeQuery"},{"$ref":"#/components/parameters/LendingPositionAtBlockQuery"},{"$ref":"#/components/parameters/StartTimeQuery"},{"$ref":"#/components/parameters/EndTimeQuery"},{"$ref":"#/components/parameters/LendingPositionIntervalQuery"},{"$ref":"#/components/parameters/LendingPositionSortQuery"},{"$ref":"#/components/parameters/PageSizeQuery"},{"$ref":"#/components/parameters/ApiVersionQuery"}],"responses":{"200":{"description":"One page of `LendingPosition` rows.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListLendingPositionsResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"The `blockchain` is not a Kaiko EVM chain, or no served lending protocol runs on it (`unsupported_blockchain`), or the `protocol` is unknown or does not run on `blockchain` (`unknown_protocol`).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"406":{"$ref":"#/components/responses/NotAcceptable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kaiko.com/rest-api/defi-lending-and-borrowing-markets/market-data/events/lending-positions/lending-positions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
