L logiover
developer-tools · May 21, 2026 · 6 min read

How to Scrape DefiLlama Yields & APY Pool Data in 2026

Pull 20,000+ DeFi yield pools from DefiLlama — APY breakdown, TVL, reward yield, 1d/7d/30d APY trend and impermanent-loss risk. How the yields API works and how to query it at scale.

If you’re farming yield, building a yield aggregator, or running a strategy that rotates capital between pools, you live or die by fresh APY data. DefiLlama’s yields dataset is the broadest neutral source there is: 20,000+ yield-bearing pools across every chain it indexes, with APY split into its components and trended over time. This guide covers exactly what’s in that feed, how the public yields API behaves, and why a managed scraper is the saner way to consume it at scale.

What’s worth extracting

The yields endpoint is pool-level, and the difference between a useful row and a misleading one is in the breakdown. The fields that actually drive decisions:

  • APY breakdown — total APY, plus base (organic, from fees/lending) versus reward (token incentives). A 200% APY that’s 195% reward emissions is a very different bet than 200% base.
  • 30-day mean APY — the smoothed number that strips out spot spikes. Indispensable for indexes and for not chasing a one-day anomaly.
  • APY trend — 1-day, 7-day and 30-day APY change so you can see whether a pool’s yield is decaying or climbing.
  • TVL — pool size in USD; thin pools have unstable, unrealizable APYs.
  • Volume — 1-day and 7-day USD volume, which underpins fee-based base yield.
  • Impermanent-loss risk — DefiLlama’s IL-risk classification (no / yes) so you can screen LP exposure.
  • Exposure type — single-asset (staking, lending) versus LP (two-sided, IL-exposed).
  • Stablecoin flag, reward token addresses, protocol and chain identifiers, pool URL.

For yield-farming automation you typically want APY total + base/reward split, TVL, IL risk and the trend columns. For treasury work you filter hard to stablecoin + single exposure + high TVL.

How the data is exposed

DefiLlama serves yields from a dedicated, free, no-key host separate from the main TVL API:

GET https://yields.llama.fi/pools

Like the protocols endpoint, this returns the full snapshot in one response — all 20,000+ pools in a single large JSON array. Per-pool APY history lives at:

GET https://yields.llama.fi/chart/{pool_id}

The full-snapshot model is great for throughput (one request, everything) but the payload is large and the per-pool objects are nested and inconsistently populated — apyBase and apyReward are frequently null, predictions and il_risk come from sub-objects, and reward tokens are an array of contract addresses you have to resolve separately. Flattening this into clean, sortable rows is the real work.

Rate limits and fair use

The yields.llama.fi host is free but shared and throttled:

  • A single /pools call per cycle is the intended usage — that one request already gives you every pool.
  • Fanning out to /chart/{pool_id} for thousands of pools will earn you HTTP 429s quickly; pull history only for pools you’re actually tracking.
  • Heavy commercial consumers are expected to move to DefiLlama’s paid Pro API for higher limits.

A managed scraper enforces this for you: one snapshot, in-stream filter/sort/trim, exponential backoff on 429, and no reckless per-pool fan-out.

Run the DefiLlama Yields Scraper — pulls 20,000+ pools, flattens the APY breakdown, TVL, 1d/7d/30d trend and IL risk into a clean table. Filter by chain, protocol, TVL, APY range and stablecoin-only. Schedule it for a daily best-yields feed.

Build it yourself vs. use a managed scraper

The endpoint is open, so the temptation to DIY is strong. The cost is in the normalization:

  • Building from scratch — quick to dump, then days of work: null-safe APY math, separating base from reward consistently, classifying IL risk and exposure, resolving reward token arrays, applying TVL/APY filters, and re-doing it whenever the JSON shifts.
  • Using a managed actor — set chain/protocol/TVL/APY filters, run, get tabular output ready for a sheet, a bot, or a warehouse. Schedule daily and you accumulate the longitudinal APY history quants actually want.

