L logiover
data · Jul 9, 2026 · 8 min read

How to Scrape DeFiLlama TVL, Yields & Stablecoins in 2026

Pull DeFi data from DeFiLlama's public API — protocol TVL, yield pool APYs, stablecoin supply and per-chain breakdowns. Keyless, thousands of rows per run.

DeFiLlama is the de-facto reference for on-chain DeFi metrics — total value locked, yield pool APYs, stablecoin supply, per-chain breakdowns — aggregated across 200+ blockchains. The API is public and keyless, which is great, but it’s also fragmented across several hosts and endpoints, each returning deeply nested JSON that you have to flatten before it’s usable in a spreadsheet or a warehouse. This guide covers what data DeFiLlama exposes, how its API is structured, and how to pull thousands of clean, flat rows per run without writing per-endpoint glue code.

What’s worth extracting

The scraper flattens DeFiLlama’s nested responses into one consistent row schema across five modes. The fields you’ll actually use, grouped by mode:

  • Protocolsname, symbol, slug, chain (primary), chains (all, comma-separated), category (Dexes, Lending, CDP, Bridge…), tvl (USD), change1d and change7d (TVL percentage changes), mcap (token market cap), mcapTvl (market-cap-to-TVL ratio), url, description, logo.
  • Yieldspool (unique pool ID), project, chain, tvlUsd, apy (total), apyBase (from trading fees), apyReward (from incentive tokens), stablecoin (flag), ilRisk (impermanent-loss risk), exposure (single/multi).
  • Chains — per-chain tvlUsd snapshots.
  • StablecoinspegType (peggedUSD, peggedEUR…), pegMechanism (algorithmic, fiat-backed…), circulating (USD supply), circulatingPrevDay, and live price.
  • Every row carries mode (which scrape produced it) and fetchedAt (ISO timestamp).

Because one schema spans five very different record types, many fields are null on any given row — apy only populates in yields mode, pegType only in stablecoins. That’s expected; nulls mean the field doesn’t apply to that record type, not that the fetch failed.

How DeFiLlama’s API works

The actor connects directly to DeFiLlama’s official public API, which is split across three hosts by domain:

api.llama.fi          → protocols, chains, protocol TVL history
yields.llama.fi       → yield pool APYs
stablecoins.llama.fi  → stablecoin supply & peg data

No authentication, no API key, no login — the data is indexed from public blockchains and the endpoints are explicitly built for programmatic access. You pick a mode and the actor calls the right host and flattens the response:

  • protocols — the full universe of tracked DeFi protocols with TVL, changes, market cap and category. Returns 3,000–4,000+ rows.
  • yields — every yield pool across every protocol and chain, with the APY breakdown. Returns 10,000+ rows.
  • chains — per-chain TVL snapshots (roughly 100–200 chains).
  • stablecoins — all tracked stablecoins with peg type, mechanism, supply and price (roughly 150–300 assets).
  • protocolDetail — per-chain TVL history for a specific list of protocol slugs.

Two filters apply where they make sense: chainFilter (a blockchain name — case-insensitive, but it must match DeFiLlama’s spelling, e.g. BSC not Binance) and minTvl (a USD floor, useful because most protocols have negligible TVL). maxResults caps the row count for quick tests.

A protocols-mode input filtered to Ethereum with a $1M TVL floor:

{
  "mode": "protocols",
  "chainFilter": "Ethereum",
  "minTvl": 1000000,
  "maxResults": 500
}

And a yields-mode pull for Arbitrum pools:

{
  "mode": "yields",
  "chainFilter": "Arbitrum",
  "maxResults": 1000
}

For historical TVL, protocolDetail mode takes a list of slugs (find them in the slug field of protocols-mode output):

{
  "mode": "protocolDetail",
  "slugs": ["aave", "uniswap-v3", "curve-dex"]
}

Run the DeFiLlama Scraper on Apify — protocol TVL, yield APYs, stablecoin supply and chain data in flat rows, thousands per run. Keyless, no login. Export to CSV, JSON or Excel.

The access reality

Because this hits DeFiLlama’s official public API rather than scraping a bot-defended site, the “access reality” here is refreshingly boring — and that’s the point:

  • No keys, no auth, no login. The endpoints are open. There’s no token to rotate and no seat license.
  • No hard rate wall to engineer around. The API is fast and built for bulk access. Proxy configuration is optional; a datacenter proxy is plenty if you use one at all.
  • Speed. Protocols mode typically finishes in under 30 seconds; a 10,000+ row yields pull runs in roughly 30–60 seconds.
  • Data freshness. DeFiLlama updates protocol TVL every few minutes from on-chain data, yield APYs roughly hourly, and stablecoin supply frequently via blockchain indexing. For TVL trend analysis, daily runs suffice; for yield monitoring where APYs shift hour to hour, schedule every 1–4 hours.

The real work the actor saves is the flattening and the multi-host routing — calling three different API hosts, handling each mode’s distinct response shape, and normalizing everything into one queryable table.

Example output

A yields-mode row for a Curve stablecoin pool, trimmed to the fields that populate in that mode:

