# On-chain data

> DeFi protocol total value locked by day.

Page: https://docs.aggre.org/datasets/onchain · Section: Datasets · All pages: https://docs.aggre.org/llms.txt

On-chain and DeFi figures. Reference: [On-chain route](https://docs.aggre.org/api/data/onchain.md).

## Protocol TVL {#protocol-tvl}

`GET /v1/onchain/defi/protocol_tvl` serves DeFi protocol total value locked (TVL) from DefiLlama's protocol list: one row per protocol per UTC day, identified by `(slug, as_of)`. The dataset is `onchain.defi.protocol_tvl` and it is also listed under `finance.market`.

Fields include `tvl_usd` (a JSON number), `mcap_usd`, `change_1h`, `change_1d`, `change_7d`, `category`, `chain`, `chains`, `chain_tvls` and `tvl_rank` (Aggre's own: 1 is the largest TVL of the day). A figure the source leaves out is `null`, never zero.

Two shapes, chosen by `slug`:

| Shape | Parameters | Result |
|---|---|---|
| **A day** (no `slug`) | `as_of`, `category` (exact, case-sensitive), `chain` (one element of `chains`, exact) | Every protocol of one day ordered by TVL rank. The newest stored day unless `as_of` names one. `from`, `to` and `order` are `400` here. |
| **A history** (`slug`) | `from` (inclusive), `to` (exclusive), both `YYYY-MM-DD`, `order` | One protocol's rows over time, newest first unless `order=asc`. `as_of`, `category` and `chain` are `400` here. |

A cursor pins its day.

## Behaviour to know {#behaviour}

- `as_of` is the day Aggre **read** the figure. History starts the day collection started; nothing is backfilled.
- `meta.status` is `empty` for no rows and `stale` when the answer follows the newest data and Aggre's last successful read is more than 3 days old. It is never `stale` for a view pinned to a date.
- **Whoever shows a row shows `meta.dataset.credit`.**
- The route answers `503 terms_unread` until the publisher's terms are recorded as read, and then reads no row ([Freshness](https://docs.aggre.org/concepts/freshness.md#terms)).
