Skip to content

Pro API

Igor Sazonov edited this page Sep 23, 2026 · 1 revision

A Pro API key unlocks 101 of the 132 operations in the pinned DefiLlama specification. Configure the client with WithAPIKey before calling any method on this page. The SDK inserts the key into the URL path format required by DefiLlama, redacts it from diagnostics, and returns *ProAPIKeyRequiredError before network I/O if a Pro method is called without a key.1

client, err := defillama.New(
    defillama.WithAPIKey(os.Getenv("DEFILLAMA_API_KEY")),
    defillama.WithTimeout(10*time.Second),
)
if err != nil {
    return err
}

For options, retries, and safe key handling, see Authentication and Configuration. This page organizes the Pro-only catalog by service. The complete operation-to-endpoint map is in API Reference.

Account, ecosystem, and emissions

Service Methods Return type
Account() GetUsage(ctx) *APIUsage
Ecosystem() GetCategories, GetForks, GetOracles, GetRaises map[string]any
Ecosystem() GetHacks, GetTreasuries, GetEntities []any
Emissions() GetEmissions(ctx) []any
Emissions() GetEmission(ctx, protocol) map[string]any

APIUsage retains the response in Raw. Its CreditsLeft() helper searches the known credits_left, creditsLeft, and remaining keys and returns (value, true) only when a numeric value is present.2

usage, err := client.Account().GetUsage(ctx)
if err != nil {
    return err
}
if credits, ok := usage.CreditsLeft(); ok {
    fmt.Printf("credits left: %.0f\n", credits)
}

TVL, treasury, oracles, forks, and dimensions

TVL() adds Pro token-usage, inflow, chain-assets, and v2 protocol TVL metrics/chart methods. See Protocols and TVL for signatures and TVLChartOptions.

Service Methods Return type
Treasury() GetTreasuryMetrics(ctx, protocol) map[string]any
Treasury() GetTreasuryChart, GetTreasuryChartChainBreakdown, GetTreasuryChartTokenBreakdown []any
Oracles() GetOracleMetrics(ctx) map[string]any
Oracles() GetOracleChart, GetOracleChartChainBreakdown, GetOracleChartProtocolBreakdown []any
Oracles() GetOracleProtocolChart, GetOracleProtocolChartChainBreakdown, GetOracleChainChart, GetOracleChainChartProtocolBreakdown []any
Forks() GetForkMetrics(ctx) map[string]any
Forks() GetForkChartProtocolBreakdown, GetForkProtocolChart []any
FinancialStatements() GetIncomeStatement(ctx, protocol) map[string]any

Treasury chart methods accept *TreasuryChartOptions. Its Key is either OwnTokens or all; its Currency is usd, token, or raw when provided.3

Dimensions() offers a generic metrics/chart family. The metric parameter is locally validated against the route's declared metric set, which includes fees, liquidations, dexs, derivatives, options, aggregators, bridge-aggregators, open-interest, normalized-volume, and, on the aggregate endpoints, active-users.3

Scope Metrics method Chart methods
Aggregate GetMetrics(ctx, metric, opts) GetChart, GetChartChainBreakdown, GetChartProtocolBreakdown
Chain GetChainMetrics(ctx, metric, chain, opts) GetChainChart, GetChainChartProtocolBreakdown
Protocol GetProtocolMetrics(ctx, metric, protocol, opts) GetProtocolChart, GetProtocolChartChainBreakdown, GetProtocolChartVersionBreakdown, GetProtocolChartLabelBreakdown
Category GetCategoryMetrics(ctx, metric, category, opts) GetCategoryChart, GetCategoryChartChainBreakdown, GetCategoryChartProtocolBreakdown
Category + chain GetCategoryChainMetrics(ctx, metric, category, chain, opts) GetCategoryChainChart, GetCategoryChainChartProtocolBreakdown
chart, err := client.Dimensions().GetChainChart(ctx,
    "fees",
    "Ethereum",
    &defillama.DimensionOptions{DataType: defillama.Ptr("dailyFees")},
)
if err != nil {
    return err
}
fmt.Println("chart records:", len(chart))

Institutional, equity, and RWA data

Service Methods Return type
DAT() GetInstitutions(ctx), GetInstitution(ctx, symbol) map[string]any
Equities() GetCompaniesList(ctx) []EquityCompany
Equities() GetStatements, GetDimensions, GetSummary, GetOnchainMarkets map[string]any
Equities() GetPriceHistory, GetOHLCV, GetFilings []any
PreIPO() GetCompaniesList(ctx) []PreIPOCompany
PreIPO() GetValuations, GetRaises, GetSummary, GetIntegrations map[string]any
RWA() GetCurrentAssets(ctx) []RWAAsset
RWA() GetStats(ctx), GetList(ctx), GetAssetsByChain(ctx, chain) map[string]any
RWA() GetChainChart(ctx, chain), GetChartChainBreakdown(ctx, opts) []any

All equity detail calls take EquitiesQuery, whose required Ticker and Country become query parameters; it may also include a Timeframe. The accepted declared timeframes are 1D, 7D, 1W, 1M, 3M, 6M, YTD, 1Y, 5Y, and MAX.3

Pre-IPO detail calls take PreIPOQuery{Company: ...}. RWAChartOptions optionally accepts Key (onChainMcap, activeMcap, or defiActiveTvl), IncludeStablecoin, and IncludeGovernance.3

assets, err := client.RWA().GetCurrentAssets(ctx)
if err != nil {
    return err
}
for i, asset := range assets {
    if i == 3 {
        break
    }
    fmt.Printf("%s (%s), issuer: %s\n", asset.AssetName, asset.Ticker, asset.Issuer)
}

Other Pro groups

The following functionality is documented in focused pages to keep this page navigable.

Group Documentation
Token liquidity and Pro TVL Token Prices, Protocols and TVL
Legacy and v2 yield data Stablecoins and Yields
Derivatives, bridges, ETFs, and narratives Market Data
Pro stablecoin dominance Stablecoins and Yields

Working with flexible responses

Only stable SDK models are strongly typed. Dashboard and metric endpoints commonly return map[string]any or []any; they are deliberately not forced into premature Go structs. Inspect the payload before asserting its dynamic types or mapping it into an application-owned model. Use the official DefiLlama endpoint link in API Reference when you need field-level upstream semantics.1

References

Clone this wiki locally