# DefiLlama Scraper (`gio21/defillama-scraper`) Actor

Scrape DefiLlama TVL data: protocols, chains, and yield pools. Returns TVL, APY, chain, project, symbol, audits, and more. Useful for DeFi analytics, yield farming research, treasury management, and crypto market intelligence.

- **URL**: https://apify.com/gio21/defillama-scraper.md
- **Developed by:** [Gio](https://apify.com/gio21) (community)
- **Categories:** E-commerce, Developer tools, AI
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 record scrapeds

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## DefiLlama Scraper

Scrape DefiLlama's public TVL data: **protocols** (~7,500), **chains** (~450), **yield pools** (~20,000). Returns TVL, APY, chain, project info, audits.

Useful for **DeFi analytics**, **yield farming research**, **treasury management**, and **crypto market intelligence**.

### Free vs. paid

- **Free plan:** 15 clearly-labelled mock records.
- **Paid plan:** real, live DefiLlama data.

### Input

| Field | Type | Description |
|-------|------|-------------|
| `dataset` | String (required) | `protocols`, `chains`, or `yields`. |
| `minTvl` | Integer | Filter to entries with TVL >= this. Default 0. |
| `chain` | String | Optional chain filter (`Ethereum`, `Solana`, etc.). |
| `maxItems` | Integer | Default 500, max 25,000. |
| `debug` | Boolean | Verbose logs. |

### Output

For `dataset=protocols`:

```json
{
  "kind": "protocol",
  "id": "182",
  "name": "Lido",
  "symbol": "LDO",
  "chain": "Ethereum",
  "chains": ["Ethereum", "Solana", "Polygon"],
  "category": "Liquid Staking",
  "tvlUsd": 25000000000,
  "change_1d": 0.5,
  "change_7d": 3.2,
  "mcap": 1500000000,
  "fdv": 2000000000,
  "url": "https://lido.fi/",
  "twitter": "LidoFinance"
}
```

For `dataset=yields`:

```json
{
  "kind": "yield",
  "pool": "747c1d2a-c668-4682-b9f9-...",
  "chain": "Ethereum",
  "project": "lido",
  "symbol": "STETH",
  "tvlUsd": 18300000000,
  "apy": 2.368,
  "apyBase": 2.368,
  "apyReward": null,
  "apyPct1D": -0.05,
  "stablecoin": false,
  "ilRisk": "no",
  "exposure": "single",
  "rewardTokens": null
}
```

For `dataset=chains`:

```json
{ "kind": "chain", "name": "Ethereum", "tvlUsd": 80000000000, "tokenSymbol": "ETH", "chainId": 1 }
```

### Pricing

Billed **per record returned** ($0.005/record). One run with `dataset=protocols&maxItems=500&minTvl=10000000` returns ~500 top protocols for $2.50.

### How fast?

DefiLlama API is fast. 500 records in ~3 seconds. 25,000 records in ~10 seconds.

### Limitations

- DefiLlama updates protocol TVL roughly hourly. Yield APYs update less frequently.
- Some protocols list multiple chains; `chain` is the primary, `chains[]` has the full list.

If this actor helped you, please leave a review on the Apify Store.

# Actor input Schema

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

Which DefiLlama dataset to pull: 'protocols' (~7500 DeFi protocols with TVL), 'chains' (~450 chains with TVL), or 'yields' (~20000 yield pools with APY).

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

Filter to entries with TVL >= this value (USD). Set 0 to include everything.

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

Optional. Filter protocols or yield pools to a specific chain (e.g. 'Ethereum', 'Solana', 'Arbitrum'). Empty = all chains.

## `maxItems` (type: `integer`):

Maximum number of records to return after filtering.

## `debug` (type: `boolean`):

Enable verbose logging.

## Actor input object example

```json
{
  "dataset": "protocols",
  "minTvl": 0,
  "maxItems": 500,
  "debug": false
}
```

# Actor output Schema

## `results` (type: `string`):

Full record per DefiLlama entry: kind (protocol/chain/yield), name, chain, project, symbol, tvlUsd, apy, apyBase, apyReward, change\_1d, change\_7d, category, url. Fields populated depend on dataset.

# 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 = {
    "chain": "",
    "maxItems": 500
};

// Run the Actor and wait for it to finish
const run = await client.actor("gio21/defillama-scraper").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 = {
    "chain": "",
    "maxItems": 500,
}

# Run the Actor and wait for it to finish
run = client.actor("gio21/defillama-scraper").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 '{
  "chain": "",
  "maxItems": 500
}' |
apify call gio21/defillama-scraper --silent --output-dataset

```

## MCP server setup

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

```

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/tvvwmg0dp8ldDyJwl/builds/WhunspRKtrCiPbvBA/openapi.json