Schema design for downstream use

A flat, query-friendly per-pool row:

{
  "pool_id": "747c1d2a-c668-4682-b9f9-296708a3dd90",
  "project": "aave-v3",
  "chain": "Ethereum",
  "symbol": "USDC",
  "tvl_usd": 412000000,
  "apy": 4.8,
  "apy_base": 4.8,
  "apy_reward": 0,
  "apy_mean_30d": 4.2,
  "apy_change_1d": 0.1,
  "apy_change_7d": -0.3,
  "apy_change_30d": 0.6,
  "volume_usd_1d": 0,
  "il_risk": "no",
  "exposure": "single",
  "stablecoin": true,
  "reward_tokens": [],
  "pool_url": "https://defillama.com/yields/pool/747c1d2a-...",
  "scraped_at": "2026-05-21T00:00:00Z"
}

Decisions worth making early:

  • Always store base and reward separately. The blended APY hides whether yield is organic or emission-driven — the single most important question in yield farming.
  • Prefer apy_mean_30d for ranking, not spot apy. Spot APY spikes on tiny pools and during reward-program launches; the 30-day mean is what survives a backtest.
  • Keep il_risk and exposure as filters, not afterthoughts. A “best yields” leaderboard that mixes single-asset lending with two-sided LP positions is comparing incomparable risk.
  • Stamp scraped_at. Scheduled daily runs become a time series only if every row is timestamped.

Typical use cases

  • Automated yield-farming bots — refresh a ranked list of high-APY pools inside your TVL and IL-risk thresholds, rotate capital accordingly.
  • Stablecoin yield aggregation & treasury management — surface the highest-yield stablecoin pools above a TVL floor for idle-cash deployment.
  • Liquid staking / restaking dashboards — compare LST and LRT APYs across providers and chains in one table.
  • DeFi strategy research — base-versus-reward comparisons across protocol families to find genuinely sustainable yield.
  • Index and structured-product construction — build baskets weighted on 30-day mean APY to avoid chasing noise.
  • APY backtesting & quant research — schedule recurring runs to assemble longitudinal APY, TVL and reward histories.
  • Risk and IL screening tools — filter pools by IL classification and exposure to flag dangerous positions.

The pattern is the same across all of them: ranked, filtered, fresh yield data refreshed on a schedule.

Cost math for the managed approach

One request returns all 20,000+ pools, so a full daily snapshot is fast. At a fraction of a cent per row plus a negligible start fee, an unfiltered daily archive of every pool is in the low tens of dollars a month; filtered to, say, stablecoin pools above $1M TVL, you’re paying for a few hundred rows a day — pocket change.

Against a self-hosted poller you skip the cron maintenance, the 429-backoff code, the null-safe flattening, and the perpetual upkeep as DefiLlama evolves the schema.

Common pitfalls

  • Null apyBase / apyReward. Many pools report only total APY. Decide whether to drop, impute, or flag — silently treating null as zero will distort your base-vs-reward analysis.
  • Spot-APY mirages. A brand-new incentive program shows an enormous spot APY that collapses within days. Lean on the 30-day mean and the trend columns.
  • Thin-pool instability. APY on a $5k pool is noise and usually unrealizable at size. Always pair an APY filter with a TVL floor.
  • Reward token addresses, not symbols. reward_tokens are contract addresses; resolving them to symbols is a separate enrichment step.
  • Pool IDs, not symbols, are stable. The same symbol exists on many chains and protocols; join on pool_id.

Wrapping up

DefiLlama’s yields API hands you a raw firehose for free; the work is turning it into clean, risk-aware, trended rows you can actually rank and schedule. If you need that as a dependable daily feed for a bot, a treasury, or a backtest, run a managed scraper that already handles the flattening, the IL classification and the fair-use pacing.

Open the DefiLlama Yields Scraper on Apify — daily best-yields feed across every chain, base/reward split and IL risk included. JSON/CSV/Excel, free monthly credit to start.

Related guides