From 8eb9d0cb3e010e29ae2b7e74fb767fce9cf97ffc Mon Sep 17 00:00:00 2001 From: mintdart <96025197+mintdart@users.noreply.github.com> Date: Wed, 25 Feb 2026 00:07:03 -0800 Subject: [PATCH 1/2] feat: add v2 TVL and Treasury protocol endpoints Add 8 new pro-only v2 endpoints for protocol TVL and treasury data: TVL (tag: TVL): - GET /api/v2/metrics/tvl/protocol/{protocol} - GET /api/v2/chart/tvl/protocol/{protocol} - GET /api/v2/chart/tvl/protocol/{protocol}/chain-breakdown - GET /api/v2/chart/tvl/protocol/{protocol}/token-breakdown Treasury (tag: Treasury): - GET /api/v2/metrics/treasury/protocol/{protocol} - GET /api/v2/chart/treasury/protocol/{protocol} - GET /api/v2/chart/treasury/protocol/{protocol}/chain-breakdown - GET /api/v2/chart/treasury/protocol/{protocol}/token-breakdown Key details: - All endpoints marked x-api-plan-only (pro users only) - TVL key param: all, staking, borrowed, vesting, pool2 - Treasury key param: OwnTokens, all - currency=tokens on token-breakdown endpoints only - Full IProtocolMetricsV2 schema with real Aave examples - New "Treasury" tag added to pro spec - llms.txt updated with accurate docs and usage examples Co-authored-by: Cursor --- defillama-openapi-pro.json | 1024 ++++++++++++++++++++++++++++++++++++ llms.txt | 151 ++++++ 2 files changed, 1175 insertions(+) diff --git a/defillama-openapi-pro.json b/defillama-openapi-pro.json index c5948d7d456..b86a799973a 100644 --- a/defillama-openapi-pro.json +++ b/defillama-openapi-pro.json @@ -32,6 +32,10 @@ "name": "TVL", "description": "Retrieve TVL data - pro" }, + { + "name": "Treasury", + "description": "Retrieve protocol treasury data" + }, { "name": "stablecoins", "description": "Data from our stablecoins dashboard - pro" @@ -5533,6 +5537,1026 @@ ] } }, + "/api/v2/metrics/tvl/protocol/{protocol}": { + "get": { + "tags": ["TVL"], + "x-api-plan-only": true, + "summary": "Get aggregate TVL metrics for a protocol", + "description": "Returns protocol metadata along with current TVL figures, chain breakdowns, and other aggregate metrics.", + "parameters": [ + { + "name": "protocol", + "in": "path", + "required": true, + "description": "protocol slug", + "schema": { + "type": "string", + "example": "aave" + } + } + ], + "responses": { + "200": { + "description": "Protocol TVL metrics", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "parent#aave" + }, + "name": { + "type": "string", + "example": "Aave" + }, + "address": { + "type": "string", + "nullable": true, + "example": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9" + }, + "symbol": { + "type": "string", + "nullable": true, + "example": "AAVE" + }, + "url": { + "type": "string", + "example": "https://aave.com" + }, + "referralUrl": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "example": "Aave is an Open Source and Non-Custodial protocol to earn interest on deposits & borrow assets" + }, + "chain": { + "type": "string", + "example": "Multi-Chain" + }, + "logo": { + "type": "string", + "example": "https://icons.llama.fi/aave.png" + }, + "audits": { + "type": "string", + "nullable": true + }, + "audit_note": { + "type": "string", + "nullable": true + }, + "gecko_id": { + "type": "string", + "nullable": true, + "example": "aave" + }, + "cmcId": { + "type": "string", + "nullable": true, + "example": "7278" + }, + "category": { + "type": "string", + "example": "Lending" + }, + "tags": { + "type": "array", + "nullable": true, + "items": { "type": "string" } + }, + "chains": { + "type": "array", + "items": { "type": "string" }, + "example": ["Ethereum", "Polygon", "Avalanche"] + }, + "module": { + "type": "string", + "nullable": true + }, + "treasury": { + "type": "string", + "nullable": true + }, + "twitter": { + "type": "string", + "example": "AaveAave" + }, + "audit_links": { + "type": "array", + "items": { "type": "string" } + }, + "openSource": { + "type": "boolean" + }, + "forkedFrom": { + "type": "array", + "items": { "type": "string" } + }, + "oraclesByChain": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { "type": "string" } + }, + "example": { "Ethereum": ["Chainlink"], "Polygon": ["Chainlink"] } + }, + "parentProtocol": { + "type": "string" + }, + "governanceID": { + "type": "array", + "items": { "type": "string" } + }, + "github": { + "type": "array", + "items": { "type": "string" } + }, + "currentChainTvls": { + "type": "object", + "additionalProperties": { "type": "number" }, + "example": { "Ethereum": 3200000000, "Polygon": 1500000000 } + }, + "isParentProtocol": { + "type": "boolean" + }, + "mcap": { + "type": "number", + "nullable": true, + "example": 2400000000 + }, + "methodology": { + "type": "string", + "nullable": true + }, + "raises": { + "type": "array", + "items": { + "type": "object", + "properties": { + "round": { "type": "string", "example": "Series A" }, + "amount": { "type": "number", "example": 25000000 }, + "valuation": { "type": "string" }, + "source": { "type": "string" }, + "date": { "type": "number", "example": 1601510400 }, + "defillamaId": { "type": "string" }, + "leadInvestors": { "type": "array", "items": { "type": "string" } }, + "otherInvestors": { "type": "array", "items": { "type": "string" } }, + "investors": { "type": "array", "items": { "type": "string" } } + } + } + }, + "otherProtocols": { + "type": "array", + "items": { "type": "string" } + }, + "hallmarks": { + "type": "array", + "description": "Notable events in the protocol's history as [timestamp, description] pairs", + "items": { + "type": "array" + } + }, + "stablecoins": { + "type": "array", + "items": { "type": "string" } + }, + "misrepresentedTokens": { + "type": "boolean" + }, + "deprecated": { + "type": "boolean" + }, + "rugged": { + "type": "boolean" + }, + "deadUrl": { + "type": "boolean" + }, + "warningBanners": { + "type": "array", + "items": { + "type": "object", + "properties": { + "message": { "type": "string" }, + "until": { "type": "string", "nullable": true }, + "level": { "type": "string", "enum": ["low", "alert", "rug"] } + } + } + }, + "tokenRights": { + "type": "object", + "description": "Token governance and value accrual rights" + }, + "wrongLiquidity": { + "type": "boolean" + }, + "tvlCodePath": { + "type": "string", + "description": "Path to the TVL adapter source code" + } + }, + "example": { + "id": "parent#aave", + "name": "Aave", + "url": "https://aave.com", + "description": "Aave is an Open Source and Non-Custodial protocol to earn interest on deposits and borrow assets", + "logo": "https://icons.llama.fi/aave.png", + "chains": [], + "gecko_id": "aave", + "cmcId": "7278", + "treasury": "aave.js", + "twitter": "aave", + "governanceID": ["snapshot:aave.eth", "eip155:1:0xEC568fffba86c094cf06b22134B23074DFE2252c"], + "wrongLiquidity": true, + "github": ["aave", "bgd-labs"], + "stablecoins": ["gho"], + "tokenRights": { + "rights": [ + { "label": "Governance", "hasRight": true, "details": "AAVE" }, + { "label": "Treasury", "hasRight": true, "details": "AAVE" }, + { "label": "Revenue", "hasRight": true, "details": "AAVE" } + ], + "governanceData": { + "rights": "LIMITED", + "details": "Governance includes protocol parameters, treasury management, upgrades & onchain revenue", + "feeSwitchStatus": "ON", + "feeSwitchDetails": "$50m annual budget for token buybacks" + }, + "holdersRevenueAndValueAccrual": { + "buybacks": "ACTIVE", + "dividends": "NONE", + "burns": "NONE", + "primaryValueAccrual": "Buybacks - $50M yearly budget for buybacks" + }, + "tokenAlignment": { + "fundraising": "TOKEN", + "raiseDetailsLink": { + "label": "Strategic Round (Decrypt)", + "url": "https://decrypt.co/44653/aave-raises-25-million-to-bring-defi-to-institutions" + }, + "associatedEntities": ["DAO", "Labs", "Parent / Holdings Co"], + "equityRevenueCapture": "PARTIAL", + "equityStatement": "Labs owns the interface and offchain revenue" + } + }, + "symbol": "AAVE", + "address": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", + "currentChainTvls": { + "Ethereum-staking": 300390294, + "Ethereum-pool2": 1001784, + "Avalanche-borrowed": 230805193, + "Ethereum": 21541108640, + "Ethereum-borrowed": 13105470847, + "Polygon": 164069009, + "Avalanche": 425186004, + "Polygon-borrowed": 71777370, + "staking": 300390294, + "pool2": 1001784, + "borrowed": 16477546481, + "Base": 720897079, + "Base-borrowed": 539408955, + "Arbitrum": 710909114, + "Arbitrum-borrowed": 493502165, + "OP Mainnet": 53112825, + "OP Mainnet-borrowed": 30898499, + "Gnosis": 67454440, + "Gnosis-borrowed": 28683972, + "Mantle": 285136854, + "Mantle-borrowed": 186143806, + "Plasma": 1958242285, + "Plasma-borrowed": 1655750534, + "BSC": 174954075, + "BSC-borrowed": 70470380, + "Linea": 49717184, + "Linea-borrowed": 38569924, + "Sonic": 12939987, + "Sonic-borrowed": 5315322, + "Scroll": 6971724, + "Scroll-borrowed": 5290161, + "ZKsync Era": 2782917, + "ZKsync Era-borrowed": 1245328, + "Soneium": 2038301, + "Soneium-borrowed": 292179, + "Metis": 959354, + "Metis-borrowed": 159370, + "Celo": 13373563, + "Celo-borrowed": 4923675, + "MegaETH": 19380664, + "MegaETH-borrowed": 34443, + "Aptos": 18649107, + "Aptos-borrowed": 8493938, + "Fantom": 4575, + "Fantom-borrowed": 1034, + "Harmony": 0, + "Harmony-borrowed": 309375 + }, + "isParentProtocol": true, + "raises": [ + { + "date": 1594771200, + "name": "Aave", + "round": "Private token sale", + "amount": 3, + "source": "https://www.dcforecasts.com/altcoin-news/aave-raises-3m-from-three-arrows-capital-and-framework-ventures/", + "leadInvestors": ["Framework Ventures", "3AC"], + "otherInvestors": [], + "valuation": null, + "defillamaId": "111" + }, + { + "date": 1602460800, + "name": "Aave", + "round": "Strategic ", + "amount": 25, + "source": "https://decrypt.co/44653/aave-raises-25-million-to-bring-defi-to-institutions", + "leadInvestors": ["Blockchain Capital", "Blockchain.com Ventures", "Standard Crypto"], + "otherInvestors": [], + "valuation": null, + "defillamaId": "111" + }, + { + "date": 1594166400, + "name": "Aave", + "round": "Private token sale", + "amount": 4.5, + "source": "https://decrypt.co/34991/parafi-invests-defi-lending-protocol", + "leadInvestors": ["ParaFi Capital"], + "otherInvestors": [], + "valuation": null, + "defillamaId": "111" + }, + { + "date": 1512000000, + "name": "Aave", + "round": "ICO", + "amount": 16.2, + "source": "https://twitter.com/aaveaave/status/936247348816175104", + "leadInvestors": [], + "otherInvestors": [], + "valuation": null, + "defillamaId": "1838" + } + ], + "mcap": 1775192426.0010407, + "otherProtocols": [ + "Aave", + "Aave V3", + "Aave Horizon RWA", + "Aave V2", + "Aave Aptos", + "Aave V1", + "Aave Arc" + ], + "hallmarks": [ + [1619395200, "Start Ethereum V2 Rewards"], + [1633305600, "Start AVAX V2 Rewards"], + [1635292800, "Potential xSUSHI attack found"], + [1650412800, "Start AVAX Rewards"], + [1651881600, "UST depeg"], + [1654819200, "stETH depeg"], + [1659571200, "Start OP Rewards"] + ] + } + } + } + } + }, + "404": { + "description": "Protocol not found" + } + } + } + }, + "/api/v2/chart/tvl/protocol/{protocol}": { + "get": { + "tags": ["TVL"], + "x-api-plan-only": true, + "summary": "Get historical TVL chart for a protocol", + "description": "Returns an array of [timestamp, value] pairs representing the protocol's TVL over time. By default returns the base TVL metric. Use the `key` parameter to select a different metric or aggregate all metrics.", + "parameters": [ + { + "name": "protocol", + "in": "path", + "required": true, + "description": "protocol slug", + "schema": { + "type": "string", + "example": "uniswap" + } + }, + { + "name": "key", + "in": "query", + "required": false, + "description": "Metric to return. Omit for default TVL. Use \"all\" for the sum of tvl+borrowed+staking+pool2+vesting, or a specific metric like \"staking\", \"borrowed\", \"vesting\", \"pool2\".", + "schema": { + "type": "string", + "enum": ["all", "staking", "borrowed", "vesting", "pool2"], + "example": "all" + } + } + ], + "responses": { + "200": { + "description": "Array of [timestamp, value] pairs", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "array", + "items": { "type": "number" }, + "minItems": 2, + "maxItems": 2, + "example": [1609459200, 5200000000] + } + } + } + } + }, + "404": { + "description": "Protocol not found" + } + } + } + }, + "/api/v2/chart/tvl/protocol/{protocol}/chain-breakdown": { + "get": { + "tags": ["TVL"], + "x-api-plan-only": true, + "summary": "Get historical TVL chart for a protocol broken down by chain", + "description": "Returns an array of [timestamp, { chain: value }] pairs showing the selected metric per chain over time.", + "parameters": [ + { + "name": "protocol", + "in": "path", + "required": true, + "description": "protocol slug", + "schema": { + "type": "string", + "example": "euler" + } + }, + { + "name": "key", + "in": "query", + "required": false, + "description": "Metric to return. Omit for default TVL. Use \"all\" for the sum of tvl+borrowed+staking+pool2+vesting, or a specific metric like \"staking\", \"borrowed\", \"vesting\", \"pool2\".", + "schema": { + "type": "string", + "enum": ["all", "staking", "borrowed", "vesting", "pool2"], + "example": "borrowed" + } + } + ], + "responses": { + "200": { + "description": "Array of [timestamp, chainBreakdown] pairs. Each entry is a two-element array: first element is a unix timestamp, second is an object mapping chain names to values.", + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + [1609459200, { "Ethereum": 3200000000, "Polygon": 1500000000 }], + [1609545600, { "Ethereum": 3250000000, "Polygon": 1520000000 }] + ] + } + } + } + }, + "404": { + "description": "Protocol not found" + } + } + } + }, + "/api/v2/chart/tvl/protocol/{protocol}/token-breakdown": { + "get": { + "tags": ["TVL"], + "x-api-plan-only": true, + "summary": "Get historical TVL chart for a protocol broken down by token", + "description": "Returns an array of [timestamp, { token: value }] pairs showing TVL per token over time. Values are in USD by default, set currency=tokens for raw token amounts.", + "parameters": [ + { + "name": "protocol", + "in": "path", + "required": true, + "description": "protocol slug", + "schema": { + "type": "string", + "example": "aave" + } + }, + { + "name": "key", + "in": "query", + "required": false, + "description": "Metric to return. Omit for default TVL. Use \"all\" for the sum of tvl+borrowed+staking+pool2+vesting, or a specific metric like \"staking\", \"borrowed\", \"vesting\", \"pool2\".", + "schema": { + "type": "string", + "enum": ["all", "staking", "borrowed", "vesting", "pool2"] + } + }, + { + "name": "currency", + "in": "query", + "required": false, + "description": "Set to \"tokens\" to return values denominated in raw token amounts instead of USD", + "schema": { + "type": "string", + "enum": ["tokens"], + "example": "tokens" + } + } + ], + "responses": { + "200": { + "description": "Array of [timestamp, tokenBreakdown] pairs. Each entry is a two-element array: first element is a unix timestamp, second is an object mapping token names to values (USD by default, raw token amounts if currency=tokens).", + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + [1609459200, { "USDC": 1000000000, "USDT": 800000000, "WETH": 500000000 }], + [1609545600, { "USDC": 1010000000, "USDT": 810000000, "WETH": 510000000 }] + ] + } + } + } + }, + "404": { + "description": "Protocol not found" + } + } + } + }, + "/api/v2/metrics/treasury/protocol/{protocol}": { + "get": { + "tags": ["Treasury"], + "x-api-plan-only": true, + "summary": "Get aggregate treasury metrics for a protocol", + "description": "Returns protocol metadata along with current treasury figures and chain breakdowns.", + "parameters": [ + { + "name": "protocol", + "in": "path", + "required": true, + "description": "protocol slug", + "schema": { + "type": "string", + "example": "aave" + } + } + ], + "responses": { + "200": { + "description": "Protocol treasury metrics", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "parent#aave" + }, + "name": { + "type": "string", + "example": "Aave" + }, + "address": { + "type": "string", + "nullable": true, + "example": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9" + }, + "symbol": { + "type": "string", + "nullable": true, + "example": "AAVE" + }, + "url": { + "type": "string", + "example": "https://aave.com" + }, + "referralUrl": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "example": "Aave is an Open Source and Non-Custodial protocol to earn interest on deposits & borrow assets" + }, + "chain": { + "type": "string", + "example": "Multi-Chain" + }, + "logo": { + "type": "string", + "example": "https://icons.llama.fi/aave.png" + }, + "audits": { + "type": "string", + "nullable": true + }, + "audit_note": { + "type": "string", + "nullable": true + }, + "gecko_id": { + "type": "string", + "nullable": true, + "example": "aave" + }, + "cmcId": { + "type": "string", + "nullable": true, + "example": "7278" + }, + "category": { + "type": "string", + "example": "Lending" + }, + "tags": { + "type": "array", + "nullable": true, + "items": { "type": "string" } + }, + "chains": { + "type": "array", + "items": { "type": "string" }, + "example": ["Ethereum", "Polygon", "Avalanche"] + }, + "module": { + "type": "string", + "nullable": true + }, + "treasury": { + "type": "string", + "nullable": true + }, + "twitter": { + "type": "string", + "example": "AaveAave" + }, + "audit_links": { + "type": "array", + "items": { "type": "string" } + }, + "openSource": { + "type": "boolean" + }, + "forkedFrom": { + "type": "array", + "items": { "type": "string" } + }, + "oraclesByChain": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { "type": "string" } + }, + "example": { "Ethereum": ["Chainlink"], "Polygon": ["Chainlink"] } + }, + "parentProtocol": { + "type": "string" + }, + "governanceID": { + "type": "array", + "items": { "type": "string" } + }, + "github": { + "type": "array", + "items": { "type": "string" } + }, + "currentChainTvls": { + "type": "object", + "additionalProperties": { "type": "number" }, + "example": { "Ethereum": 80000000, "Polygon": 20000000 } + }, + "isParentProtocol": { + "type": "boolean" + }, + "mcap": { + "type": "number", + "nullable": true, + "example": 2400000000 + }, + "methodology": { + "type": "string", + "nullable": true + }, + "raises": { + "type": "array", + "items": { + "type": "object", + "properties": { + "round": { "type": "string", "example": "Series A" }, + "amount": { "type": "number", "example": 25000000 }, + "valuation": { "type": "string" }, + "source": { "type": "string" }, + "date": { "type": "number", "example": 1601510400 }, + "defillamaId": { "type": "string" }, + "leadInvestors": { "type": "array", "items": { "type": "string" } }, + "otherInvestors": { "type": "array", "items": { "type": "string" } }, + "investors": { "type": "array", "items": { "type": "string" } } + } + } + }, + "otherProtocols": { + "type": "array", + "items": { "type": "string" } + }, + "hallmarks": { + "type": "array", + "description": "Notable events in the protocol's history as [timestamp, description] pairs", + "items": { + "type": "array" + } + }, + "stablecoins": { + "type": "array", + "items": { "type": "string" } + }, + "misrepresentedTokens": { + "type": "boolean" + }, + "deprecated": { + "type": "boolean" + }, + "rugged": { + "type": "boolean" + }, + "deadUrl": { + "type": "boolean" + }, + "warningBanners": { + "type": "array", + "items": { + "type": "object", + "properties": { + "message": { "type": "string" }, + "until": { "type": "string", "nullable": true }, + "level": { "type": "string", "enum": ["low", "alert", "rug"] } + } + } + }, + "tokenRights": { + "type": "object", + "description": "Token governance and value accrual rights" + }, + "wrongLiquidity": { + "type": "boolean" + }, + "tvlCodePath": { + "type": "string", + "description": "Path to the TVL adapter source code" + } + }, + "example": { + "id": "parent#aave-treasury", + "name": "Aave (treasury)", + "url": "https://aave.com", + "description": "Aave is an Open Source and Non-Custodial protocol to earn interest on deposits and borrow assets", + "logo": "https://icons.llama.fi/aave.png", + "chains": ["Ethereum", "Arbitrum", "OP Mainnet", "Avalanche", "Fantom", "Polygon"], + "gecko_id": "aave", + "cmcId": "7278", + "treasury": "aave.js", + "twitter": "aave", + "governanceID": ["snapshot:aave.eth", "eip155:1:0xEC568fffba86c094cf06b22134B23074DFE2252c"], + "wrongLiquidity": true, + "github": ["aave", "bgd-labs"], + "stablecoins": ["gho"], + "tokenRights": { + "rights": [ + { "label": "Governance", "hasRight": true, "details": "AAVE" }, + { "label": "Treasury", "hasRight": true, "details": "AAVE" }, + { "label": "Revenue", "hasRight": true, "details": "AAVE" } + ], + "governanceData": { + "rights": "LIMITED", + "details": "Governance includes protocol parameters, treasury management, upgrades & onchain revenue", + "feeSwitchStatus": "ON", + "feeSwitchDetails": "$50m annual budget for token buybacks" + }, + "holdersRevenueAndValueAccrual": { + "buybacks": "ACTIVE", + "dividends": "NONE", + "burns": "NONE", + "primaryValueAccrual": "Buybacks - $50M yearly budget for buybacks" + }, + "tokenAlignment": { + "fundraising": "TOKEN", + "raiseDetailsLink": { + "label": "Strategic Round (Decrypt)", + "url": "https://decrypt.co/44653/aave-raises-25-million-to-bring-defi-to-institutions" + }, + "associatedEntities": ["DAO", "Labs", "Parent / Holdings Co"], + "equityRevenueCapture": "PARTIAL", + "equityStatement": "Labs owns the interface and offchain revenue" + } + }, + "symbol": "AAVE", + "address": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", + "module": "treasury/aave.js", + "category": "Treasury", + "tvlCodePath": "https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/treasury/aave.js", + "currentChainTvls": { + "Ethereum-OwnTokens": 51486143.11756, + "Arbitrum-OwnTokens": 108.33167, + "OP Mainnet-OwnTokens": 339.41814, + "Avalanche-OwnTokens": 200.26047, + "Fantom-OwnTokens": 0, + "Fantom": 5317.95627, + "Polygon-OwnTokens": 0.49868, + "Arbitrum": 7665284.15367, + "Avalanche": 12653199.04222, + "OP Mainnet": 266147.25573, + "Ethereum": 50207476.33278, + "Polygon": 774382.58832, + "OwnTokens": 51486791.62651 + }, + "raises": [], + "mcap": 1775192426.0010407 + } + } + } + } + }, + "404": { + "description": "Protocol not found" + } + } + } + }, + "/api/v2/chart/treasury/protocol/{protocol}": { + "get": { + "tags": ["Treasury"], + "x-api-plan-only": true, + "summary": "Get historical treasury chart for a protocol", + "description": "Returns an array of [timestamp, value] pairs representing the protocol's treasury value over time. By default excludes the protocol's own tokens (OwnTokens).", + "parameters": [ + { + "name": "protocol", + "in": "path", + "required": true, + "description": "protocol slug", + "schema": { + "type": "string", + "example": "uniswap" + } + }, + { + "name": "key", + "in": "query", + "required": false, + "description": "Token filter. Omit to exclude OwnTokens (default). Use \"OwnTokens\" to return only the protocol's own tokens, or \"all\" for the sum of all tokens including OwnTokens.", + "schema": { + "type": "string", + "enum": ["OwnTokens", "all"], + "example": "all" + } + } + ], + "responses": { + "200": { + "description": "Array of [timestamp, value] pairs", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "array", + "items": { "type": "number" }, + "minItems": 2, + "maxItems": 2, + "example": [1609459200, 120000000] + } + } + } + } + }, + "404": { + "description": "Protocol not found" + } + } + } + }, + "/api/v2/chart/treasury/protocol/{protocol}/chain-breakdown": { + "get": { + "tags": ["Treasury"], + "x-api-plan-only": true, + "summary": "Get historical treasury chart for a protocol broken down by chain", + "description": "Returns an array of [timestamp, { chain: value }] pairs showing treasury value per chain over time. By default excludes the protocol's own tokens.", + "parameters": [ + { + "name": "protocol", + "in": "path", + "required": true, + "description": "protocol slug", + "schema": { + "type": "string", + "example": "aave" + } + }, + { + "name": "key", + "in": "query", + "required": false, + "description": "Token filter. Omit to exclude OwnTokens (default). Use \"OwnTokens\" to return only the protocol's own tokens, or \"all\" for the sum of all tokens including OwnTokens.", + "schema": { + "type": "string", + "enum": ["OwnTokens", "all"], + "example": "OwnTokens" + } + } + ], + "responses": { + "200": { + "description": "Array of [timestamp, chainBreakdown] pairs. Each entry is a two-element array: first element is a unix timestamp, second is an object mapping chain names to treasury values.", + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + [1609459200, { "Ethereum": 80000000, "Polygon": 20000000 }], + [1609545600, { "Ethereum": 81000000, "Polygon": 20500000 }] + ] + } + } + } + }, + "404": { + "description": "Protocol not found" + } + } + } + }, + "/api/v2/chart/treasury/protocol/{protocol}/token-breakdown": { + "get": { + "tags": ["Treasury"], + "x-api-plan-only": true, + "summary": "Get historical treasury chart for a protocol broken down by token", + "description": "Returns an array of [timestamp, { token: value }] pairs showing treasury value per token over time. By default excludes OwnTokens and values are in USD. Use key and currency params to customize.", + "parameters": [ + { + "name": "protocol", + "in": "path", + "required": true, + "description": "protocol slug", + "schema": { + "type": "string", + "example": "aave" + } + }, + { + "name": "key", + "in": "query", + "required": false, + "description": "Token filter. Omit to exclude OwnTokens (default). Use \"OwnTokens\" to return only the protocol's own tokens, or \"all\" for the sum of all tokens including OwnTokens.", + "schema": { + "type": "string", + "enum": ["OwnTokens", "all"], + "example": "OwnTokens" + } + }, + { + "name": "currency", + "in": "query", + "required": false, + "description": "Set to \"tokens\" to return values denominated in raw token amounts instead of USD", + "schema": { + "type": "string", + "enum": ["tokens"], + "example": "tokens" + } + } + ], + "responses": { + "200": { + "description": "Array of [timestamp, tokenBreakdown] pairs. Each entry is a two-element array: first element is a unix timestamp, second is an object mapping token names to treasury values (USD by default, raw token amounts if currency=tokens).", + "content": { + "application/json": { + "schema": { + "type": "array", + "example": [ + [1609459200, { "AAVE": 50000000, "USDC": 30000000, "WETH": 20000000 }], + [1609545600, { "AAVE": 51000000, "USDC": 30500000, "WETH": 20500000 }] + ] + } + } + } + }, + "404": { + "description": "Protocol not found" + } + } + } + }, "/coins/prices/current/{coins}": { "get": { "tags": ["coins"], diff --git a/llms.txt b/llms.txt index ccf31d03c0b..77856204c4b 100644 --- a/llms.txt +++ b/llms.txt @@ -179,6 +179,157 @@ SECTION 1: TVL & PROTOCOL DATA }] ``` +## Protocol TVL Charts (v2) + +These endpoints provide time-series chart data for individual protocol TVL. +The `key` parameter selects which metric to return. The `currency` parameter +(token-breakdown only) switches values from USD to raw token amounts. + +8a. ๐Ÿ”’ **GET /api/v2/metrics/tvl/protocol/{protocol}** + Base: `https://pro-api.llama.fi` + Purpose: Aggregate TVL metrics for a protocol (metadata + current TVL figures) + Parameters: + - protocol (path, required): Protocol slug (e.g., "aave") + Response: + ```json + { + "id": "parent#aave", + "name": "Aave", + "symbol": "AAVE", + "url": "https://aave.com", + "description": "Decentralized lending protocol", + "chain": "Multi-Chain", + "logo": "https://icons.llama.fi/aave.png", + "category": "Lending", + "chains": ["Ethereum", "Polygon", "Avalanche"], + "currentChainTvls": {"Ethereum": 3200000000, "Polygon": 1500000000}, + "mcap": 2400000000, + "twitter": "AaveAave", + "forkedFrom": [], + "openSource": true + } + ``` + +8b. ๐Ÿ”’ **GET /api/v2/chart/tvl/protocol/{protocol}** + Base: `https://pro-api.llama.fi` + Purpose: Historical TVL value chart for a protocol + Parameters: + - protocol (path, required): Protocol slug + - key (query, optional): Metric to return. Omit for default TVL. Options: "all" (sum of tvl+borrowed+staking+pool2+vesting), "staking", "borrowed", "vesting", "pool2" + Response: Array of [timestamp, value] pairs + ```json + [[1609459200, 5200000000], [1609545600, 5250000000]] + ``` + Examples: + - `/v2/chart/tvl/protocol/uniswap` โ€” default TVL + - `/v2/chart/tvl/protocol/uniswap?key=all` โ€” sum of all metrics + - `/v2/chart/tvl/protocol/morpho?key=borrowed` โ€” borrowed only + +8c. ๐Ÿ”’ **GET /api/v2/chart/tvl/protocol/{protocol}/chain-breakdown** + Base: `https://pro-api.llama.fi` + Purpose: Historical TVL chart broken down by chain + Parameters: + - protocol (path, required): Protocol slug + - key (query, optional): Metric to return. Same options as 8b. + Response: Array of [timestamp, {chain: value}] pairs + ```json + [[1609459200, {"Ethereum": 3200000000, "Polygon": 1500000000}]] + ``` + Examples: + - `/v2/chart/tvl/protocol/euler/chain-breakdown` โ€” default TVL per chain + - `/v2/chart/tvl/protocol/euler/chain-breakdown?key=borrowed` โ€” borrowed per chain + +8d. ๐Ÿ”’ **GET /api/v2/chart/tvl/protocol/{protocol}/token-breakdown** + Base: `https://pro-api.llama.fi` + Purpose: Historical TVL chart broken down by token + Parameters: + - protocol (path, required): Protocol slug + - key (query, optional): Metric to return. Same options as 8b. + - currency (query, optional): Set to "tokens" to return raw token amounts instead of USD + Response: Array of [timestamp, {token: value}] pairs + ```json + [[1609459200, {"USDC": 1000000000, "USDT": 800000000, "WETH": 500000000}]] + ``` + Examples: + - `/v2/chart/tvl/protocol/aave/token-breakdown` โ€” value in USD + - `/v2/chart/tvl/protocol/aave/token-breakdown?currency=tokens` โ€” value in raw token amounts + +## Protocol Treasury Charts (v2) + +These endpoints provide time-series chart data for protocol treasuries. +By default, the protocol's own tokens (OwnTokens) are excluded. Use the +`key` parameter to filter: "OwnTokens" for own tokens only, "all" to include everything. + +8e. ๐Ÿ”’ **GET /api/v2/metrics/treasury/protocol/{protocol}** + Base: `https://pro-api.llama.fi` + Purpose: Aggregate treasury metrics for a protocol (metadata + current treasury figures) + Parameters: + - protocol (path, required): Protocol slug (e.g., "aave") + Response: + ```json + { + "id": "parent#aave", + "name": "Aave", + "symbol": "AAVE", + "url": "https://aave.com", + "description": "Decentralized lending protocol", + "chain": "Multi-Chain", + "logo": "https://icons.llama.fi/aave.png", + "category": "Lending", + "chains": ["Ethereum", "Polygon", "Avalanche"], + "currentChainTvls": {"Ethereum": 80000000, "Polygon": 20000000}, + "mcap": 2400000000, + "twitter": "AaveAave" + } + ``` + +8f. ๐Ÿ”’ **GET /api/v2/chart/treasury/protocol/{protocol}** + Base: `https://pro-api.llama.fi` + Purpose: Historical treasury value chart for a protocol (excludes OwnTokens by default) + Parameters: + - protocol (path, required): Protocol slug + - key (query, optional): Token filter. Omit to exclude OwnTokens. "OwnTokens" for own tokens only. "all" for sum including OwnTokens. + Response: Array of [timestamp, value] pairs + ```json + [[1609459200, 120000000], [1609545600, 121000000]] + ``` + Examples: + - `/v2/chart/treasury/protocol/uniswap` โ€” excludes OwnTokens + - `/v2/chart/treasury/protocol/uniswap?key=OwnTokens` โ€” own tokens only + - `/v2/chart/treasury/protocol/uniswap?key=all` โ€” sum of all including OwnTokens + +8g. ๐Ÿ”’ **GET /api/v2/chart/treasury/protocol/{protocol}/chain-breakdown** + Base: `https://pro-api.llama.fi` + Purpose: Historical treasury chart broken down by chain (excludes OwnTokens by default) + Parameters: + - protocol (path, required): Protocol slug + - key (query, optional): Token filter. Same options as 8f. + Response: Array of [timestamp, {chain: value}] pairs + ```json + [[1609459200, {"Ethereum": 80000000, "Polygon": 20000000}]] + ``` + Examples: + - `/v2/chart/treasury/protocol/aave/chain-breakdown` โ€” excludes OwnTokens + - `/v2/chart/treasury/protocol/aave/chain-breakdown?key=OwnTokens` โ€” own tokens only per chain + - `/v2/chart/treasury/protocol/aave/chain-breakdown?key=all` โ€” all tokens per chain + +8h. ๐Ÿ”’ **GET /api/v2/chart/treasury/protocol/{protocol}/token-breakdown** + Base: `https://pro-api.llama.fi` + Purpose: Historical treasury chart broken down by token + Parameters: + - protocol (path, required): Protocol slug + - key (query, optional): Token filter. Same options as 8f. + - currency (query, optional): Set to "tokens" to return raw token amounts instead of USD + Response: Array of [timestamp, {token: value}] pairs + ```json + [[1609459200, {"AAVE": 50000000, "USDC": 30000000, "WETH": 20000000}]] + ``` + Examples: + - `/v2/chart/treasury/protocol/aave/token-breakdown` โ€” value in USD, excludes OwnTokens + - `/v2/chart/treasury/protocol/aave/token-breakdown?currency=tokens` โ€” raw token amounts + - `/v2/chart/treasury/protocol/aave/token-breakdown?key=OwnTokens¤cy=tokens` โ€” own tokens in raw amounts + - `/v2/chart/treasury/protocol/aave/token-breakdown?key=all` โ€” all tokens in USD + 9. ๐Ÿ”’ **GET /api/chainAssets** Base: `https://pro-api.llama.fi` Purpose: Asset breakdown across all chains From 559a822a4b694d17171b23d8d8baeedde75f25fd Mon Sep 17 00:00:00 2001 From: mintdart <96025197+mintdart@users.noreply.github.com> Date: Wed, 25 Feb 2026 03:43:22 -0800 Subject: [PATCH 2/2] feat: add Beta badge to all v2 TVL and Treasury endpoints - Create BetaBadge component (purple, mirrors ProBadge pattern) - Wire BetaBadge into ModernLayout, ClassicLayout, and OperationsListItem - Add beta indicator to sidebar, stacked vertically below HTTP method - Add x-api-beta: true to all 8 v2 endpoints in pro spec - Update llms.txt with Beta markers on all v2 entries Co-authored-by: Cursor --- defillama-openapi-pro.json | 8 +++ llms.txt | 18 +++--- .../src/components/BetaBadge/BetaBadge.vue | 33 ++++++++++ .../src/components/BetaBadge/index.ts | 1 + .../Content/Tag/OperationsListItem.vue | 16 +++++ .../Operation/layouts/ClassicLayout.vue | 2 + .../Operation/layouts/ModernLayout.vue | 2 + .../sidebar/components/SidebarElement.vue | 60 +++++++++++++------ 8 files changed, 114 insertions(+), 26 deletions(-) create mode 100644 packages/api-reference/src/components/BetaBadge/BetaBadge.vue create mode 100644 packages/api-reference/src/components/BetaBadge/index.ts diff --git a/defillama-openapi-pro.json b/defillama-openapi-pro.json index b86a799973a..f896f7accf3 100644 --- a/defillama-openapi-pro.json +++ b/defillama-openapi-pro.json @@ -5541,6 +5541,7 @@ "get": { "tags": ["TVL"], "x-api-plan-only": true, + "x-api-beta": true, "summary": "Get aggregate TVL metrics for a protocol", "description": "Returns protocol metadata along with current TVL figures, chain breakdowns, and other aggregate metrics.", "parameters": [ @@ -5935,6 +5936,7 @@ "get": { "tags": ["TVL"], "x-api-plan-only": true, + "x-api-beta": true, "summary": "Get historical TVL chart for a protocol", "description": "Returns an array of [timestamp, value] pairs representing the protocol's TVL over time. By default returns the base TVL metric. Use the `key` parameter to select a different metric or aggregate all metrics.", "parameters": [ @@ -5988,6 +5990,7 @@ "get": { "tags": ["TVL"], "x-api-plan-only": true, + "x-api-beta": true, "summary": "Get historical TVL chart for a protocol broken down by chain", "description": "Returns an array of [timestamp, { chain: value }] pairs showing the selected metric per chain over time.", "parameters": [ @@ -6038,6 +6041,7 @@ "get": { "tags": ["TVL"], "x-api-plan-only": true, + "x-api-beta": true, "summary": "Get historical TVL chart for a protocol broken down by token", "description": "Returns an array of [timestamp, { token: value }] pairs showing TVL per token over time. Values are in USD by default, set currency=tokens for raw token amounts.", "parameters": [ @@ -6098,6 +6102,7 @@ "get": { "tags": ["Treasury"], "x-api-plan-only": true, + "x-api-beta": true, "summary": "Get aggregate treasury metrics for a protocol", "description": "Returns protocol metadata along with current treasury figures and chain breakdowns.", "parameters": [ @@ -6397,6 +6402,7 @@ "get": { "tags": ["Treasury"], "x-api-plan-only": true, + "x-api-beta": true, "summary": "Get historical treasury chart for a protocol", "description": "Returns an array of [timestamp, value] pairs representing the protocol's treasury value over time. By default excludes the protocol's own tokens (OwnTokens).", "parameters": [ @@ -6450,6 +6456,7 @@ "get": { "tags": ["Treasury"], "x-api-plan-only": true, + "x-api-beta": true, "summary": "Get historical treasury chart for a protocol broken down by chain", "description": "Returns an array of [timestamp, { chain: value }] pairs showing treasury value per chain over time. By default excludes the protocol's own tokens.", "parameters": [ @@ -6500,6 +6507,7 @@ "get": { "tags": ["Treasury"], "x-api-plan-only": true, + "x-api-beta": true, "summary": "Get historical treasury chart for a protocol broken down by token", "description": "Returns an array of [timestamp, { token: value }] pairs showing treasury value per token over time. By default excludes OwnTokens and values are in USD. Use key and currency params to customize.", "parameters": [ diff --git a/llms.txt b/llms.txt index 77856204c4b..92e7926e3f6 100644 --- a/llms.txt +++ b/llms.txt @@ -4,7 +4,7 @@ DefiLlama API โ€“ Complete LLM Integration Guide ## Overview This document provides comprehensive guidance for LLMs to interact with ALL DefiLlama APIs. -Includes API-Plan-only endpoints (marked with ๐Ÿ”’) and free endpoints, with full parameters and responses. +Includes API-Plan-only endpoints (marked with ๐Ÿ”’), beta endpoints (marked with ๐Ÿงช), and free endpoints, with full parameters and responses. ## Base URLs @@ -185,7 +185,7 @@ These endpoints provide time-series chart data for individual protocol TVL. The `key` parameter selects which metric to return. The `currency` parameter (token-breakdown only) switches values from USD to raw token amounts. -8a. ๐Ÿ”’ **GET /api/v2/metrics/tvl/protocol/{protocol}** +8a. ๐Ÿ”’ ๐Ÿงช **GET /api/v2/metrics/tvl/protocol/{protocol}** Base: `https://pro-api.llama.fi` Purpose: Aggregate TVL metrics for a protocol (metadata + current TVL figures) Parameters: @@ -210,7 +210,7 @@ The `key` parameter selects which metric to return. The `currency` parameter } ``` -8b. ๐Ÿ”’ **GET /api/v2/chart/tvl/protocol/{protocol}** +8b. ๐Ÿ”’ ๐Ÿงช **GET /api/v2/chart/tvl/protocol/{protocol}** Base: `https://pro-api.llama.fi` Purpose: Historical TVL value chart for a protocol Parameters: @@ -225,7 +225,7 @@ The `key` parameter selects which metric to return. The `currency` parameter - `/v2/chart/tvl/protocol/uniswap?key=all` โ€” sum of all metrics - `/v2/chart/tvl/protocol/morpho?key=borrowed` โ€” borrowed only -8c. ๐Ÿ”’ **GET /api/v2/chart/tvl/protocol/{protocol}/chain-breakdown** +8c. ๐Ÿ”’ ๐Ÿงช **GET /api/v2/chart/tvl/protocol/{protocol}/chain-breakdown** Base: `https://pro-api.llama.fi` Purpose: Historical TVL chart broken down by chain Parameters: @@ -239,7 +239,7 @@ The `key` parameter selects which metric to return. The `currency` parameter - `/v2/chart/tvl/protocol/euler/chain-breakdown` โ€” default TVL per chain - `/v2/chart/tvl/protocol/euler/chain-breakdown?key=borrowed` โ€” borrowed per chain -8d. ๐Ÿ”’ **GET /api/v2/chart/tvl/protocol/{protocol}/token-breakdown** +8d. ๐Ÿ”’ ๐Ÿงช **GET /api/v2/chart/tvl/protocol/{protocol}/token-breakdown** Base: `https://pro-api.llama.fi` Purpose: Historical TVL chart broken down by token Parameters: @@ -260,7 +260,7 @@ These endpoints provide time-series chart data for protocol treasuries. By default, the protocol's own tokens (OwnTokens) are excluded. Use the `key` parameter to filter: "OwnTokens" for own tokens only, "all" to include everything. -8e. ๐Ÿ”’ **GET /api/v2/metrics/treasury/protocol/{protocol}** +8e. ๐Ÿ”’ ๐Ÿงช **GET /api/v2/metrics/treasury/protocol/{protocol}** Base: `https://pro-api.llama.fi` Purpose: Aggregate treasury metrics for a protocol (metadata + current treasury figures) Parameters: @@ -283,7 +283,7 @@ By default, the protocol's own tokens (OwnTokens) are excluded. Use the } ``` -8f. ๐Ÿ”’ **GET /api/v2/chart/treasury/protocol/{protocol}** +8f. ๐Ÿ”’ ๐Ÿงช **GET /api/v2/chart/treasury/protocol/{protocol}** Base: `https://pro-api.llama.fi` Purpose: Historical treasury value chart for a protocol (excludes OwnTokens by default) Parameters: @@ -298,7 +298,7 @@ By default, the protocol's own tokens (OwnTokens) are excluded. Use the - `/v2/chart/treasury/protocol/uniswap?key=OwnTokens` โ€” own tokens only - `/v2/chart/treasury/protocol/uniswap?key=all` โ€” sum of all including OwnTokens -8g. ๐Ÿ”’ **GET /api/v2/chart/treasury/protocol/{protocol}/chain-breakdown** +8g. ๐Ÿ”’ ๐Ÿงช **GET /api/v2/chart/treasury/protocol/{protocol}/chain-breakdown** Base: `https://pro-api.llama.fi` Purpose: Historical treasury chart broken down by chain (excludes OwnTokens by default) Parameters: @@ -313,7 +313,7 @@ By default, the protocol's own tokens (OwnTokens) are excluded. Use the - `/v2/chart/treasury/protocol/aave/chain-breakdown?key=OwnTokens` โ€” own tokens only per chain - `/v2/chart/treasury/protocol/aave/chain-breakdown?key=all` โ€” all tokens per chain -8h. ๐Ÿ”’ **GET /api/v2/chart/treasury/protocol/{protocol}/token-breakdown** +8h. ๐Ÿ”’ ๐Ÿงช **GET /api/v2/chart/treasury/protocol/{protocol}/token-breakdown** Base: `https://pro-api.llama.fi` Purpose: Historical treasury chart broken down by token Parameters: diff --git a/packages/api-reference/src/components/BetaBadge/BetaBadge.vue b/packages/api-reference/src/components/BetaBadge/BetaBadge.vue new file mode 100644 index 00000000000..4b09bb91247 --- /dev/null +++ b/packages/api-reference/src/components/BetaBadge/BetaBadge.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/packages/api-reference/src/components/BetaBadge/index.ts b/packages/api-reference/src/components/BetaBadge/index.ts new file mode 100644 index 00000000000..fe167c8366d --- /dev/null +++ b/packages/api-reference/src/components/BetaBadge/index.ts @@ -0,0 +1 @@ +export { default as BetaBadge } from './BetaBadge.vue' diff --git a/packages/api-reference/src/components/Content/Tag/OperationsListItem.vue b/packages/api-reference/src/components/Content/Tag/OperationsListItem.vue index 9ed5032a955..b0ef08e6739 100644 --- a/packages/api-reference/src/components/Content/Tag/OperationsListItem.vue +++ b/packages/api-reference/src/components/Content/Tag/OperationsListItem.vue @@ -70,6 +70,11 @@ const title = computed( class="pro-indicator"> API Plan + + Beta + @@ -127,4 +132,15 @@ const title = computed( border-radius: 6px; display: inline-block; } + +.beta-indicator { + margin-left: 8px; + color: #9333ea; + font-size: var(--scalar-micro); + font-weight: var(--scalar-bold); + background: color-mix(in srgb, #9333ea, transparent 90%); + padding: 1px 4px; + border-radius: 6px; + display: inline-block; +} diff --git a/packages/api-reference/src/features/Operation/layouts/ClassicLayout.vue b/packages/api-reference/src/features/Operation/layouts/ClassicLayout.vue index 24f853a0af7..cf11e7eb0ab 100644 --- a/packages/api-reference/src/features/Operation/layouts/ClassicLayout.vue +++ b/packages/api-reference/src/features/Operation/layouts/ClassicLayout.vue @@ -27,6 +27,7 @@ import { Anchor } from '@/components/Anchor' import { Badge } from '@/components/Badge' import { HttpMethod } from '@/components/HttpMethod' import OperationPath from '@/components/OperationPath.vue' +import { BetaBadge } from '@/components/BetaBadge' import { ProBadge } from '@/components/ProBadge' import { SectionAccordion } from '@/components/Section' import { ExampleResponses } from '@/features/example-responses' @@ -96,6 +97,7 @@ const handleDiscriminatorChange = (type: string) => { + { + { - + + + Beta + + @@ -178,6 +187,14 @@ const onAnchorClick = async (ev: Event) => { } .sidebar-heading-link-method { margin: 0; + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 2px; + flex-shrink: 0; +} +.sidebar-heading-link-method-row { + margin: 0; } .sidebar-heading.deprecated .sidebar-heading-link-title { text-decoration: line-through; @@ -352,4 +369,13 @@ const onAnchorClick = async (ev: Event) => { color: var(--scalar-sidebar-color-1, var(--scalar-color-1)); font-weight: var(--scalar-sidebar-font-weight-active, var(--scalar-semibold)); } + +.sidebar-beta-badge { + color: #9333ea; + font-size: 9px; + font-weight: var(--scalar-bold); + text-transform: uppercase; + line-height: 1; + flex-shrink: 0; +}