{
  "mode": "yields",
  "name": "USDC-USDT",
  "symbol": "USDC-USDT",
  "chain": "Ethereum",
  "tvlUsd": "245000000",
  "change1d": "0.12",
  "pool": "aa13b1c4-d3b2-4ec6-8ed8-5c1dea31efb3",
  "project": "curve",
  "apy": "4.82",
  "apyBase": "3.91",
  "apyReward": "0.91",
  "stablecoin": "true",
  "ilRisk": "no",
  "exposure": "multi",
  "fetchedAt": "2026-07-08T12:00:00.000Z"
}

Note apy splits into apyBase (trading fees) and apyReward (incentive tokens) — the two add up to total APY, and the split tells you how much of a pool’s yield is sustainable fee income versus emissions that can dry up.

Use cases

  • TVL leaderboards & dashboards — run protocols mode daily to power a top-100-by-TVL board with 1-day and 7-day change columns.
  • Yield farming discovery — pull yields mode, filter by chain, and sort by APY in your downstream tool to surface the best opportunities; use the apyBase/apyReward split to filter out pure-emissions yield.
  • Stablecoin peg monitoring — run stablecoins mode daily and compare circulating against circulatingPrevDay to detect USDT/USDC/DAI expansion or contraction and spot depeg risk via price.
  • Chain market-share analysis — export chains mode to track which L2s and alt-L1s are gaining TVL over time.
  • Protocol valuation — combine protocolDetail TVL history with token price data to compute revenue proxies and market-cap-to-TVL multiples (mcapTvl is already computed in protocols mode).
  • AI-agent tooling — the actor is available as an MCP tool, so an agent can answer “top 10 protocols by TVL on Ethereum” or “yield pools above 10% APY on Arbitrum” by invoking it and reasoning over the rows.

Build it yourself vs. use the managed actor

You can call DeFiLlama’s API directly — it’s public. What the managed actor absorbs:

  • Multi-host routing. Protocols, yields and stablecoins live on three different hosts (api.llama.fi, yields.llama.fi, stablecoins.llama.fi), each with its own response shape.
  • Flattening. The raw responses are deeply nested; turning them into one flat, warehouse-ready schema across five modes is the bulk of the code.
  • Filtering and paging. Chain-name normalization, the minTvl floor, and consistent maxResults capping.

Pricing is pay-per-result, per compute unit, so large runs stay cheap and there’s no monthly quota. Set maxResults: 50 for a fast sanity check before committing to a full 10,000-row yields pull.

Scheduling and integrations

DeFiLlama’s underlying data updates continuously, which makes this a natural fit for scheduled time-series collection. The right cadence depends on the mode: for TVL trend analysis, daily protocols runs are enough to build a clean day-over-day series; for yield monitoring, where APYs can shift materially hour to hour, schedule yields every one to four hours; for peg monitoring, run stablecoins daily and compare circulating against circulatingPrevDay to catch supply expansion or contraction. Because every row carries fetchedAt, you can stitch scheduled runs into a proper time series and know exactly when each observation was valid.

On the delivery side, the actor plugs into the standard Apify integrations. Write results straight to Google Sheets for a live-updating DeFi dashboard, POST run metadata to your own endpoint via a webhook, or fan data out to Airtable, Notion or a CRM through Zapier or Make when a run completes. For programmatic access, the Apify API and clients let you trigger a run and read the dataset directly from Node.js or Python — useful when the scraper is one stage in a larger analytics pipeline rather than a standalone export. And because it’s exposed as an MCP tool, an AI agent can call it mid-conversation and reason over the returned rows without any manual API wiring.

Common pitfalls

Specific gotchas for DeFiLlama data:

  • Chain names must match DeFiLlama’s spelling. chainFilter is case-insensitive but not fuzzy — use BSC, not Binance; Ethereum, not ETH. A mismatched name returns zero rows. If you get nothing back, drop the filter first to confirm data exists, then fix the spelling.
  • Nulls are mode-specific, not errors. A protocols row has null apy, pegType and pool; a yields row has null mcap and circulating. The single unified schema means most fields are null on any given record. Filter by mode before you analyze.
  • tvl vs. tvlUsd. Protocols mode populates tvl; yields and chains modes populate tvlUsd. Don’t assume one field across all modes.
  • APY is a snapshot, and emissions move fast. apy reflects the moment of the fetch and yield APYs shift significantly hour to hour. For yield monitoring, schedule frequent runs and store fetchedAt so you know when each quote was valid.
  • protocolDetail needs correct slugs. Slugs come from the slug field in protocols-mode output. Run protocols mode first, copy the slugs, then feed them to protocolDetail — guessing slug formats produces empty results.
  • TVL is denominated in USD. Raw tvl values are full dollar amounts (e.g. 15234567890 is ~$15.2B), not millions. Scale in your downstream tool.

Wrapping up

DeFiLlama’s data is public and free — the friction is the three-host routing and the flattening of deeply nested JSON into something you can actually query. If you need a clean, flat DeFi feed — TVL rankings, yield APYs, stablecoin supply — refreshed on a schedule, a managed actor hands you one queryable table per mode with the plumbing already solved. Data is for research and analytics; none of it is financial advice.

Open the DeFiLlama Scraper on Apify — five modes (protocols, yields, chains, stablecoins, protocol detail), thousands of flat rows per run. Keyless, no login. Export to CSV, JSON or Excel. Start on Apify’s free monthly credit.

Related guides