API Reference
DEX

DEX API

The DEX endpoints cover the constant-product AMM behind Superhero's swap UI: listed tokens and prices, liquidity pairs and reserves, swap routes, and every swap and liquidity event. The bonding-curve counterpart is Tokens.

All paths are relative to https://api.superhero.com. Reads need no authentication.

Endpoints

Tokens

Method & pathQueryReturns
GET /api/dex/tokensorder_by, order_direction, listed, search, limit, pagePaginated DexTokenDto
GET /api/dex/tokens/{address}NoneOne DexTokenDto
GET /api/dex/tokens/{address}/priceNoneToken plus current price
GET /api/dex/tokens/{address}/price/analysisbase_token, debugLiquidity-weighted price with confidence metrics
GET /api/dex/tokens/{address}/summaryNoneDexTokenSummaryDto
GET /api/dex/tokens/{address}/historyinterval, convertTo, limit, pageOHLCV candles
PATCH /api/dex/tokens/{address}/listedNoneSet the listed flag. Requires an API key

Pairs

Method & pathQueryReturns
GET /api/dex/pairsorder_by, order_direction, token_address, search, limit, pagePaginated PairDto
GET /api/dex/pairs/{address}NoneOne PairDto
GET /api/dex/pairs/from/{from_token}/to/{to_token}NoneThe direct pair for two tokens
GET /api/dex/pairs/from/{from_token}/to/{to_token}/providersNoneAll swap paths, direct and multi-hop
GET /api/dex/pairs/{address}/historyinterval, from_token, convertTo, limit, pagePair price history
GET /api/dex/pairs/{address}/summarytokenPairSummaryDto
GET /api/dex/pairs/{address}/previewintervalCompact preview payload

Transactions and routing

Method & pathQueryReturns
GET /api/dex/transactionsorder_by, order_direction, pair_address, token_address, tx_type, account_address, from_date, to_date, limit, pagePaginated PairTransactionDto
GET /api/dex/transactions/{txHash}NoneOne PairTransactionDto
GET /api/dex/transactions/pair/{pairAddress}order_by, order_direction, limit, pageTransactions for one pair
GET /api/dex/swap-routes/{from_token}/{to_token}NoneAll quotable routes

DexTokenDto

FieldTypeMeaning
addressstringct_... of the token contract
namestringToken name
symbolstringTicker
decimalsnumberDecimal places. A number here, unlike the string on TokenDto
pairs_countnumberHow many pairs include this token
created_atstringISO 8601
is_aebooleanWhether this token is AE itself
listedbooleanOfficially listed or featured by the DEX
pricePriceDtoCurrent price, all nine currencies. An object, not a string
summaryDexTokenSummaryDto or nullAggregated volume and change across all pools. Null when not computed

decimals is a number here and a string on the bonding-curve TokenDto; price is a PriceDto object here and a decimal string there. Do not share a parser between the two.

order_by accepts pairs_count, name, symbol, created_at, price, tvl, 24hchange, 24hvolume, 7dchange, 7dvolume, 30dchange, 30dvolume. Pass listed=true to restrict to curated tokens, listed=false for the rest, and omit it for everything.

curl -s "https://api.superhero.com/api/dex/tokens?listed=true&order_by=tvl&order_direction=DESC&limit=20"

DexTokenSummaryDto carries address, total_volume (a PriceDto) and change, a map keyed by period, or null.

PairDto

FieldTypeMeaning
addressstringct_... of the pair contract
token0DexTokenDtoFirst token, fully inlined
token1DexTokenDtoSecond token, fully inlined
reserve0stringReserve of token0, in that token's base units
reserve1stringReserve of token1, in that token's base units
total_supplystringLP token supply, in base units
transactions_countnumberLifetime transactions on the pair
created_atstringISO 8601

Reserves and LP supply are big-integer strings in base units. Divide each by 10 raised to its own token's decimals, which may differ between the two sides.

curl -s "https://api.superhero.com/api/dex/pairs?order_by=transactions_count&order_direction=DESC&limit=20"

PairSummaryDto adds volume and price change over 24h, 7d and 30d:

FieldTypeMeaning
addressstringThe pair
volume_tokenstringWhich token volume is denominated in
token_positionstringWhether that token is position 0 or 1
total_volumePriceDtoLifetime volume
changeobject or null24h, 7d and 30d, each with volume (a PriceDto) and price_change (percentage and value, both strings)

Pass ?token=ct_... to choose the denominating side; without it the endpoint defaults to WAE when one side of the pair is WAE.

PairTransactionDto

One row per swap or liquidity event.

FieldTypeMeaning
tx_hashstringth_...
account_addressstring or nullWho submitted it
block_heightnumberInclusion height
pairPairDtoThe pair, inlined
tx_typestringThe router entrypoint that was called (see below)
reserve0 / reserve1stringReserves after the transaction, in base units
ratio0stringPrice of token0 quoted in token1: reserve0 / reserve1
ratio1stringPrice of token1 quoted in token0
total_supplystringLP supply after the transaction
volume0 / volume1stringTraded volume per side for swaps; 0 for liquidity operations
market_cap0 / market_cap1stringMarket cap denominated in each token
market_capstringPool market cap
swap_infoSwapInfoDto or nullPresent for swaps
pair_mint_infoLiquidityInfoDto or nullPresent for liquidity operations
created_atstringISO 8601

