> ## Documentation Index
> Fetch the complete documentation index at: https://tokenterminal.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To query the Token Terminal data catalog, read https://tokenterminal.com/docs/catalog/agents-manual.md first. It is the whole catalog as one page: table naming grammar, key columns, partition and cluster rules, units, additivity, and the tables that are documented but not served yet.
> Never query a catalog table on a time bound alone. Also filter its cluster key, which you read from INFORMATION_SCHEMA.COLUMNS; an empty result means the object is a view, whose pruning contract is on its page. Compute is billed to the caller's own Google Cloud project.

# Borrows

> Every borrow from a lending market.

One row per borrow from a lending market. `amount` is the tokens drawn, and [Interest rates](https://tokenterminal.com/docs/catalog/lending/interest-rates.md) has the rate that applied.

## Columns

<table>
  <thead>
    <tr>
      <th width="270">Column</th>
      <th width="120">Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`block_timestamp`</td><td>TIMESTAMP</td><td>Time of the block containing the borrow. Partition column.</td></tr>
    <tr><td>`block_number`</td><td>INT64</td><td>Number of the block containing the borrow.</td></tr>
    <tr><td>`transaction_hash`</td><td>STRING</td><td>Hash of the transaction that emitted the borrow event.</td></tr>
    <tr><td>`log_index`</td><td>INT64</td><td>Position of the borrow event in the block.</td></tr>
    <tr><td>`unique_id`</td><td>INT64</td><td>Row key: fingerprint of chain\_id, block\_number, transaction\_hash, log\_index.</td></tr>
    <tr><td>`event_type`</td><td>STRING</td><td>Constant 'borrows'; stacking key across the lending facts.</td></tr>
    <tr><td>`project_id`</td><td>STRING</td><td>Protocol operating the market, such as aave.</td></tr>
    <tr><td>`app_id`</td><td>STRING</td><td>Deployment of the protocol the market belongs to.</td></tr>
    <tr><td>`chain_id`</td><td>STRING</td><td>Chain the borrow happened on.</td></tr>
    <tr><td>`lending_market_id`</td><td>STRING</td><td>Market the borrow left; joins `dimensions.lending_markets`.</td></tr>
    <tr><td>`lending_market_reserve_id`</td><td>STRING</td><td>Reserve within the market; joins `dimensions.lending_market_reserves`.</td></tr>
    <tr><td>`lending_market_contract_address`</td><td>STRING</td><td>Contract the market lives on; not a key.</td></tr>
    <tr><td>`receipt_token_address`</td><td>STRING</td><td>Debt token whose balance moved (the variable debt token for Aave); null where debt is not tokenised.</td></tr>
    <tr><td>`token_id`</td><td>STRING</td><td>Token borrowed: \{token\_address}-\{chain\_id}.</td></tr>
    <tr><td>`token_address`</td><td>STRING</td><td>Contract address of the token borrowed.</td></tr>
    <tr><td>`token_symbol`</td><td>STRING</td><td>Symbol of the token borrowed.</td></tr>
    <tr><td>`token_decimals`</td><td>INT64</td><td>Decimals of the token borrowed.</td></tr>
    <tr><td>`borrower_address`</td><td>STRING</td><td>Account the borrowed tokens went to (the delegatee under credit delegation).</td></tr>
    <tr><td>`user_address`</td><td>STRING</td><td>Account whose debt rose; the position key across the lending facts.</td></tr>
    <tr><td>`shares_raw`</td><td>BIGNUMERIC</td><td>Movement in the protocol's debt unit, exact integer; summing per position replays the borrow-share balance.</td></tr>
    <tr><td>`shares`</td><td>BIGNUMERIC</td><td>shares\_raw decimal-corrected.</td></tr>
    <tr><td>`amount_raw`</td><td>BIGNUMERIC</td><td>Event-time amount in the token's stored unit, exact integer.</td></tr>
    <tr><td>`amount`</td><td>BIGNUMERIC</td><td>amount\_raw decimal-corrected into whole tokens. \*/}</td></tr>
  </tbody>
</table>

## Sample queries

> [!WARNING]
>
> This table is large and split by day. Bound `block_timestamp` and filter `chain_id` on every query, or you read the whole table and the whole table is billed to you.

**One day, one app**

`amount` is whole tokens and `amount_raw` the integer the contract emitted. `user_address` is whose debt rose.

```sql theme={null}
select
    events.block_timestamp,
    events.token_symbol,
    events.amount,
    events.user_address
from `facts_lending_markets.borrows` as events
where events.block_timestamp >= timestamp('2026-09-01')
  and events.block_timestamp < timestamp('2026-09-02')
  and events.chain_id = 'ethereum'
  and events.app_id = 'aave-v3'
limit 100
```

**Daily borrows per app**

Group by `token_symbol` as well as app: `amount` is in each token's own units, so one sum per token is the comparable figure.

```sql theme={null}
select
    date(events.block_timestamp) as day,
    events.app_id,
    events.token_symbol,
    sum(events.amount) as borrowed
from `facts_lending_markets.borrows` as events
where events.block_timestamp >= timestamp('2026-08-01')
  and events.block_timestamp < timestamp('2026-09-01')
  and events.chain_id = 'ethereum'
group by day, events.app_id, events.token_symbol
order by day, borrowed desc
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.