diff --git a/defillama-openapi-free.json b/defillama-openapi-free.json index 24907dc94cd..078528bcd2c 100644 --- a/defillama-openapi-free.json +++ b/defillama-openapi-free.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "description": "> [!WARNING]\n> The free yield endpoints `/pools` and `/chart/{pool}` are deprecated and will shut down soon. The same data remains available on the [API plan](https://defillama.com/subscription) at `/yields/v1/pools` and `/yields/v1/chart/{pool}`.\n\n## Using AI?\n\nDefiLlama offers two ways to use our data with AI:\n\n| Resource | For | Description |\n|---|---|---|\n| llms.txt | AI assistants (ChatGPT, Claude, Cursor, etc.) | Paste this link into your AI assistant for LLM-optimized docs |\n| MCP Server | AI agents | Connect your agent directly to DefiLlama data — 23 tools, requires an API plan |\n\n**Quick start (MCP)** — paste this into your AI agent:\n```\nRead https://raw.githubusercontent.com/DefiLlama/defillama-skills/refs/heads/master/defillama-setup/SKILL.md and follow the instructions to connect to DefiLlama MCP\n```\n\n---\n\n## Authentication\n\nThe free API needs no key. If you have an API plan, use `https://pro-api.llama.fi/{YOUR_API_KEY}/...` with the key between the base URL and the endpoint. Do NOT send the key as a query parameter (`?apikey=`) or header.\n\nA 200 from `/protocols` or `/overview/fees` here does not validate your API key. Those endpoints require no authentication. A 402 here does not prove your subscription expired. It means the endpoint needs an API plan. There are only two tiers: free (no key) and the API plan. One API plan key unlocks every Pro endpoint. There are no add-ons or separate keys for volumes, derivatives, or other data.\n\nTo check that your key works, call `https://pro-api.llama.fi/usage/{YOUR_API_KEY}` (key at the end, for this endpoint only). It returns your remaining credits, like `{\"creditsLeft\": 1000000}`.\n\nNeed higher rate limits or priority support? We offer a premium plan for 300$/mo. To get it, go to https://defillama.com/subscription\n\n## SDK\n\n**JavaScript** — `npm install @defillama/api` — [GitHub](https://github.com/DefiLlama/api-sdk)\n\n**Python** — `pip install defillama-sdk` — [GitHub](https://github.com/DefiLlama/python-sdk)\n\nQuick start (JavaScript):\n```ts\nimport { DefiLlama } from '@defillama/api'\n\nconst client = new DefiLlama()\nconst protocols = await client.tvl.getProtocols()\n```\n\nQuick start (Python):\n```py\nfrom defillama_sdk import DefiLlama\n\nclient = DefiLlama()\nprotocols = client.tvl.getProtocols()\n```", + "description": "> [!WARNING]\n> The free yield endpoints `/pools` and `/chart/{pool}` are deprecated and will shut down soon. The same data remains available on the [API plan](https://defillama.com/subscription) at `/yields/v1/pools` and `/yields/v1/chart/{pool}`.\n\n## Using AI?\n\nDefiLlama offers two ways to use our data with AI:\n\n| Resource | For | Description |\n|---|---|---|\n| llms.txt | AI assistants (ChatGPT, Claude, Cursor, etc.) | Paste this link into your AI assistant for LLM-optimized docs |\n| MCP Server | AI agents | Connect your agent directly to DefiLlama data — 23 tools, requires an API plan |\n\n**Quick start (MCP)** — paste this into your AI agent:\n```\nRead https://raw.githubusercontent.com/DefiLlama/defillama-skills/refs/heads/master/defillama-setup/SKILL.md and follow the instructions to connect to DefiLlama MCP\n```\n\n---\n\n## Authentication\n\nThe free API needs no key. **Have an API key? Send every request to `https://pro-api.llama.fi/{YOUR_API_KEY}/...`, including the endpoints on this page.** The free hosts (api.llama.fi, coins.llama.fi, stablecoins.llama.fi, yields.llama.fi) never read a key, so requests there are free tier and rate limited, even for paying users. Put the key between the base URL and the endpoint, and add the pro path prefix (`/protocols` becomes `/api/protocols`, `/prices/current/{coins}` becomes `/coins/prices/current/{coins}`). Do NOT send the key as a query parameter (`?apikey=`) or header.\n\nA 200 from `/protocols` or `/overview/fees` here does not validate your API key. Those endpoints require no authentication. A 402 here does not prove your subscription expired. It means the endpoint needs an API plan. There are only two tiers: free (no key) and the API plan. One API plan key unlocks every Pro endpoint. There are no add-ons or separate keys for volumes, derivatives, or other data.\n\nTo check that your key works, call `https://pro-api.llama.fi/usage/{YOUR_API_KEY}` (key at the end, for this endpoint only). It returns your remaining credits, like `{\"creditsLeft\": 1000000}`.\n\nNeed higher rate limits or priority support? We offer a premium plan for 300$/mo. To get it, go to https://defillama.com/subscription\n\n## SDK\n\n**JavaScript** — `npm install @defillama/api` — [GitHub](https://github.com/DefiLlama/api-sdk)\n\n**Python** — `pip install defillama-sdk` — [GitHub](https://github.com/DefiLlama/python-sdk)\n\nQuick start (JavaScript):\n```ts\nimport { DefiLlama } from '@defillama/api'\n\nconst client = new DefiLlama()\nconst protocols = await client.tvl.getProtocols()\n```\n\nQuick start (Python):\n```py\nfrom defillama_sdk import DefiLlama\n\nclient = DefiLlama()\nprotocols = client.tvl.getProtocols()\n```", "version": "1.0.0-oas3", "title": "DefiLlama API", "x-scalar-sdk-installation": [ @@ -58,6 +58,7 @@ "get": { "tags": ["TVL"], "summary": "List all protocols on defillama along with their tvl", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/protocols` instead. This host does not read keys and is rate limited.", "responses": { "200": { "description": "Array of all protocols with their TVL data", @@ -141,6 +142,7 @@ "get": { "tags": ["TVL"], "summary": "Get historical TVL of a protocol and breakdowns by token and chain", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/protocol/{protocol}` instead. This host does not read keys and is rate limited.", "parameters": [ { "name": "protocol", @@ -268,6 +270,7 @@ "get": { "tags": ["TVL"], "summary": "Get historical TVL (excludes liquid staking and double counted tvl) of DeFi on all chains", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/v2/historicalChainTvl` instead. This host does not read keys and is rate limited.", "responses": { "200": { "description": "Historical TVL data for all chains combined", @@ -313,6 +316,7 @@ "get": { "tags": ["TVL"], "summary": "Get historical TVL (excludes liquid staking and double counted tvl) of a chain", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/v2/historicalChainTvl/{chain}` instead. This host does not read keys and is rate limited.", "parameters": [ { "name": "chain", @@ -373,7 +377,7 @@ "get": { "tags": ["TVL"], "summary": "Simplified endpoint to get current TVL of a protocol", - "description": "Simplified endpoint that only returns a number, the current TVL of a protocol", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/tvl/{protocol}` instead. This host does not read keys and is rate limited.\n\nSimplified endpoint that only returns a number, the current TVL of a protocol", "parameters": [ { "name": "protocol", @@ -421,6 +425,7 @@ "get": { "tags": ["TVL"], "summary": "Get current TVL of all chains", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/v2/chains` instead. This host does not read keys and is rate limited.", "responses": { "200": { "description": "Array of all chains with their TVL data", @@ -490,7 +495,7 @@ "get": { "tags": ["coins"], "summary": "Get current prices of tokens by contract address", - "description": "The goal of this API is to price as many tokens as possible, including exotic ones that never get traded, which makes them impossible to price by looking at markets.\n\nThe base of our data are prices pulled from coingecko, which is then extended through multiple means:\n- We price all bridged tokens by using the price of the token in it's original chain, so we fetch all bridged versions of USDC on arbitrum, fantom, avax... and price all them using the price for the token on Ethereum, which we know. Right now we support 10 different bridging protocols.\n- We have multiple adapters to price specialized sets of tokens by running custom code:\n - We price yearn's yToken LPs by checking how much underlying token can be withdrawn for each LP\n - Aave, compound and euler LP tokens are also priced based on their relationship against underlying tokens\n - Uniswap, curve, balancer and stargate LPs are priced using the underlying tokens in each pair\n - GMX's GLP token is priced based on the value of tokens given on withdrawal (which includes calculations based on trader's PnL)\n \n - Synthetix tokens are priced using forex prices of the coin they are pegged to\n- For tokens that we haven't been able to price in any other way, we find the pool with most liquidity for each on uniswap, curve and serum and then use the prices provided on those exchanges.\n \n Unlike all the other tokens, we can't confirm that these prices are correct, so we only ingest the ones that have sufficient liquidity and, even in that case, we attach a `confidence` value to them that is related to the depth of liquidity and which represents our confidence in the quality of each price. API consumers can choose to filter out prices with low confidence values.\n \n Our API server is fully open source and we are constantly adding more pricing adapters, extending the amount of tokens we support.\n \nTokens are queried using {chain}:{address}, where chain is an identifier such as ethereum, bsc, polygon, avax... You can also get tokens by coingecko id by setting `coingecko` as the chain, eg: coingecko:ethereum, coingecko:bitcoin. Examples:\n - ethereum:0xdF574c24545E5FfEcb9a659c229253D4111d87e1\n - bsc:0x762539b45a1dcce3d36d080f74d1aed37844b878\n - coingecko:ethereum\n - arbitrum:0x4277f8f2c384827b5273592ff7cebd9f2c1ac258\n", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/coins/prices/current/{coins}` instead. This host does not read keys and is rate limited.\n\nThe goal of this API is to price as many tokens as possible, including exotic ones that never get traded, which makes them impossible to price by looking at markets.\n\nThe base of our data are prices pulled from coingecko, which is then extended through multiple means:\n- We price all bridged tokens by using the price of the token in it's original chain, so we fetch all bridged versions of USDC on arbitrum, fantom, avax... and price all them using the price for the token on Ethereum, which we know. Right now we support 10 different bridging protocols.\n- We have multiple adapters to price specialized sets of tokens by running custom code:\n - We price yearn's yToken LPs by checking how much underlying token can be withdrawn for each LP\n - Aave, compound and euler LP tokens are also priced based on their relationship against underlying tokens\n - Uniswap, curve, balancer and stargate LPs are priced using the underlying tokens in each pair\n - GMX's GLP token is priced based on the value of tokens given on withdrawal (which includes calculations based on trader's PnL)\n \n - Synthetix tokens are priced using forex prices of the coin they are pegged to\n- For tokens that we haven't been able to price in any other way, we find the pool with most liquidity for each on uniswap, curve and serum and then use the prices provided on those exchanges.\n \n Unlike all the other tokens, we can't confirm that these prices are correct, so we only ingest the ones that have sufficient liquidity and, even in that case, we attach a `confidence` value to them that is related to the depth of liquidity and which represents our confidence in the quality of each price. API consumers can choose to filter out prices with low confidence values.\n \n Our API server is fully open source and we are constantly adding more pricing adapters, extending the amount of tokens we support.\n \nTokens are queried using {chain}:{address}, where chain is an identifier such as ethereum, bsc, polygon, avax... You can also get tokens by coingecko id by setting `coingecko` as the chain, eg: coingecko:ethereum, coingecko:bitcoin. Examples:\n - ethereum:0xdF574c24545E5FfEcb9a659c229253D4111d87e1\n - bsc:0x762539b45a1dcce3d36d080f74d1aed37844b878\n - coingecko:ethereum\n - arbitrum:0x4277f8f2c384827b5273592ff7cebd9f2c1ac258\n", "servers": [ { "url": "https://coins.llama.fi" @@ -576,7 +581,7 @@ "get": { "tags": ["coins"], "summary": "Get historical prices of tokens by contract address", - "description": "See /prices/current for explanation on how prices are sourced.", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/coins/prices/historical/{timestamp}/{coins}` instead. This host does not read keys and is rate limited.\n\nSee /prices/current for explanation on how prices are sourced.", "servers": [ { "url": "https://coins.llama.fi" @@ -672,6 +677,7 @@ "get": { "tags": ["coins"], "summary": "Get historical prices for multiple tokens at multiple different timestamps", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/coins/batchHistorical` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://coins.llama.fi" @@ -758,7 +764,7 @@ "get": { "tags": ["coins"], "summary": "Get token prices at regular time intervals", - "description": "Strings accepted by period:\nCan use regular chart candle notion like ‘4h’ etc where:\nW = week, D = day, H = hour, M = minute (not case sensitive)\n", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/coins/chart/{coins}` instead. This host does not read keys and is rate limited.\n\nStrings accepted by period:\nCan use regular chart candle notion like ‘4h’ etc where:\nW = week, D = day, H = hour, M = minute (not case sensitive)\n", "servers": [ { "url": "https://coins.llama.fi" @@ -892,7 +898,7 @@ "get": { "tags": ["coins"], "summary": "Get percentage change in price over time", - "description": "Strings accepted by period:\nCan use regular chart candle notion like ‘4h’ etc where:\nW = week, D = day, H = hour, M = minute (not case sensitive)\n", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/coins/percentage/{coins}` instead. This host does not read keys and is rate limited.\n\nStrings accepted by period:\nCan use regular chart candle notion like ‘4h’ etc where:\nW = week, D = day, H = hour, M = minute (not case sensitive)\n", "servers": [ { "url": "https://coins.llama.fi" @@ -984,6 +990,7 @@ "get": { "tags": ["coins"], "summary": "Get earliest timestamp price record for coins", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/coins/prices/first/{coins}` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://coins.llama.fi" @@ -1058,7 +1065,7 @@ "get": { "tags": ["coins"], "summary": "Get the closest block to a timestamp", - "description": "Runs binary search over a blockchain's blocks to get the closest one to a timestamp.\nEvery time this is run we add new data to our database, so each query permanently speeds up future queries.\n", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/coins/block/{chain}/{timestamp}` instead. This host does not read keys and is rate limited.\n\nRuns binary search over a blockchain's blocks to get the closest one to a timestamp.\nEvery time this is run we add new data to our database, so each query permanently speeds up future queries.\n", "servers": [ { "url": "https://coins.llama.fi" @@ -1131,6 +1138,7 @@ "get": { "tags": ["stablecoins"], "summary": "List all stablecoins along with their circulating amounts", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/stablecoins/stablecoins` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://stablecoins.llama.fi" @@ -1246,6 +1254,7 @@ "get": { "tags": ["stablecoins"], "summary": "Get historical mcap sum of all stablecoins", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/stablecoins/stablecoincharts/all` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://stablecoins.llama.fi" @@ -1312,6 +1321,7 @@ "get": { "tags": ["stablecoins"], "summary": "Get historical mcap sum of all stablecoins in a chain", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/stablecoins/stablecoincharts/{chain}` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://stablecoins.llama.fi" @@ -1388,6 +1398,7 @@ "get": { "tags": ["stablecoins"], "summary": "Get historical mcap and historical chain distribution of a stablecoin", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/stablecoins/stablecoin/{asset}` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://stablecoins.llama.fi" @@ -1484,6 +1495,7 @@ "get": { "tags": ["stablecoins"], "summary": "Get current mcap sum of all stablecoins on each chain", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/stablecoins/stablecoinchains` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://stablecoins.llama.fi" @@ -1538,6 +1550,7 @@ "get": { "tags": ["stablecoins"], "summary": "Get historical prices of all stablecoins", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/stablecoins/stablecoinprices` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://stablecoins.llama.fi" @@ -1594,7 +1607,7 @@ "tags": ["yields"], "summary": "Retrieve the latest data for all pools, including enriched information such as predictions", "deprecated": true, - "description": "**This endpoint is deprecated and will shut down soon.** The same data remains available at `/yields/v1/pools` on the [API plan](https://defillama.com/subscription).", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/yields/v1/pools` instead. This host does not read keys and is rate limited.\n\n**This endpoint is deprecated and will shut down soon.** The same data remains available at `/yields/v1/pools` on the [API plan](https://defillama.com/subscription).", "servers": [ { "url": "https://yields.llama.fi" @@ -1776,7 +1789,7 @@ "tags": ["yields"], "summary": "Get historical APY and TVL of a pool", "deprecated": true, - "description": "**This endpoint is deprecated and will shut down soon.** The same data remains available at `/yields/v1/chart/{pool}` on the [API plan](https://defillama.com/subscription).", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/yields/v1/chart/{pool}` instead. This host does not read keys and is rate limited.\n\n**This endpoint is deprecated and will shut down soon.** The same data remains available at `/yields/v1/chart/{pool}` on the [API plan](https://defillama.com/subscription).", "servers": [ { "url": "https://yields.llama.fi" @@ -1858,6 +1871,7 @@ "get": { "tags": ["volumes"], "summary": "List all dexs along with summaries of their volumes and dataType history data", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/overview/dexs` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://api.llama.fi" @@ -1981,6 +1995,7 @@ "get": { "tags": ["volumes"], "summary": "List all dexs along with summaries of their volumes and dataType history data filtering by chain", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/overview/dexs/{chain}` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://api.llama.fi" @@ -2078,6 +2093,7 @@ "get": { "tags": ["volumes"], "summary": "Get summary of dex volume with historical data", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/summary/dexs/{protocol}` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://api.llama.fi" @@ -2186,6 +2202,7 @@ "get": { "tags": ["volumes"], "summary": "List all options dexs along with summaries of their volumes and dataType history data", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/overview/options` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://api.llama.fi" @@ -2284,6 +2301,7 @@ "get": { "tags": ["volumes"], "summary": "List all options dexs along with summaries of their volumes and dataType history data filtering by chain", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/overview/options/{chain}` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://api.llama.fi" @@ -2623,6 +2641,7 @@ "get": { "tags": ["volumes"], "summary": "Get summary of options dex volume with historical data", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/summary/options/{protocol}` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://api.llama.fi" @@ -2903,6 +2922,7 @@ "get": { "tags": ["perps"], "summary": "List all open interest dex exchanges along with summaries of their open interest", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/overview/open-interest` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://api.llama.fi" @@ -3014,6 +3034,7 @@ "get": { "tags": ["fees and revenue"], "summary": "List all protocols along with summaries of their fees and revenue and dataType history data", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/overview/fees` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://api.llama.fi" @@ -3132,6 +3153,7 @@ "get": { "tags": ["fees and revenue"], "summary": "List all protocols along with summaries of their fees and revenue and dataType history data by chain", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/overview/fees/{chain}` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://api.llama.fi" @@ -3260,6 +3282,7 @@ "get": { "tags": ["fees and revenue"], "summary": "Get summary of protocol fees and revenue with historical data", + "description": "**With an API key:** use `https://pro-api.llama.fi/{YOUR_API_KEY}/api/summary/fees/{protocol}` instead. This host does not read keys and is rate limited.", "servers": [ { "url": "https://api.llama.fi" diff --git a/examples/web/index.html b/examples/web/index.html index b9441ed33af..a5712a751ee 100644 --- a/examples/web/index.html +++ b/examples/web/index.html @@ -66,8 +66,16 @@
Explore free and Pro API endpoints for DeFi data.
- Free API endpoints ·
- Pro API endpoints
+ Have an API key? Send every request to
+ https://pro-api.llama.fi/YOUR_API_KEY/…, including
+ prices, TVL, stablecoins and yields. The free hosts (api.llama.fi,
+ coins.llama.fi, stablecoins.llama.fi, yields.llama.fi) never read a
+ key and are rate limited.
+
+ Overview for AI agents · + API endpoints with a key · + Free API endpoints (no key)
diff --git a/examples/web/src/components/ApiKeyInput.vue b/examples/web/src/components/ApiKeyInput.vue index 789d2e63f70..a0118e9f071 100644 --- a/examples/web/src/components/ApiKeyInput.vue +++ b/examples/web/src/components/ApiKeyInput.vue @@ -94,7 +94,7 @@ const switchToFreeApi = () => {