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

Extract DefiLlama protocol data as structured records: total value locked now and per chain, category, chains listed, audit references, token links, and the TVL change over 1d, 7d and 30d. Export data, run via API, schedule and monitor runs, or integrate with other tools.

- **URL**: https://apify.com/publicmoney/defillama-scraper.md
- **Developed by:** [Public Money](https://apify.com/publicmoney) (Apify)
- **Categories:** Business
- **Stats:** 4 total users, 3 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.00 / 1,000 records

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

DefiLlama is the reference for DeFi total value locked, and it publishes its own free API. What this Actor adds is shape: one record per protocol with the same field names as the other 29 Actors in this fleet, TVL broken out per chain, the change over 1d, 7d and 30d, category and audit references, and a failure row rather than a silent gap when a slug does not resolve.

### What it does

- Returns **one record per protocol**, in order. A slug DefiLlama does not know comes back with `status: "failed"` and a reason.
- Breaks **TVL out per chain** in `tvlByChain`, so a protocol deployed on eight chains shows you where the money actually is.
- Carries the **change over 1d, 7d and 30d** in one record, which is what tells you whether a TVL number is a trend or a spike.
- Reports **category and audit references**, so a protocol can be screened on more than its size.
- Uses the same **field vocabulary as the rest of this fleet**, so a DeFi record joins to a price record without a translation layer.
- Handles the source's **pagination and rate limits** for you, and gives you the platform's scheduling, webhooks and integrations around the result.

### Use cases

| You need to | How this Actor does it |
| --- | --- |
| Track TVL for a protocol set | Pass your protocols and schedule the run daily |
| See which chain a protocol really lives on | Read `tvlByChain` rather than the headline number |
| Tell a trend from a spike | Compare `change1d` against `change7d` and `change30d` |
| Screen a category | Filter on `category` across a protocol list |
| Check whether a protocol is audited | Read `audits` and `auditLinks` before you size a position |
| Feed a DeFi research agent | Call the Actor over MCP and let the model ask for the protocol it needs |

### Quick start

1. Click **Try for free**.
2. Add DefiLlama protocol slugs, one per line: `uniswap`, `aave`, `lido`. The slug is the last part of the protocol's DefiLlama URL.
3. Click **Start**. Rows appear within seconds.
4. Export as JSON, CSV, Excel or XML, or read the dataset over the API.

### Input

| Field | Type | Default | What it controls |
| --- | --- | --- | --- |
| `protocols` | array | `uniswap, aave` | DefiLlama protocol slugs to read |
| `maxItems` | integer | `0` | Caps how many protocols are read. `0` reads them all |

```json
{
    "protocols": [
        "uniswap",
        "aave",
        "lido"
    ],
    "maxItems": 0
}
```

### Output

One dataset item per protocol. Fields DefiLlama does not publish for a protocol are dropped rather than returned as `null`, so an unaudited protocol carries no audit fields.

| Field group | Fields |
| --- | --- |
| Identity | `status`, `requested`, `name`, `slug`, `category`, `url` |
| Value locked | `tvlUsd`, `tvlByChain`, `chains` |
| Change | `change1d`, `change7d`, `change30d` |
| Diligence | `audits`, `auditLinks`, `listedAt` |
| Token | `symbol`, `address`, `twitter` |
| Timing | `validFrom`, `scrapedAt` |

```json
{
    "status": "ok",
    "requested": "aave",
    "name": "AAVE",
    "slug": "aave",
    "category": "Lending",
    "tvlUsd": 18442110394.22,
    "tvlByChain": {
        "Ethereum": 14220118844.1,
        "Arbitrum": 1884219004.7,
        "Base": 1122008841.2
    },
    "chains": [
        "Ethereum",
        "Arbitrum",
        "Base",
        "Polygon"
    ],
    "change1d": -0.84,
    "change7d": 3.12,
    "change30d": 11.48,
    "audits": "2",
    "symbol": "AAVE",
    "validFrom": "2026-09-06T05:30:00.000Z",
    "url": "https://defillama.com/protocol/aave"
}
```

### Integrations

Run it over the API and get the rows back in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/publicmoney~defillama-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"protocols": ["uniswap", "aave", "lido"], "maxItems": 0}'
```

From Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")
run = client.actor("publicmoney/defillama-scraper").call(run_input={"protocols": ["uniswap", "aave", "lido"], "maxItems": 0})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["symbol"], item["name"], item["validFrom"])
```

Give an AI agent the Actor over MCP:

```json
{
    "mcpServers": {
        "apify": {
            "url": "https://mcp.apify.com/?actors=publicmoney/defillama-scraper"
        }
    }
}
```

