Tokens API

Prices of many tokens at a past moment

What up to 25 tokens on one chain were worth in USD at one Unix-seconds instant, in one request, each with the instant its price actually belongs to and whether a second source agreed.

POST/api/external/token-analysis/price-history-batch/{chain}

What it returns

The price-history answer for many tokens on one chain at the same instant, in one request. Each result is exactly what price-history answers for that token: the price, the instant it actually belongs to — the nearest one held, which is not necessarily the one asked for — and whether a second source confirmed it. POST, because the list is the subject: it can run past what a URL comfortably holds, and a body keeps a watch list out of every proxy log between the caller and this service.

Chains

  • Solana SOL
  • BNB Chain BNB
  • Ethereum ETH
  • Stable STABLE
  • Base BASE
  • Robinhood Chain RHC
  • Arc ARC

Request

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

curl -X POST -H "x-dex-data-key: $DEXDATA_API_KEY" \
  -H "content-type: application/json" \
  -d '{"subjects":["<subjects>"]}' \
  "https://api.dexdata.io/api/external/token-analysis/price-history-batch/SOL?at=<at>"
Parameters
ParameterDescription
at

query · integer · required

The instant to price every token at, in Unix SECONDS. A value in the future returns 400 — and so does a millisecond timestamp, which is a date in the year 58,000.
chain

path · string · required

The chain every token in the batch lives on. All seven chains are served. CELO, ARB, OP and SCROLL return 400 here.
subjects

body · string[] · optional

Token mint addresses (Solana) or contract addresses (EVM). Between 1 and 25, each sent once.

Response fields

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

Response fields of Prices of many tokens at a past moment
FieldTypeDescription
resultsobject[]One entry per requested subject, in the order they were sent.
results[].subjectstringThe subject exactly as it was sent.
results[].resultobject | nullWhat the single-subject endpoint answers for this subject. null only when error is set.
results[].result.usdnumber | nullThe price in USD, or null when no source held one near that instant — or when two sources contradicted each other, which discards the value rather than picking one.
results[].result.atnumber | nullThe instant the price actually belongs to, in Unix seconds. Not necessarily the instant asked for: on an illiquid token the nearest price held can be hours away.
results[].result.corroboratedbooleanWhether a second source confirmed this price. false means one source answered and no other could — NOT that a second disagreed, which nulls usd instead.
results[].errorstring | nullnull, or unavailable when no source could be reached for this subject — retry it. A subject nobody has data for is NOT an error: its result says so.

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