DeFi protocols API

A protocol's history split by chain, version, fee kind or token

One DeFi protocol's daily value locked, fees, revenue, volume or treasury, one series per chain, protocol version, kind of fee or treasury token, largest first.

GET/api/external/protocol-analysis/protocol-history-breakdown/{slug}

What it returns

One protocol's daily history for the metric chosen with metric, split the way chosen with by, over the trailing window in days: one series per part, largest first. by=chain: per network. by=version: per version of the protocol (e.g. V2, V3). by=label: per kind of fee (e.g. borrow interest, liquidation fees). by=token: per token the treasury holds, by symbol. Offered splits: tvl: chain; fees: chain, version, label; revenue: chain, version, label; volume: chain, version; treasury: chain, token. Days, units and the window follow protocol-history: tvl and treasury are the value at 00:00 UTC plus one latest reading of today; the others are one total per UTC day, and revenue can be negative. A part holds only the days that name it: a missing day is left out, never shown as 0. Parts are ranked by their total over the window for fees, revenue and volume, and by their value on the newest day for tvl and treasury; partsRanked says how many the window names before limit. A protocol that is unknown, or that has no such series, answers 404.

Chains

This endpoint is not tied to a chain: it takes no chain in its request.

Request

Send your key in the x-dex-data-key header. Replace each <placeholder> with a real value.

curl -H "x-dex-data-key: $DEXDATA_API_KEY" \
  "https://api.dexdata.io/api/external/protocol-analysis/protocol-history-breakdown/<slug>"
Parameters
ParameterDescription
metric

query · string · optional

Which series. tvl: the value locked. fees: what users paid. revenue: the part of the fees the protocol kept. volume: what was traded on it. treasury: what the protocol itself holds. Defaults to tvl.tvlfeesrevenuevolumetreasury
by

query · string · optional

How to split it. tvl: chain; fees: chain, version, label; revenue: chain, version, label; volume: chain, version; treasury: chain, token. Defaults to chain.chainversionlabeltoken
days

query · string · optional

How many trailing days to return, or all for the whole series. Defaults to 90.73090180365all
limit

query · integer · optional

How many parts to return, largest first, 1 to 50. Defaults to 10.
slug

path · string · required

A DeFi protocol's slug, e.g. "pancakeswap-amm" — not a token mint or contract address, and not scoped to any single chain.

Response fields

A JSON response. Every field is always present; null means the value could not be established, never zero.

Response fields of A protocol's history split by chain, version, fee kind or token
FieldTypeDescription
slugstringThe protocol asked about.
metricstringThe series returned.
bystringHow it is split.
daysstringThe window returned.
partsRankedintegerHow many parts the window names, before limit is applied.
partsobject[]Largest first; ties ordered by name. Empty only when the window names no part.
parts[].namestringThe part: a network (Ethereum), a version (Aave V3), a kind of fee (Borrow Interest) or a token symbol.
parts[].pointsobject[]Oldest first; only the days that name this part.
parts[].points[].timestampintegerUnix seconds: 00:00 UTC of the day, except the extra newest tvl and treasury point.
parts[].points[].usdnumberIn USD: the value at that time for tvl and treasury, the day total otherwise.

Start building with DexData today

Sign in, create a key and make your first call in a minute. Free credits every month, and you only pay for calls that succeed.

Get a free API key