Schedules run it on any cron, webhooks fire when a run finishes, and platform integrations push the
dataset to Google Sheets, Slack, Airtable, Zapier or your own endpoint.

### Cost

Pay per event, so you pay for records rather than compute time.

| Event | Free tier | Top volume tier |
| --- | --- | --- |
| Record with data | $0.002 | $0.0007 |
| Actor start | $0.00005 per GB | Same |

A record that returned no data is published as a failure row and is **never charged**. Six volume tiers apply, so the per-record price falls with monthly volume.

### Troubleshooting

| Issue | Solution |
| --- | --- |
| A protocol returns `failed` | The slug is wrong. It is DefiLlama's own, so read it off the end of the protocol's DefiLlama URL rather than guessing from the brand name. |
| `tvlUsd` does not match the sum of `tvlByChain` | DefiLlama excludes double-counted positions from the headline number, so the parts can exceed the whole. The headline is the one to quote. |
| A protocol shows a huge one-day change | Check `change7d` and `change30d`. TVL moves with the price of the assets locked, so a token move shows up as a TVL move. |
| `audits` is a number, not a list | That is DefiLlama's own scale for how audited a protocol is. `auditLinks` carries the references. |
| The protocol has no `symbol` | It has no token. Plenty of protocols hold value without one. |

### FAQ

#### Does DefiLlama have a free API?

Yes, and it is good. This Actor is not selling you access to it. What it gives you is the same record shape and field names as the other 29 Actors in this fleet, a failure row instead of a silent gap, pagination and rate limits handled, and the platform's scheduling, webhooks and integrations around it. For one script against one endpoint, use DefiLlama directly.

#### What is a DefiLlama protocol slug?

DefiLlama's own identifier, which is the last part of the protocol URL: `aave`, `uniswap`, `lido`. It is not always the brand name, so copy it from the URL.

#### Why is TVL per chain useful?

Because a protocol's headline TVL can be almost entirely on one chain. `tvlByChain` tells you whether a multi-chain deployment is real or nominal.

#### Does it return historical TVL?

No series, but each record carries the change over 1d, 7d and 30d. To build a series, schedule the Actor and let the dataset accumulate a row per protocol per run.

#### Why does TVL move when nothing was deposited?

TVL is denominated in USD, so it moves with the price of the assets locked. A token falling 10 percent drops TVL without a single withdrawal.

#### Do I need a DefiLlama API key?

No. You need an Apify token to call the Actor over the API. No DefiLlama credential is involved anywhere.

#### Can I get this data in Python?

Yes, with the `apify-client` package as shown above. It returns parsed JSON, so there is no HTML or response handling on your side.

#### Can I get the data into Excel or Google Sheets?

Yes. Export the dataset as XLSX or CSV, or connect the Google Sheets integration so each run appends to a sheet.

#### Can an AI agent call this Actor?

Yes. Add it to an MCP client with the config above and the model can request what it needs on its own. Every record is flat JSON with named fields, so no post-processing is needed.

#### Is it legal to scrape DefiLlama?

This Actor reads DefiLlama's public data, which the project publishes openly, and collects no personal data. How you store, redistribute or act on DeFi data is governed by your own agreements and local rules. Take your own legal advice for your use case.

### Changelog

- **0.0.2** Added the per-chain TVL breakdown, audit references and the 7d and 30d change.
- **0.0.1** First release. Protocol TVL and category.

### Feedback

Found a field DefiLlama publishes that this Actor misses, or an input it rejects? Open an issue on the Issues tab with the input and what you expected. A daily test runs every Actor in the fleet against live sources, so parser fixes ship fast.

# Actor input Schema

## `protocols` (type: `array`):

DefiLlama protocol slugs to read, one per line. The slug is the last part of the protocol's DefiLlama URL and is not always the brand name, so copy it from the URL rather than guessing. Examples: 'uniswap', 'aave', 'lido'. Default is 'uniswap', 'aave'.

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

Maximum number of protocols to read, counted from the top of the list. Use it to cap spend on a long list without editing the list itself. Examples: 10, 50, 200. Default is 0, which reads every protocol given.

## Actor input object example

```json
{
  "protocols": [
    "uniswap",
    "aave"
  ],
  "maxItems": 0
}
```

# Actor output Schema

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

One item per requested input, in the default 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 = {
    "protocols": [
        "uniswap",
        "aave"
    ],
    "maxItems": 0
};

// Run the Actor and wait for it to finish
const run = await client.actor("publicmoney/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 = {
    "protocols": [
        "uniswap",
        "aave",
    ],
    "maxItems": 0,
}

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

```

## MCP server setup

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