# DefiLlama DeFi TVL Scraper - TVL, Yields & Chains (`thebee/defi-tvl`) Actor

DeFi protocol TVL data from DefiLlama: total value locked, 1d/7d/30d change, chain deployments, category and parent protocol, plus market-cap ratios and CoinGecko/CMC ids for joins. Public api.llama.fi, no API key. Pay per protocol row at $0.005. TVL only — not yield data.

- **URL**: https://apify.com/thebee/defi-tvl.md
- **Developed by:** [ttgi](https://apify.com/thebee) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 defi protocol tvl & yield rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## DeFi TVL and Yield Scraper

Chain TVL and protocol rankings from DefiLlama's free public API. No API key,
no browser, no signup.

### Why

A survey of 478 Apify Store listings found **zero** dedicated DeFi/TVL actors.
The data is large, free, and changes daily - which suits recurring monitoring
runs rather than one-off lookups.

### Usage

```
{
  "dataset": "both",        // chains | protocols | both
  "category": "Lending",    // optional protocol-category filter
  "chain": "Solana",        // optional chain filter
  "protocolLimit": 100,     // caps protocol rows
  "minTvl": 0               // drop rows below this USD TVL
}
```

### Output

Chain rows carry `name`, `gecko_id`, `chainId`, `tvl`, `tokenSymbol`, and
`change_1d` / `change_7d` / `change_1m`, plus `mcap`.

Protocol rows carry `name`, `slug`, `symbol`, `category`, `chains`, `tvl`,
the same change fields, `mcap`, `parentProtocol`, and a DefiLlama URL.

### Use cases

- **TVL migration tracking** — which chains gained or lost value this week
- **Protocol league tables** — top protocols by category or chain
- **Yield hunting** — filter by category, rank by TVL, compare changes
- **Competitive landscape** — `parentProtocol` groups ecosystems under a brand
- **Alerting** — schedule daily and diff the change fields

### Honest notes

- The full `/protocols` payload is roughly 9 MB. `protocolLimit` caps it;
  keep that bound or compute cost rises sharply.
- TVL is aggregated by DefiLlama's own methodology, not raw on-chain sums.
- CEX entries appear in the protocol list with `category: "CEX"`. Filter them
  out if you only want DeFi protocols.
- Change fields are frequently null for newer or smaller protocols.

*Pronouns: they/them.*

# Actor input Schema

## `dataset` (type: `string`):

chains, protocols, or both.

## `category` (type: `string`):

Filter protocols by category, e.g. Dexes, Lending, Yield.

## `chain` (type: `string`):

Only protocols on this chain, e.g. Ethereum, Solana, Base.

## `protocolLimit` (type: `integer`):

Caps protocol rows. The full payload is ~9 MB, so keep this bounded to control cost.

## `minTvl` (type: `integer`):

Drop rows below this total value locked. 0 returns everything.

## Actor input object example

```json
{
  "dataset": "both",
  "protocolLimit": 100,
  "minTvl": 0
}
```

# Actor output Schema

## `name` (type: `string`):

The Name value.

## `gecko_id` (type: `string`):

The Gecko ID value.

## `chainId` (type: `string`):

The Chain ID value.

## `tvl` (type: `string`):

The TVL value.

## `tokenSymbol` (type: `string`):

The Token value.

## `change_1d` (type: `string`):

The 1d change value.

## `change_7d` (type: `string`):

The 7d change value.

## `change_1m` (type: `string`):

The 30d change value.

## `mcap` (type: `string`):

The Market cap value.

## `slug` (type: `string`):

The Slug value.

## `symbol` (type: `string`):

The Symbol value.

## `category` (type: `string`):

The Category value.

## `chains` (type: `string`):

The Chains value.

## `parentProtocol` (type: `string`):

The Parent protocol value.

## `url` (type: `string`):

The URL value.

## `slug_url` (type: `string`):

The DefiLlama URL value.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("thebee/defi-tvl").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("thebee/defi-tvl").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call thebee/defi-tvl --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,thebee/defi-tvl"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/lH1ogfg6ANxgkLDOq/builds/CntpLFEKTPcR1letH/openapi.json
