# DefiLlama DeFi Protocol Scraper (`parseforge/defillama-scraper`) Actor

Scrapes DeFi protocol TVL, yield pools, stablecoin supply, chain rankings, and historical TVL from DefiLlama. Returns each record as a flat row with full metrics.

- **URL**: https://apify.com/parseforge/defillama-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 3 total users, 0 monthly users, 89.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.95 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)](https://apify.com/parseforge?fpr=vmoqkp)

### DefiLlama DeFi Protocol Scraper

**Scrape DeFi protocol TVL, yield pools, stablecoin supply, and chain rankings from DefiLlama, up to a million records per run.** Every record comes with its full metrics, category tags, and chain breakdowns. No API key or registration. Export to CSV, JSON, Excel, or XML.

DefiLlama is the open-source DeFi data aggregator, but pulling its data into your own models means writing API scripts, handling pagination, and normalizing different endpoint schemas. This Actor reads the public DefiLlama datasets directly, lets you pick from protocols, chains, stablecoins, yield pools, or historical TVL, and returns every match in one flat, consistent row.

| Who uses it | What they scrape DefiLlama for |
|---|---|
| DeFi analysts | Tracking total value locked (TVL) changes across protocols and chains for a weekly market report. |
| Yield farmers | Comparing APY and pool TVL across yield farming pools to find the best risk-adjusted returns. |
| Crypto hedge funds | Monitoring stablecoin supply and depegs as early signals for market stress. |
| Blockchain researchers | Pulling historical TVL data to backtest correlation with token prices. |

### What it does

This Actor collects DeFi data from DefiLlama by endpoint or specific protocol slug, and returns each record as a flat row with its TVL, APY, supply, or chain metrics.

- 📊 **Protocols endpoint:** 4,000+ DeFi protocols with TVL, category, chain, and market cap.
- ⛓️ **Chains endpoint:** 570+ blockchain networks ranked by TVL, with protocol count and change percentages.
- 💵 **Stablecoins endpoint:** 40+ stablecoins with circulating supply, bridged supply, and peg status.
- 🌾 **Yields endpoint:** Yield farming pools with APY, TVL, and underlying protocol data.
- 📈 **Historical TVL endpoint:** Aggregate total TVL over time for the entire DeFi ecosystem.
- 🎯 **Single protocol lookup:** Pass a protocol slug like 'aave' or 'lido' to get its full detailed breakdown.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with DefiLlama data

**📈 Monitor protocol TVL trends.**

A DeFi analyst runs the protocols endpoint daily to track which lending and DEX protocols are gaining or losing TVL, feeding a dashboard that flags shifts over 5%.

**🌾 Find the best yield pools.**

A yield farmer scrapes the yields endpoint filtered by APY and TVL to rank pools by risk-adjusted return before allocating capital.

**💵 Track stablecoin supply changes.**

A macro researcher pulls the stablecoins endpoint weekly to detect supply contractions that often precede market downturns.

**⛓️ Compare blockchain ecosystems.**

A venture analyst scrapes the chains endpoint to rank L1s and L2s by TVL and protocol count, identifying ecosystems gaining developer traction.

**📊 Backtest TVL against price.**

A quant researcher pulls the historical TVL endpoint to build a time series and test whether TVL leads or lags token price movements.

### Why choose this scraper

| | What you get |
|---|---|
| **No API key needed** | Reads DefiLlama public data directly, no registration or rate-limit headaches. |
| **Five datasets, one schema** | Protocols, chains, stablecoins, yields, and historical TVL all return as flat, predictable rows. |
| **Up to a million records** | Set maxItems to pull anything from a single protocol to the entire ecosystem. |
| **CSV, JSON, Excel, XML** | Export into whichever format your analysis stack expects. |

### How it compares

Three DefiLlama scrapers exist on Apify. This one covers all five DefiLlama endpoints with a single-protocol lookup mode.

