|
| 1 | +# DefiLlama Free API |
| 2 | + |
| 3 | +> Free API — no authentication required. All endpoints below use base URL https://api.llama.fi |
| 4 | + |
| 5 | +**Base URL for ALL endpoints below:** `https://api.llama.fi` |
| 6 | + |
| 7 | +## TVL |
| 8 | + |
| 9 | +### GET /protocols |
| 10 | +**Base URL:** `https://api.llama.fi` |
| 11 | +List all protocols on defillama along with their tvl |
| 12 | + |
| 13 | +### GET /protocol/{protocol} |
| 14 | +**Base URL:** `https://api.llama.fi` |
| 15 | +Get historical TVL of a protocol and breakdowns by token and chain |
| 16 | + |
| 17 | +**Parameters:** |
| 18 | + - `protocol` (path, string, required) — protocol slug Example: `aave` |
| 19 | + |
| 20 | +### GET /v2/historicalChainTvl |
| 21 | +**Base URL:** `https://api.llama.fi` |
| 22 | +Get historical TVL (excludes liquid staking and double counted tvl) of DeFi on all chains |
| 23 | + |
| 24 | +### GET /v2/historicalChainTvl/{chain} |
| 25 | +**Base URL:** `https://api.llama.fi` |
| 26 | +Get historical TVL (excludes liquid staking and double counted tvl) of a chain |
| 27 | + |
| 28 | +**Parameters:** |
| 29 | + - `chain` (path, string, required) — chain slug, you can get these from /chains or the chains property on /protocols Example: `Ethereum` |
| 30 | + |
| 31 | +### GET /tvl/{protocol} |
| 32 | +**Base URL:** `https://api.llama.fi` |
| 33 | +Simplified endpoint to get current TVL of a protocol |
| 34 | + |
| 35 | +**Parameters:** |
| 36 | + - `protocol` (path, string, required) — protocol slug Example: `uniswap` |
| 37 | + |
| 38 | +### GET /v2/chains |
| 39 | +**Base URL:** `https://api.llama.fi` |
| 40 | +Get current TVL of all chains |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## Coins & Prices |
| 45 | + |
| 46 | +### GET /prices/current/{coins} |
| 47 | +**Base URL:** `https://api.llama.fi` |
| 48 | +Get current prices of tokens by contract address |
| 49 | + |
| 50 | +**Parameters:** |
| 51 | + - `coins` (path, string, required) — set of comma-separated tokens defined as {chain}:{address} Example: `ethereum:0xdF574c24545E5FfEcb9a659c229253D4111d87e1,coingecko:ethereum,bsc:0x762539b45a1dcce3d36d080f74d1aed37844b878,ethereum:0xdB25f211AB05b1c97D595516F45794528a807ad8` |
| 52 | + - `searchWidth` (query, string, optional) — time range on either side to find price data, defaults to 6 hours Example: `4h` |
| 53 | + |
| 54 | +### GET /prices/historical/{timestamp}/{coins} |
| 55 | +**Base URL:** `https://api.llama.fi` |
| 56 | +Get historical prices of tokens by contract address |
| 57 | + |
| 58 | +**Parameters:** |
| 59 | + - `coins` (path, string, required) — set of comma-separated tokens defined as {chain}:{address} Example: `ethereum:0xdF574c24545E5FfEcb9a659c229253D4111d87e1,coingecko:ethereum,bsc:0x762539b45a1dcce3d36d080f74d1aed37844b878,ethereum:0xdB25f211AB05b1c97D595516F45794528a807ad8` |
| 60 | + - `timestamp` (path, number, required) — UNIX timestamp of time when you want historical prices Example: `1648680149` |
| 61 | + - `searchWidth` (query, string, optional) — time range on either side to find price data, defaults to 6 hours Example: `4h` |
| 62 | + |
| 63 | +### GET /batchHistorical |
| 64 | +**Base URL:** `https://api.llama.fi` |
| 65 | +Get historical prices for multiple tokens at multiple different timestamps |
| 66 | + |
| 67 | +**Parameters:** |
| 68 | + - `coins` (query, string, required) — object where keys are coins in the form {chain}:{address}, and values are arrays of requested timestamps Example: `{"avax:0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e": [1666876743, 1666862343], "coingecko:ethereum": [1666869543, 1666862343]} |
| 69 | +` |
| 70 | + - `searchWidth` (query, string, optional) — time range on either side to find price data, defaults to 6 hours Example: `600` |
| 71 | + |
| 72 | +### GET /chart/{coins} |
| 73 | +**Base URL:** `https://api.llama.fi` |
| 74 | +Get token prices at regular time intervals |
| 75 | + |
| 76 | +**Parameters:** |
| 77 | + - `coins` (path, string, required) — set of comma-separated tokens defined as {chain}:{address} Example: `ethereum:0xdF574c24545E5FfEcb9a659c229253D4111d87e1,coingecko:ethereum,bsc:0x762539b45a1dcce3d36d080f74d1aed37844b878,ethereum:0xdB25f211AB05b1c97D595516F45794528a807ad8` |
| 78 | + - `start` (query, number, optional) — unix timestamp of earliest data point requested Example: `1664364537` |
| 79 | + - `end` (query, number, optional) — unix timestamp of latest data point requested |
| 80 | + - `span` (query, number, optional) — number of data points returned, defaults to 0 Example: `10` |
| 81 | + - `period` (query, string, optional) — duration between data points, defaults to 24 hours Example: `2d` |
| 82 | + - `searchWidth` (query, string, optional) — time range on either side to find price data, defaults to 10% of period Example: `600` |
| 83 | + |
| 84 | +### GET /percentage/{coins} |
| 85 | +**Base URL:** `https://api.llama.fi` |
| 86 | +Get percentage change in price over time |
| 87 | + |
| 88 | +**Parameters:** |
| 89 | + - `coins` (path, string, required) — set of comma-separated tokens defined as {chain}:{address} Example: `ethereum:0xdF574c24545E5FfEcb9a659c229253D4111d87e1,coingecko:ethereum,bsc:0x762539b45a1dcce3d36d080f74d1aed37844b878,ethereum:0xdB25f211AB05b1c97D595516F45794528a807ad8` |
| 90 | + - `timestamp` (query, number, optional) — timestamp of data point requested, defaults to time now Example: `1664364537` |
| 91 | + - `lookForward` (query, boolean, optional) — whether you want the duration after your given timestamp or not, defaults to false (looking back) Example: `false` |
| 92 | + - `period` (query, string, optional) — duration between data points, defaults to 24 hours Example: `3w` |
| 93 | + |
| 94 | +### GET /prices/first/{coins} |
| 95 | +**Base URL:** `https://api.llama.fi` |
| 96 | +Get earliest timestamp price record for coins |
| 97 | + |
| 98 | +**Parameters:** |
| 99 | + - `coins` (path, string, required) — set of comma-separated tokens defined as {chain}:{address} Example: `ethereum:0xdF574c24545E5FfEcb9a659c229253D4111d87e1,coingecko:ethereum,bsc:0x762539b45a1dcce3d36d080f74d1aed37844b878,ethereum:0xdB25f211AB05b1c97D595516F45794528a807ad8` |
| 100 | + |
| 101 | +### GET /block/{chain}/{timestamp} |
| 102 | +**Base URL:** `https://api.llama.fi` |
| 103 | +Get the closest block to a timestamp |
| 104 | + |
| 105 | +**Parameters:** |
| 106 | + - `chain` (path, string, required) — Chain which you want to get the block from Example: `ethereum` |
| 107 | + - `timestamp` (path, integer, required) — UNIX timestamp of the block you are searching for Example: `1603964988` |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## Stablecoins |
| 112 | + |
| 113 | +### GET /stablecoins |
| 114 | +**Base URL:** `https://api.llama.fi` |
| 115 | +List all stablecoins along with their circulating amounts |
| 116 | + |
| 117 | +**Parameters:** |
| 118 | + - `includePrices` (query, boolean, optional) — set whether to include current stablecoin prices Example: `true` |
| 119 | + |
| 120 | +### GET /stablecoincharts/all |
| 121 | +**Base URL:** `https://api.llama.fi` |
| 122 | +Get historical mcap sum of all stablecoins |
| 123 | + |
| 124 | +**Parameters:** |
| 125 | + - `stablecoin` (query, integer, optional) — stablecoin ID, you can get these from /stablecoins Example: `1` |
| 126 | + |
| 127 | +### GET /stablecoincharts/{chain} |
| 128 | +**Base URL:** `https://api.llama.fi` |
| 129 | +Get historical mcap sum of all stablecoins in a chain |
| 130 | + |
| 131 | +**Parameters:** |
| 132 | + - `chain` (path, string, required) — chain slug, you can get these from /chains or the chains property on /protocols Example: `Ethereum` |
| 133 | + - `stablecoin` (query, integer, optional) — stablecoin ID, you can get these from /stablecoins Example: `1` |
| 134 | + |
| 135 | +### GET /stablecoin/{asset} |
| 136 | +**Base URL:** `https://api.llama.fi` |
| 137 | +Get historical mcap and historical chain distribution of a stablecoin |
| 138 | + |
| 139 | +**Parameters:** |
| 140 | + - `asset` (path, integer, required) — stablecoin ID, you can get these from /stablecoins Example: `1` |
| 141 | + |
| 142 | +### GET /stablecoinchains |
| 143 | +**Base URL:** `https://api.llama.fi` |
| 144 | +Get current mcap sum of all stablecoins on each chain |
| 145 | + |
| 146 | +### GET /stablecoinprices |
| 147 | +**Base URL:** `https://api.llama.fi` |
| 148 | +Get historical prices of all stablecoins |
| 149 | + |
| 150 | +--- |
| 151 | + |
| 152 | +## Yields & APY |
| 153 | + |
| 154 | +### GET /pools |
| 155 | +**Base URL:** `https://api.llama.fi` |
| 156 | +Retrieve the latest data for all pools, including enriched information such as predictions |
| 157 | + |
| 158 | +### GET /chart/{pool} |
| 159 | +**Base URL:** `https://api.llama.fi` |
| 160 | +Get historical APY and TVL of a pool |
| 161 | + |
| 162 | +**Parameters:** |
| 163 | + - `pool` (path, string, required) — pool id, can be retrieved from /pools (property is called pool) Example: `747c1d2a-c668-4682-b9f9-296708a3dd90` |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +## DEX Volumes |
| 168 | + |
| 169 | +### GET /overview/dexs |
| 170 | +**Base URL:** `https://api.llama.fi` |
| 171 | +List all dexs along with summaries of their volumes and dataType history data |
| 172 | + |
| 173 | +**Parameters:** |
| 174 | + - `excludeTotalDataChart` (query, boolean, required) — true to exclude aggregated chart from response Example: `true` |
| 175 | + - `excludeTotalDataChartBreakdown` (query, boolean, required) — true to exclude broken down chart from response Example: `true` |
| 176 | + |
| 177 | +### GET /overview/dexs/{chain} |
| 178 | +**Base URL:** `https://api.llama.fi` |
| 179 | +List all dexs along with summaries of their volumes and dataType history data filtering by chain |
| 180 | + |
| 181 | +**Parameters:** |
| 182 | + - `chain` (path, string, required) — chain name, list of all supported chains can be found under allChains attribute in /overview/dexs response Example: `ethereum` |
| 183 | + - `excludeTotalDataChart` (query, boolean, required) — true to exclude aggregated chart from response Example: `true` |
| 184 | + - `excludeTotalDataChartBreakdown` (query, boolean, required) — true to exclude broken down chart from response Example: `true` |
| 185 | + |
| 186 | +### GET /summary/dexs/{protocol} |
| 187 | +**Base URL:** `https://api.llama.fi` |
| 188 | +Get summary of dex volume with historical data |
| 189 | + |
| 190 | +**Parameters:** |
| 191 | + - `protocol` (path, string, required) — protocol slug Example: `uniswap` |
| 192 | + - `excludeTotalDataChart` (query, boolean, required) — true to exclude aggregated chart from response Example: `true` |
| 193 | + - `excludeTotalDataChartBreakdown` (query, boolean, required) — true to exclude broken down chart from response Example: `true` |
| 194 | + |
| 195 | +### GET /overview/options |
| 196 | +**Base URL:** `https://api.llama.fi` |
| 197 | +List all options dexs along with summaries of their volumes and dataType history data |
| 198 | + |
| 199 | +**Parameters:** |
| 200 | + - `excludeTotalDataChart` (query, boolean, required) — true to exclude aggregated chart from response Example: `true` |
| 201 | + - `excludeTotalDataChartBreakdown` (query, boolean, required) — true to exclude broken down chart from response Example: `true` |
| 202 | + - `dataType` (query, string, optional) — Desired data type, dailyNotionalVolume by default. (one of: dailyPremiumVolume, dailyNotionalVolume) Example: `dailyPremiumVolume` |
| 203 | + |
| 204 | +### GET /overview/options/{chain} |
| 205 | +**Base URL:** `https://api.llama.fi` |
| 206 | +List all options dexs along with summaries of their volumes and dataType history data filtering by chain |
| 207 | + |
| 208 | +**Parameters:** |
| 209 | + - `chain` (path, string, required) — chain name, list of all supported chains can be found under allChains attribute in /overview/options response Example: `ethereum` |
| 210 | + - `excludeTotalDataChart` (query, boolean, required) — true to exclude aggregated chart from response Example: `true` |
| 211 | + - `excludeTotalDataChartBreakdown` (query, boolean, required) — true to exclude broken down chart from response Example: `true` |
| 212 | + - `dataType` (query, string, optional) — Desired data type, dailyNotionalVolume by default. (one of: dailyPremiumVolume, dailyNotionalVolume) Example: `dailyPremiumVolume` |
| 213 | + |
| 214 | +### GET /summary/options/{protocol} |
| 215 | +**Base URL:** `https://api.llama.fi` |
| 216 | +Get summary of options dex volume with historical data |
| 217 | + |
| 218 | +**Parameters:** |
| 219 | + - `protocol` (path, string, required) — protocol slug Example: `derive` |
| 220 | + - `dataType` (query, string, optional) — Desired data type, dailyNotionalVolume by default. (one of: dailyPremiumVolume, dailyNotionalVolume) Example: `dailyPremiumVolume` |
| 221 | + |
| 222 | +--- |
| 223 | + |
| 224 | +## Perpetuals & Open Interest |
| 225 | + |
| 226 | +### GET /overview/open-interest |
| 227 | +**Base URL:** `https://api.llama.fi` |
| 228 | +List all open interest dex exchanges along with summaries of their open interest |
| 229 | + |
| 230 | +**Parameters:** |
| 231 | + - `excludeTotalDataChart` (query, boolean, required) — true to exclude aggregated chart from response Example: `true` |
| 232 | + - `excludeTotalDataChartBreakdown` (query, boolean, required) — true to exclude broken down chart from response Example: `true` |
| 233 | + |
| 234 | +--- |
| 235 | + |
| 236 | +## Fees & Revenue |
| 237 | + |
| 238 | +### GET /overview/fees |
| 239 | +**Base URL:** `https://api.llama.fi` |
| 240 | +List all protocols along with summaries of their fees and revenue and dataType history data |
| 241 | + |
| 242 | +**Parameters:** |
| 243 | + - `excludeTotalDataChart` (query, boolean, required) — true to exclude aggregated chart from response Example: `true` |
| 244 | + - `excludeTotalDataChartBreakdown` (query, boolean, required) — true to exclude broken down chart from response Example: `true` |
| 245 | + - `dataType` (query, string, optional) — Desired data type, dailyFees by default. (one of: dailyFees, dailyRevenue, dailyHoldersRevenue) Example: `dailyFees` |
| 246 | + |
| 247 | +### GET /overview/fees/{chain} |
| 248 | +**Base URL:** `https://api.llama.fi` |
| 249 | +List all protocols along with summaries of their fees and revenue and dataType history data by chain |
| 250 | + |
| 251 | +**Parameters:** |
| 252 | + - `chain` (path, string, required) — chain name, list of all supported chains can be found under allChains attribute in /overview/fees response Example: `ethereum` |
| 253 | + - `excludeTotalDataChart` (query, boolean, required) — true to exclude aggregated chart from response Example: `true` |
| 254 | + - `excludeTotalDataChartBreakdown` (query, boolean, required) — true to exclude broken down chart from response Example: `true` |
| 255 | + - `dataType` (query, string, optional) — Desired data type, dailyFees by default. (one of: dailyFees, dailyRevenue, dailyHoldersRevenue) Example: `dailyFees` |
| 256 | + |
| 257 | +### GET /summary/fees/{protocol} |
| 258 | +**Base URL:** `https://api.llama.fi` |
| 259 | +Get summary of protocol fees and revenue with historical data |
| 260 | + |
| 261 | +**Parameters:** |
| 262 | + - `protocol` (path, string, required) — protocol slug Example: `derive` |
| 263 | + - `dataType` (query, string, optional) — Desired data type, dailyFees by default. (one of: dailyFees, dailyRevenue, dailyHoldersRevenue) Example: `dailyFees` |
0 commit comments