Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
New API

Events

This data is included in the following Kaiko packages:

  • Level 1 & Level 2 Data [Level 1 Tick-Level]

Subscriptions with "DeFi Lending & Borrowing" as the market type.

What is this endpoint for?

get

Lending events record every on-chain action on lending protocols such as Aave, Compound and MakerDAO: deposits, withdrawals, borrows, repayments, liquidations and flash loans, plus collateral and market configuration changes. Each deposit, withdrawal, borrow, repayment and liquidation also carries the state of the market at that block: rates, total deposited and total borrowed. Filter by protocol, wallet, asset, market or transaction.

Authorizations
X-Api-KeystringRequired

Your Kaiko API key. Sent on every request. Never in a query parameter.

Query parameters
blockchainstringRequired

Kaiko blockchain code. An unknown chain is a 404 unsupported_blockchain.

Example: {"value":"ethereum"}Pattern: ^[a-z0-9_]+$
protocolstringOptional

Kaiko protocol code: aav3 (Aave v3), aav2 (Aave v2), cmpd (Compound v2), cmp3 (Compound v3) or mkr (Maker). Omitted, every protocol of blockchain. 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.

Example: {"value":"aav3"}Pattern: ^[a-z0-9]{1,16}$
addressesstring[] · min: 1 · max: 1Optional

Keep the events of this account (user_address). One address in this version: a list parameter, so that a higher maximum later is an additive change. Matched case-insensitively, so an EIP-55 checksummed address is accepted.

Example: {"value":["0x4f3a120e72c76c22ae802d129f599bfdbc31cb81"]}
assetsstring[] · min: 1 · max: 100Optional

Keep the rows whose underlying asset is one of these, comma-separated. Each entry is a token symbol as the rows carry it (weth), or a 0x contract address, which is exact where a symbol can be ambiguous. Matched case-insensitively.

Example: {"value":["weth","0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"]}
market_idsstring[] · min: 1 · max: 100Optional

Keep the events of these markets, comma-separated, as the rows carry them (aave/v3/weth). A * matches any run of characters (aave/v3/*). MakerDAO vault types read maker/v2/{ilk} (maker/v2/eth-a), and the savings rate maker/dsr.

Example: {"value":["aave/v3/weth"]}
transaction_hashstringOptional

Keep the events of this one transaction. Combines with every other filter and window; with no start_time and no block bound it reads the key's whole entitled history.

Example: {"value":"0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"}Pattern: ^0x[0-9a-fA-F]{64}$
start_timestring · date-timeOptional

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.

Example: 2026-09-24T00:00:00.000Z
end_timestring · date-timeOptional

Exclusive end of the window, ISO 8601 UTC, at the precision the endpoint documents. Defaults to now. Must be after start_time.

Example: 2026-09-25T00:00:00.000Z
start_blockinteger · int64 · min: 1Optional

Inclusive first block. Combines with start_time and end_time: every bound sent applies.

Example: {"value":20950000}
end_blockinteger · int64 · min: 1Optional

Exclusive end block: the window stops before it. Combines with start_time and end_time: every bound sent applies.

Example: {"value":20950001}
livebooleanOptional

Include the most recent blocks, which are not yet safe from re-organisation. Rows read that way can change or disappear on a later call.

Default: falseExample: {"value":false}
sortstring · enumOptional

Order on the time axis.

Default: descExample: descPossible values:
page_sizeinteger · min: 1 · max: 1000Optional

Rows per page. A value above the maximum returns 400, never a silent cap. Endpoints needing other bounds define their own PageSize<Resource>Query.

Default: 100Example: {"value":100}
after_block_numberinteger · int64Optional

Resume point, with the endpoint's other after_* parameters: serve the rows after this position, in the order sort asks for. Copy them from meta.next_url. Send them all or none (400).

Example: {"value":20950000}
after_log_indexinteger · int64Optional

Resume point: the log_index of the last row served. Copy it from meta.next_url, with the endpoint's other after_* parameters. Send them all or none (400).

Example: {"value":214}
after_event_typestringOptional

Resume point: the event_type of the last row served. Copy it from meta.next_url. Send all five after_* parameters or none (400). Not limited to the event_type enum, so that a type added later still resumes.

Example: {"value":"deposit"}Pattern: ^[a-z0-9_]{1,64}$
after_user_addressstringOptional

Resume point: the user_address of the last row served, empty when it was null. Copy it from meta.next_url. Send all five after_* parameters or none (400).

Example: {"value":"0x4f3a120e72c76c22ae802d129f599bfdbc31cb81"}Pattern: ^(0x[0-9a-fA-F]{40})?$
after_asset_addressstringOptional

Resume point: the asset_address of the last row served, empty when it was null. Copy it from meta.next_url. Send all five after_* parameters or none (400).

Example: {"value":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}Pattern: ^(0x[0-9a-fA-F]{40})?$
api_versionstringOptional

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.

Example: 2026-10-01Pattern: ^\d{4}-\d{2}-\d{2}(-preview)?$
Responses
200

One page of lending events, in the order sort asks for.

application/json

One page of lending events.

get/defi/lending/events
GET /defi/lending/events?blockchain=text HTTP/1.1
Host: api.kaiko.io
X-Api-Key: YOUR_API_KEY
Accept: */*
{
  "data": [
    {
      "event_type": "borrow",
      "timestamp": "2026-06-17T15:43:35.000Z",
      "block_number": 25338240,
      "log_index": 523,
      "transaction_hash": "0x77e1ef9917dc1f81d748917837311d9ba201a9e81426acdeab784b9c7b5fd12c",
      "blockchain": "ethereum",
      "protocol": "aav3",
      "market_id": "aave/v3/weth",
      "user_address": "0x1f00db89777c0f5e6d8e74014df9970467da69d5",
      "caller": "0xd01607c3c5ecaba394d8be377a08590149325722",
      "asset_symbol": "weth",
      "asset_address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "asset_decimals": 18,
      "receipt_symbol": "aethweth",
      "receipt_address": "0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8",
      "receipt_decimals": 18,
      "amount": "2",
      "amount_usd": "3523.22511856",
      "borrow_rate": "0.02165382930212227",
      "borrow_rate_mode": "variable",
      "emode_category_id": 0,
      "emode_category_label": null,
      "supply_rate": "0.01519298300005148",
      "stable_borrow_rate": "0",
      "variable_borrow_rate": "0.02165382930212227",
      "supply_index": "1.0669379512439376",
      "borrow_index": "1.1010946599853537",
      "total_deposited": "1962537.998586582",
      "total_deposited_usd": "3457231586.3743577",
      "total_borrowed": "1663691.3049068514",
      "total_borrowed_usd": "2930779497.488841",
      "metadata": {
        "amount_receipt": "2",
        "rate": "0.021653829302122271463787327",
        "interest_rate_mode": 2,
        "msg_sender": "0xd01607c3c5ecaba394d8be377a08590149325722",
        "referral_code": 0
      }
    }
  ],
  "meta": {
    "api_version": "2026-10-01",
    "url": "https://api.kaiko.io/defi/lending/events?blockchain=ethereum&protocol=aav3&assets=weth&event_types=borrow&start_block=25338240&end_block=25338241&api_version=2026-10-01",
    "count": 1,
    "next_url": null
  }
}

Last updated

Was this helpful?