DeFi API
Read-only DeFi analytics endpoints. Backed by DeFiLlama; values reflect the provider’s most recent snapshot.Base URL
Authentication
All endpoints require a JWT bearer token.Endpoints
Get protocol TVL
GET /api/v1/defi/protocol/{protocol}/tvl
Total Value Locked for a single DeFi protocol, broken down by chain.
Path Parameters:
protocol(string, required): Protocol name or slug. Examples:aave,uniswap,lido.
Get chain TVL
GET /api/v1/defi/chain/{chain}/tvl
Total Value Locked across all protocols on a blockchain, plus the top 10 protocols on that chain.
Path Parameters:
chain(string, required): Blockchain name. Examples:Ethereum,Solana,Arbitrum,Polygon.
Get stablecoin metrics
GET /api/v1/defi/stablecoins/metrics
Total stablecoin supply with per-chain breakdown.
Pro endpoints
These five endpoints expose the paid DeFiLlama Pro tier. They require a Pro, Startup, or Enterprise plan (an unentitled plan returns403
TIER_UPGRADE_REQUIRED) and share a 1,000 calls/account/month budget
(429 quota_exceeded once exhausted). Agents paying per call via x402 are not
subscription-gated. Each returns a { "success": true, "count": N, "data": [...] }
envelope.
| Endpoint | Returns | SDK method |
|---|---|---|
GET /defi/token-unlocks | token unlock schedules + supply metrics | client.defi.get_token_unlocks() |
GET /defi/perp-funding | aggregated perpetual funding rates | client.defi.get_perp_funding() |
GET /defi/treasuries | protocol treasury holdings | client.defi.get_treasuries() |
GET /defi/etf-flows | crypto ETF net flows | client.defi.get_etf_flows() |
GET /defi/lending-rates | lending / borrow rates | client.defi.get_lending_borrow_rates() |
examples/defi_pro.py (with
403/429 handling).
Error Codes
| Code | HTTP Status | Description |
|---|---|---|
AUTH_REQUIRED | 401 | Missing or invalid bearer token |
TIER_UPGRADE_REQUIRED | 403 | Pro endpoint requested on a plan without defi_pro (Pro/Startup/Enterprise required) |
RESOURCE_NOT_FOUND | 404 | Unknown protocol or chain slug |
quota_exceeded | 429 | Monthly DeFiLlama Pro cap reached (1,000 calls/account/month) |
INTERNAL_ERROR | 500 | Upstream provider (DeFiLlama) error |