| Feature | ParseForge | DefiLlama Scraper | DefiLlama Scraper - Protocols, Yields, Chains & Stablecoins |
|---|---|---|---|
| Protocols endpoint (TVL, category, chains) | Yes | Yes | Yes |
| Chains endpoint (TVL rankings) | Yes | Yes | Yes |
| Stablecoins endpoint (supply data) | Yes | Yes | Yes |
| Yields endpoint (APY, pool TVL) | Yes | Not listed | Yes |
| Historical TVL endpoint | Yes | Yes | Not listed |
| Single protocol lookup by slug | Yes | Not listed | Not listed |
| Up to 1,000,000 records per run | Yes | Not listed | Not listed |

### Configure the run

Drive the Actor by selecting a dataset endpoint or by passing a specific protocol slug. The maxItems limit controls how many records are collected per run. The Input tab lists every parameter.

A first run with the defaults:

```json
{
 "maxItems": 10,
 "endpoint": "protocols"
}
```

A larger pull:

```json
{
 "maxItems": 200,
 "endpoint": "protocols"
}
```

### Pricing

Pay-per-result: **$0.0063 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $0.63 |
| 1,000 results | $6.30 |
| 10,000 results | $63.00 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [DefiLlama DeFi Protocol Scraper](https://apify.com/parseforge/defillama-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to DefiLlama through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com/?tools=parseforge/defillama-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check that your protocol slug is spelled correctly. Slugs are lowercase and match the DefiLlama URL (e.g. 'aave', not 'AAVE'). If you are using an endpoint, make sure maxItems is set to at least 1.

**Why is my run timing out?**

Lower your maxItems value. Pulling a million records takes time. Start with 100 to test, then scale up.

**Why are some fields empty in my output?**

Not every endpoint returns every field. A stablecoin record will not have APY, and a yield pool record will not have stablecoin supply. Check the endpoint you selected.

**Why did I get fewer records than my maxItems setting?**

The Actor stops when it has collected all available data from the endpoint. If DefiLlama has 40 stablecoins, setting maxItems to 100 will return 40 records.

**Can I get TVL in a specific currency?**

DefiLlama reports TVL in USD by default. The Actor returns the values as DefiLlama provides them.

### FAQ

| Question | Answer |
|---|---|
| Do I need a DefiLlama API key? | No. This Actor reads the public DefiLlama data feeds directly. No registration, no API key, no OAuth. |
| What endpoints can I scrape? | You can choose from five datasets: protocols, chains, stablecoins, yields, and historical TVL. You can also pass a specific protocol slug to get its full detail. |
| How many records can I pull in one run? | Set maxItems anywhere from 1 to 1,000,000. The Actor stops when it hits your limit or runs out of data. |
| What fields do I get for a protocol? | You get TVL, category, chains it is deployed on, market cap, 24h change, and more. The exact fields depend on the endpoint and are shown in the sample output on the Actor's page. |
| Can I scrape a single protocol? | Yes. Pass a protocol slug like 'aave', 'uniswap', or 'lido' in the protocol field, and the Actor returns that protocol's full data. |
| Does this include historical TVL data? | Yes. Select the historical-tvl endpoint to get the aggregate total TVL across all of DeFi over time. |
| What export formats are supported? | You can export your dataset as CSV, JSON, Excel, or XML from the Apify platform. |
| How often is the data updated? | The Actor pulls live data from DefiLlama on each run. Schedule it to run hourly, daily, or weekly to build a time series. |
| Can I filter by chain or category? | The Actor returns all records from the selected endpoint. You can filter the output dataset in Apify's post-processing or in your own analysis tool. |
| Is this the same data as the DefiLlama website? | Yes. It reads the same public data feeds that power the DefiLlama dashboard. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by DefiLlama. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

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

How many protocols to collect per run.

## `endpoint` (type: `string`):

Which DefiLlama dataset to query.

## `protocol` (type: `string`):

Get detailed data for a specific protocol (e.g. 'aave', 'uniswap', 'lido'). Overrides endpoint selection.

## Actor input object example

```json
{
  "maxItems": 10,
  "endpoint": "protocols"
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# 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 = {
    "maxItems": 10,
    "endpoint": "protocols"
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/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 = {
    "maxItems": 10,
    "endpoint": "protocols",
}

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/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/D8mPaixUmdkGGLGbN/builds/o5Fr1Lg2eOEZuTKmm/openapi.json
