Monitor DeFi Protocol TVL in Real Time with DefiLlama API
Tracking Total Value Locked (TVL) across DeFi protocols is critical for investors and developers. DefiLlama's TVL API gives you instant access to real-time protocol data without maintaining your own blockchain indexer.
What It Does
DefiLlama TVL API surfaces TVL and yield metrics for thousands of DeFi protocols across multiple chains. You get:
- Real-time TVL for any protocol or chain
- Yield farming data to compare APY rates
- Cross-chain support including Ethereum, Arbitrum, Polygon, and more
- Protocol rankings by total value locked
- Historical snapshots to track trends
Perfect for dashboards, portfolio trackers, or automated trading bots.
Getting Started with Fetch
Here's how to fetch TVL data for all protocols on a specific chain:
const options = {
method: 'GET',
headers: {
'X-RapidAPI-Key': 'YOUR_API_KEY_HERE',
'X-RapidAPI-Host': 'defillama-tvl-api-production.up.railway.app'
}
};
fetch('https://defillama-tvl-api-production.up.railway.app/api/protocols?chain=ethereum', options)
.then(response => response.json())
.then(data => {
console.log('Top DeFi Protocols:');
data.slice(0, 5).forEach(protocol => {
console.log(`${protocol.name}: $${(protocol.tvl / 1e6).toFixed(2)}M TVL`);
});
})
.catch(error => console.error('Error:', error));
Response sample:
[
{
"name": "Curve Finance",
"tvl": 5234000000,
"chain": "ethereum",
"yield": "2.5"
},
{
"name": "Lido",
"tvl": 14234000000,
"chain": "ethereum",
"yield": "3.8"
}
]
Pro Tips
-
Chain parameter: Swap
ethereumforarbitrum,polygon,optimism, oravalanche - Filter by yield: Sort protocols by APY to find the best farming opportunities
- Cache responses: Rate limits apply—store data locally and refresh every 5-10 minutes
- Combine chains: Make parallel requests to compare TVL across networks
Why This API?
Unlike on-chain queries that require running a node, DefiLlama aggregates verified data from on-chain sources. It's 10x faster, requires no infrastructure, and handles the heavy lifting.
Ready to Build?
Head over to DefiLlama TVL on RapidAPI to grab your free API key and start building. Test the endpoint right in the RapidAPI console before integrating it into your app.
Your next DeFi dashboard starts now.
Top comments (0)