Skip to content

feat: add v2 TVL and Treasury protocol endpoints#11

Open
mintdart wants to merge 2 commits intomainfrom
tvl-v2-routes
Open

feat: add v2 TVL and Treasury protocol endpoints#11
mintdart wants to merge 2 commits intomainfrom
tvl-v2-routes

Conversation

@mintdart
Copy link

Summary

  • Adds 8 new pro-only v2 endpoints to defillama-openapi-pro.json for protocol TVL and treasury data (metrics + charts with chain/token breakdowns)
  • Creates a new "Treasury" tag to separate treasury endpoints from TVL
  • Updates llms.txt with concise documentation, parameter details, and usage examples for all new endpoints

New Endpoints

TVL (tag: TVL):

  • GET /api/v2/metrics/tvl/protocol/{protocol} — full protocol TVL metrics
  • GET /api/v2/chart/tvl/protocol/{protocol} — TVL time series
  • GET /api/v2/chart/tvl/protocol/{protocol}/chain-breakdown — TVL by chain
  • GET /api/v2/chart/tvl/protocol/{protocol}/token-breakdown — TVL by token

Treasury (tag: Treasury):

  • GET /api/v2/metrics/treasury/protocol/{protocol} — full protocol treasury metrics
  • GET /api/v2/chart/treasury/protocol/{protocol} — treasury time series
  • GET /api/v2/chart/treasury/protocol/{protocol}/chain-breakdown — treasury by chain
  • GET /api/v2/chart/treasury/protocol/{protocol}/token-breakdown — treasury by token

Key Details

  • All endpoints marked x-api-plan-only: true (pro users only)
  • key parameter: metric selector for TVL (all, staking, borrowed, vesting, pool2), token filter for Treasury (OwnTokens, all)
  • currency=tokens only on token-breakdown endpoints
  • Full IProtocolMetricsV2 schema with real Aave examples for both metrics endpoints
  • OpenAPI 3.0.3 compatible (no prefixItems)

Test plan

  • Verify pro spec renders correctly in Scalar docs (all 8 endpoints visible)
  • Confirm PRO badges appear on all new endpoints
  • Check response examples render properly (no empty [[]])
  • Verify Treasury tag groups treasury endpoints separately from TVL
  • Confirm llms.txt is served correctly with new sections

Made with Cursor

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 <cursoragent@cursor.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 25, 2026

Deploying api-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 559a822
Status: ✅  Deploy successful!
Preview URL: https://3bedf7ae.api-docs-59g.pages.dev
Branch Preview URL: https://tvl-v2-routes.api-docs-59g.pages.dev

View logs

- 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 <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant