Skip to content

Commit 559a822

Browse files
mintdartcursoragent
andcommitted
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 <cursoragent@cursor.com>
1 parent 8eb9d0c commit 559a822

8 files changed

Lines changed: 114 additions & 26 deletions

File tree

defillama-openapi-pro.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5541,6 +5541,7 @@
55415541
"get": {
55425542
"tags": ["TVL"],
55435543
"x-api-plan-only": true,
5544+
"x-api-beta": true,
55445545
"summary": "Get aggregate TVL metrics for a protocol",
55455546
"description": "Returns protocol metadata along with current TVL figures, chain breakdowns, and other aggregate metrics.",
55465547
"parameters": [
@@ -5935,6 +5936,7 @@
59355936
"get": {
59365937
"tags": ["TVL"],
59375938
"x-api-plan-only": true,
5939+
"x-api-beta": true,
59385940
"summary": "Get historical TVL chart for a protocol",
59395941
"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.",
59405942
"parameters": [
@@ -5988,6 +5990,7 @@
59885990
"get": {
59895991
"tags": ["TVL"],
59905992
"x-api-plan-only": true,
5993+
"x-api-beta": true,
59915994
"summary": "Get historical TVL chart for a protocol broken down by chain",
59925995
"description": "Returns an array of [timestamp, { chain: value }] pairs showing the selected metric per chain over time.",
59935996
"parameters": [
@@ -6038,6 +6041,7 @@
60386041
"get": {
60396042
"tags": ["TVL"],
60406043
"x-api-plan-only": true,
6044+
"x-api-beta": true,
60416045
"summary": "Get historical TVL chart for a protocol broken down by token",
60426046
"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.",
60436047
"parameters": [
@@ -6098,6 +6102,7 @@
60986102
"get": {
60996103
"tags": ["Treasury"],
61006104
"x-api-plan-only": true,
6105+
"x-api-beta": true,
61016106
"summary": "Get aggregate treasury metrics for a protocol",
61026107
"description": "Returns protocol metadata along with current treasury figures and chain breakdowns.",
61036108
"parameters": [
@@ -6397,6 +6402,7 @@
63976402
"get": {
63986403
"tags": ["Treasury"],
63996404
"x-api-plan-only": true,
6405+
"x-api-beta": true,
64006406
"summary": "Get historical treasury chart for a protocol",
64016407
"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).",
64026408
"parameters": [
@@ -6450,6 +6456,7 @@
64506456
"get": {
64516457
"tags": ["Treasury"],
64526458
"x-api-plan-only": true,
6459+
"x-api-beta": true,
64536460
"summary": "Get historical treasury chart for a protocol broken down by chain",
64546461
"description": "Returns an array of [timestamp, { chain: value }] pairs showing treasury value per chain over time. By default excludes the protocol's own tokens.",
64556462
"parameters": [
@@ -6500,6 +6507,7 @@
65006507
"get": {
65016508
"tags": ["Treasury"],
65026509
"x-api-plan-only": true,
6510+
"x-api-beta": true,
65036511
"summary": "Get historical treasury chart for a protocol broken down by token",
65046512
"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.",
65056513
"parameters": [

llms.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ DefiLlama API – Complete LLM Integration Guide
44
## Overview
55

66
This document provides comprehensive guidance for LLMs to interact with ALL DefiLlama APIs.
7-
Includes API-Plan-only endpoints (marked with 🔒) and free endpoints, with full parameters and responses.
7+
Includes API-Plan-only endpoints (marked with 🔒), beta endpoints (marked with 🧪), and free endpoints, with full parameters and responses.
88

99
## Base URLs
1010

@@ -185,7 +185,7 @@ These endpoints provide time-series chart data for individual protocol TVL.
185185
The `key` parameter selects which metric to return. The `currency` parameter
186186
(token-breakdown only) switches values from USD to raw token amounts.
187187

188-
8a. 🔒 **GET /api/v2/metrics/tvl/protocol/{protocol}**
188+
8a. 🔒 🧪 **GET /api/v2/metrics/tvl/protocol/{protocol}**
189189
Base: `https://pro-api.llama.fi`
190190
Purpose: Aggregate TVL metrics for a protocol (metadata + current TVL figures)
191191
Parameters:
@@ -210,7 +210,7 @@ The `key` parameter selects which metric to return. The `currency` parameter
210210
}
211211
```
212212

213-
8b. 🔒 **GET /api/v2/chart/tvl/protocol/{protocol}**
213+
8b. 🔒 🧪 **GET /api/v2/chart/tvl/protocol/{protocol}**
214214
Base: `https://pro-api.llama.fi`
215215
Purpose: Historical TVL value chart for a protocol
216216
Parameters:
@@ -225,7 +225,7 @@ The `key` parameter selects which metric to return. The `currency` parameter
225225
- `/v2/chart/tvl/protocol/uniswap?key=all` — sum of all metrics
226226
- `/v2/chart/tvl/protocol/morpho?key=borrowed` — borrowed only
227227

228-
8c. 🔒 **GET /api/v2/chart/tvl/protocol/{protocol}/chain-breakdown**
228+
8c. 🔒 🧪 **GET /api/v2/chart/tvl/protocol/{protocol}/chain-breakdown**
229229
Base: `https://pro-api.llama.fi`
230230
Purpose: Historical TVL chart broken down by chain
231231
Parameters:
@@ -239,7 +239,7 @@ The `key` parameter selects which metric to return. The `currency` parameter
239239
- `/v2/chart/tvl/protocol/euler/chain-breakdown` — default TVL per chain
240240
- `/v2/chart/tvl/protocol/euler/chain-breakdown?key=borrowed` — borrowed per chain
241241

242-
8d. 🔒 **GET /api/v2/chart/tvl/protocol/{protocol}/token-breakdown**
242+
8d. 🔒 🧪 **GET /api/v2/chart/tvl/protocol/{protocol}/token-breakdown**
243243
Base: `https://pro-api.llama.fi`
244244
Purpose: Historical TVL chart broken down by token
245245
Parameters:
@@ -260,7 +260,7 @@ These endpoints provide time-series chart data for protocol treasuries.
260260
By default, the protocol's own tokens (OwnTokens) are excluded. Use the
261261
`key` parameter to filter: "OwnTokens" for own tokens only, "all" to include everything.
262262

263-
8e. 🔒 **GET /api/v2/metrics/treasury/protocol/{protocol}**
263+
8e. 🔒 🧪 **GET /api/v2/metrics/treasury/protocol/{protocol}**
264264
Base: `https://pro-api.llama.fi`
265265
Purpose: Aggregate treasury metrics for a protocol (metadata + current treasury figures)
266266
Parameters:
@@ -283,7 +283,7 @@ By default, the protocol's own tokens (OwnTokens) are excluded. Use the
283283
}
284284
```
285285

286-
8f. 🔒 **GET /api/v2/chart/treasury/protocol/{protocol}**
286+
8f. 🔒 🧪 **GET /api/v2/chart/treasury/protocol/{protocol}**
287287
Base: `https://pro-api.llama.fi`
288288
Purpose: Historical treasury value chart for a protocol (excludes OwnTokens by default)
289289
Parameters:
@@ -298,7 +298,7 @@ By default, the protocol's own tokens (OwnTokens) are excluded. Use the
298298
- `/v2/chart/treasury/protocol/uniswap?key=OwnTokens` — own tokens only
299299
- `/v2/chart/treasury/protocol/uniswap?key=all` — sum of all including OwnTokens
300300

301-
8g. 🔒 **GET /api/v2/chart/treasury/protocol/{protocol}/chain-breakdown**
301+
8g. 🔒 🧪 **GET /api/v2/chart/treasury/protocol/{protocol}/chain-breakdown**
302302
Base: `https://pro-api.llama.fi`
303303
Purpose: Historical treasury chart broken down by chain (excludes OwnTokens by default)
304304
Parameters:
@@ -313,7 +313,7 @@ By default, the protocol's own tokens (OwnTokens) are excluded. Use the
313313
- `/v2/chart/treasury/protocol/aave/chain-breakdown?key=OwnTokens` — own tokens only per chain
314314
- `/v2/chart/treasury/protocol/aave/chain-breakdown?key=all` — all tokens per chain
315315

316-
8h. 🔒 **GET /api/v2/chart/treasury/protocol/{protocol}/token-breakdown**
316+
8h. 🔒 🧪 **GET /api/v2/chart/treasury/protocol/{protocol}/token-breakdown**
317317
Base: `https://pro-api.llama.fi`
318318
Purpose: Historical treasury chart broken down by token
319319
Parameters:
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<template>
2+
<Badge
3+
v-if="showBetaBadge"
4+
class="api-beta-badge">
5+
Beta
6+
</Badge>
7+
</template>
8+
9+
<script setup lang="ts">
10+
import { computed } from 'vue'
11+
12+
import { Badge } from '@/components/Badge'
13+
14+
const { operation } = defineProps<{
15+
operation?: {
16+
'x-api-beta'?: boolean
17+
[key: string]: any
18+
}
19+
}>()
20+
21+
const showBetaBadge = computed(() => {
22+
return operation?.['x-api-beta'] === true
23+
})
24+
</script>
25+
26+
<style scoped>
27+
.api-beta-badge {
28+
font-weight: var(--scalar-bold);
29+
font-size: var(--scalar-micro);
30+
color: #9333ea;
31+
margin-left: 8px;
32+
}
33+
</style>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as BetaBadge } from './BetaBadge.vue'

packages/api-reference/src/components/Content/Tag/OperationsListItem.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ const title = computed(
7070
class="pro-indicator">
7171
API Plan
7272
</span>
73+
<span
74+
v-if="transformedOperation.information?.['x-api-beta'] === true"
75+
class="beta-indicator">
76+
Beta
77+
</span>
7378
</span>
7479
</a>
7580
</li>
@@ -127,4 +132,15 @@ const title = computed(
127132
border-radius: 6px;
128133
display: inline-block;
129134
}
135+
136+
.beta-indicator {
137+
margin-left: 8px;
138+
color: #9333ea;
139+
font-size: var(--scalar-micro);
140+
font-weight: var(--scalar-bold);
141+
background: color-mix(in srgb, #9333ea, transparent 90%);
142+
padding: 1px 4px;
143+
border-radius: 6px;
144+
display: inline-block;
145+
}
130146
</style>

packages/api-reference/src/features/Operation/layouts/ClassicLayout.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { Anchor } from '@/components/Anchor'
2727
import { Badge } from '@/components/Badge'
2828
import { HttpMethod } from '@/components/HttpMethod'
2929
import OperationPath from '@/components/OperationPath.vue'
30+
import { BetaBadge } from '@/components/BetaBadge'
3031
import { ProBadge } from '@/components/ProBadge'
3132
import { SectionAccordion } from '@/components/Section'
3233
import { ExampleResponses } from '@/features/example-responses'
@@ -96,6 +97,7 @@ const handleDiscriminatorChange = (type: string) => {
9697
</Badge>
9798

9899
<ProBadge :operation="operation" />
100+
<BetaBadge :operation="operation" />
99101

100102
<Badge
101103
v-if="isWebhook"

packages/api-reference/src/features/Operation/layouts/ModernLayout.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { computed, useId } from 'vue'
1717
import { Anchor } from '@/components/Anchor'
1818
import { Badge } from '@/components/Badge'
1919
import OperationPath from '@/components/OperationPath.vue'
20+
import { BetaBadge } from '@/components/BetaBadge'
2021
import { ProBadge } from '@/components/ProBadge'
2122
import {
2223
Section,
@@ -78,6 +79,7 @@ const handleDiscriminatorChange = (type: string) => {
7879
</Badge>
7980

8081
<ProBadge :operation="operation" />
82+
<BetaBadge :operation="operation" />
8183

8284
<Badge
8385
v-if="isWebhook"

packages/api-reference/src/features/sidebar/components/SidebarElement.vue

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -129,25 +129,34 @@ const onAnchorClick = async (ev: Event) => {
129129
<p class="sidebar-heading-link-title">
130130
{{ item.title }}
131131
</p>
132-
<p
132+
<div
133133
v-if="'method' in item && !hasChildren"
134134
class="sidebar-heading-link-method">
135-
&hairsp;
136-
<span class="sr-only">HTTP Method:&nbsp;</span>
137-
<SidebarHttpBadge
138-
class="min-w-9.75 justify-end text-right"
139-
:active="isActive"
140-
:method="item.method">
141-
<template #default>
142-
<ScalarIconWebhooksLogo
143-
weight="bold"
144-
v-if="'webhook' in item"
145-
:style="{
146-
color: getHttpMethodInfo(item.method).colorVar,
147-
}" />
148-
</template>
149-
</SidebarHttpBadge>
150-
</p>
135+
<p class="sidebar-heading-link-method-row">
136+
&hairsp;
137+
<span class="sr-only">HTTP Method:&nbsp;</span>
138+
<SidebarHttpBadge
139+
class="min-w-9.75 justify-end text-right"
140+
:active="isActive"
141+
:method="item.method">
142+
<template #default>
143+
<ScalarIconWebhooksLogo
144+
weight="bold"
145+
v-if="'webhook' in item"
146+
:style="{
147+
color: getHttpMethodInfo(item.method).colorVar,
148+
}" />
149+
</template>
150+
</SidebarHttpBadge>
151+
</p>
152+
<span
153+
v-if="
154+
'operation' in item && item.operation?.['x-api-beta'] === true
155+
"
156+
class="sidebar-beta-badge">
157+
Beta
158+
</span>
159+
</div>
151160
</a>
152161
</div>
153162
<slot v-if="open" />
@@ -178,6 +187,14 @@ const onAnchorClick = async (ev: Event) => {
178187
}
179188
.sidebar-heading-link-method {
180189
margin: 0;
190+
display: flex;
191+
flex-direction: column;
192+
align-items: flex-end;
193+
gap: 2px;
194+
flex-shrink: 0;
195+
}
196+
.sidebar-heading-link-method-row {
197+
margin: 0;
181198
}
182199
.sidebar-heading.deprecated .sidebar-heading-link-title {
183200
text-decoration: line-through;
@@ -352,4 +369,13 @@ const onAnchorClick = async (ev: Event) => {
352369
color: var(--scalar-sidebar-color-1, var(--scalar-color-1));
353370
font-weight: var(--scalar-sidebar-font-weight-active, var(--scalar-semibold));
354371
}
372+
373+
.sidebar-beta-badge {
374+
color: #9333ea;
375+
font-size: 9px;
376+
font-weight: var(--scalar-bold);
377+
text-transform: uppercase;
378+
line-height: 1;
379+
flex-shrink: 0;
380+
}
355381
</style>

0 commit comments

Comments
 (0)