API Reference
Transactions

Transactions API

Every buy and sell against a token sale contract is indexed here. Filter by token to watch a market, by account to watch a trader, or by both.

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

Endpoints

Method & pathQueryReturns
GET /api/transactionstoken_address, account_address, includes, limit, pagePaginated trade rows
GET /api/transactions/by-hashtx_hashOne trade row
GET /api/tokens/{address}/transactionsinterval, start_date, end_date, convertTo, modeAggregated series for one token
GET /api/debug/failed-transactionsNoneThe 500 most recent indexer failures

These are Superhero trade records, not raw chain transactions. For arbitrary chain history (transfers, contract calls, name transactions), use the middleware; see Node & Middleware.

GET /api/transactions

ParameterNotes
token_addressA token sale address, AEX-9 address or name, resolved through the same lookup as /api/tokens/{address}
account_addressFilter to trades made by this ak_.... A malformed address is a 400
includesOnly token. Inlines the full token object on each row
limit, pagelimit defaults to 100 and is capped at 100

Both filters compose:

# All recent trades, with the token inlined
curl -s "https://api.superhero.com/api/transactions?includes=token&limit=20&page=1"
 
# One account's trades on one token
curl -s "https://api.superhero.com/api/transactions?token_address=ct_YOUR_SALE_ADDRESS&account_address=ak_YOUR_ADDRESS&includes=token&limit=20"

Response is the standard items plus meta envelope.

Results are ordered by created_at descending, and that is the only order: there is no order_by, order_direction, from_date or to_date (unrecognised keys are ignored). To bound a date range, page from the top and stop when created_at passes your cutoff, or use GET /api/tokens/{address}/transactions, which takes start_date and end_date.

Without token_address the list is restricted to tokens from the current community factory. An unresolvable token_address returns an empty page, not a 404. account_address also adds token.name, token.symbol, token.address, token.sale_address and token.collection to each row even without includes=token.

Trade row

FieldTypeMeaning
tx_hashstringth_..., the primary key
sale_addressstringct_... of the token sale contract this trade hit
tx_typestringbuy, sell or create_community (see below)
block_heightnumberHeight of the including block
addressstringThe trader's ak_...
verifiedbooleanThe indexer settled this row: no revalidation pending and the transaction is at least 5 hours old
volumestringToken quantity traded, in whole tokens
protocol_rewardstringProtocol-fee mint attached to the trade, in whole tokens
amountPriceDtoTotal spent (buy) or received (sell), in AE
unit_pricePriceDtoamount / volume, the realised price per token, in AE
previous_buy_pricePriceDto or nullCurve buy price before this trade, in AE
buy_pricePriceDtoCurve buy price after this trade, in AE
sell_pricePriceDto or nullLegacy field
total_supplystringToken supply after the trade, in whole tokens
market_capPriceDto or nullbuy_price * total_supply, in AE, not aettos
created_atstringISO 8601, the micro-block time

With includes=token, a token object carrying the full token row is added.

Units

Nothing on a trade row needs dividing by 1e18, even though the field names repeat those on TokenDto, which are scaled:

  • volume, protocol_reward and total_supply are in whole tokens, not base units.
  • amount, unit_price, buy_price and previous_buy_price are in AE.
  • market_cap is in AE, whereas TokenDto.market_cap is in aettos. The two differ by 1e18.

tx_type

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

ValueWhat it is
buyA purchase from the bonding curve
sellA sale back into the curve
create_communityToken creation. Carries the creator's initial purchase, so it has a non-zero volume and amount and counts as a buy

Nothing else (a DEX swap, an AE transfer, a governance vote) is indexed here, and reverted transactions are skipped, so every row is a trade that succeeded.

Treat create_community as a buy. PnL, volume and trending all use tx_type IN ('buy', 'create_community') on the acquisition side and tx_type = 'sell' on the disposal side; counting only buy understates every creator's position by their founding purchase.

For the DEX's separate tx_type vocabulary, see DEX API.

GET /api/transactions/by-hash

Takes the hash as a query parameter, not a path segment:

curl -s "https://api.superhero.com/api/transactions/by-hash?tx_hash=th_YOUR_TX_HASH"

Returns a single row; a malformed hash is a 400. On a miss, the handler fetches the transaction from the middleware and indexes it on the spot, so a trade the indexer has not caught up to can be pulled in by asking for it; only if that also fails is it a 404. The DEX equivalent takes the hash as a path segment: GET /api/dex/transactions/{txHash}.

GET /api/tokens/{address}/transactions

These are aggregated rather than row-level, and charts are built from them.

ParameterNotes
intervalBucket width in seconds
start_date, end_dateISO 8601. Snake_case here, against camelCase on the account endpoints
convertToOne of the nine currency codes, default ae
modenormal or aggregated
curl -s "https://api.superhero.com/api/tokens/SUPERHERO/transactions?interval=3600&mode=aggregated&convertTo=usd"

For OHLC candles, GET /api/tokens/{address}/history is the better endpoint. See Tokens.

Live trades

The API pushes every live-indexed trade over Socket.IO on the token-history channel, carrying the row that was just written plus the token it belongs to. Seed your list from this endpoint once, then update from the socket. See WebSocket.

Relating a record to the chain

tx_hash is the on-chain transaction hash:

WhereURL
æScan (mainnet)https://aescan.io/transactions/{tx_hash}
æScan (testnet)https://testnet.aescan.io/transactions/{tx_hash}
MiddlewareGET https://mainnet.aeternity.io/mdw/v3/transactions/{tx_hash}

While a trade is confirming, poll the middleware form and treat a 404 as "still pending".

GET /api/debug/failed-transactions

A diagnostics endpoint: the 500 most recent rows of the failed-transactions table, newest first, with no parameters and no pagination.

FieldTypeMeaning
hashstringth_... of the transaction the indexer could not process
retriesnumberHow many times it has been re-attempted
errorstringThe error message
error_tracestringThe stack trace
created_atstringISO 8601

Use it when a trade of yours is missing from /api/transactions and you want to know whether the indexer failed on it.

Related