LiquidityInfoDto is type (PairMint or PairBurn) plus amount0 and amount1.

tx_type

tx_type is the name of the router entrypoint that was called. The complete set:

swap_exact_tokens_for_tokens     add_liquidity
swap_tokens_for_exact_tokens     add_liquidity_ae
swap_exact_tokens_for_ae         remove_liquidity
swap_tokens_for_exact_ae         remove_liquidity_ae
swap_exact_ae_for_tokens
swap_ae_for_exact_tokens

The tx_type filter is exact-match, so ?tx_type=swap matches nothing; to select all swaps, make six requests or filter client-side on the swap_ prefix. PairMint and PairBurn are the pair contract's event names and appear only inside pair_mint_info.type: add_liquidity* carries a PairMint, remove_liquidity* a PairBurn.

Date filters on this endpoint are from_date and to_date, both ISO 8601, both bounds inclusive. order_by accepts created_at (the default) or tx_type; anything else is a 400.

# Every "exact tokens in" swap, newest first
curl -s "https://api.superhero.com/api/dex/transactions?tx_type=swap_exact_tokens_for_tokens&limit=20&order_direction=DESC"

Fetch a single transaction by hash as a path segment (GET /api/dex/transactions/{txHash}), unlike the bonding-curve equivalent, which takes a tx_hash query parameter.

GET /api/dex/swap-routes/{from_token}/{to_token}

Returns an array of routes, each an ordered array of pairs, covering direct and single-hop paths. An empty array means no route exists.

FieldTypeMeaning
addressstringThe pair contract
synchronizedbooleanWhether the pair has usable non-zero reserves on both sides
token0 / token1stringThe two token addresses
liquidityInfoobjectReserve information for quoting

A route containing an unsynchronized pair is not quotable, so check synchronized on every hop.

curl -s "https://api.superhero.com/api/dex/swap-routes/ct_FROM_TOKEN/ct_TO_TOKEN"

GET /api/dex/pairs/from/{from_token}/to/{to_token}/providers is the broader form, returning all possible paths including multi-hop.

GET /api/dex/tokens/{address}/history

OHLCV for a single token. The series is derived from the deepest pool pairing that token against WAE, so the price is expressed in AE; if no WAE pool exists, the deepest available pool is used.

ParameterNotes
intervalCandle width in seconds. Default 3600, minimum 60, maximum 86400. Outside that range is a 400
convertToDefault ae. Fiat conversion uses the AE-to-currency rate as of each candle's own timestamp
limit, pageStandard pagination

Requesting a fiat convertTo for a token without a WAE-quoted pool returns 400.

GET /api/dex/pairs/{address}/history is the pair-level equivalent and adds from_token, which takes token0 or token1 to choose the quoting direction.

GET /api/dex/tokens/{address}/price

{ "price": "0.0431", "token": {} }

token is the full DexTokenDto; price is the best price found, quoted in WAE, as a decimal string. It is null when the token has no liquid path to WAE. The value comes from the deepest-liquidity path, not the median. A 404 means the token is unknown to the DEX index.

GET /api/dex/tokens/{address}/price/analysis

The same computation with its working shown:

FieldTypeMeaning
pricestring or nullThe best price, the same value the /price route returns
confidencenumber0 to 1
bestPatharray of pairsThe route the price came from
allPathsarrayEvery path considered, each with path, price, liquidity and confidence
liquidityWeightedPricestring or nullWeighted across all paths
medianPricestring or nullMedian across all paths, for comparison

base_token defaults to WAE; debug=true widens the per-path breakdown. Asking for the base token's price against itself returns "1". A token with no path at all is a 404 (No price paths found for token ...).

A wide spread between price, medianPrice and liquidityWeightedPrice means the quote rests on one shallow pool.

PATCH /api/dex/tokens/{address}/listed

Sets the listed flag. Body is { "listed": true } or { "listed": false }; returns the updated DexTokenDto, or 404 for an unknown token.

Requires the API key, sent as x-api-key: YOUR_KEY or Authorization: Bearer YOUR_KEY. A missing or wrong key is a 401. Every other write in the API uses a wallet signature. See Conventions.

Pagination on /api/dex/*

limit defaults to 100 and is capped at 100. Unlike the rest of the API, exceeding the cap does not error: limit=500 is silently clamped to 100, page=0 to 1, and a non-numeric limit falls back to 100. Read meta.itemsPerPage rather than assuming your limit was honoured, and never infer "no more results" from getting fewer rows than you asked for.

Related

  • API Conventions: pagination, the limit cap and the date-parameter spellings
  • Tokens API: the bonding-curve tokens and their TokenDto
  • Transactions API: bonding-curve trades
  • Swap: the feature these endpoints back
  • Pools: what a pair is and what providing liquidity means
  • Wrapped AE: why WAE is the pricing base for every history series