Learn how to build a comprehensive token detail page with price, holders, safety, trades, and real-time updates
In this recipe we’ll walk through building a token detail page — the kind of page your users land on after clicking a token from a discovery feed. We’ll combine multiple Codex endpoints to populate every section: metadata, price, holders, top traders, safety signals, trade history, and real-time updates.This data powers the token pages on Defined.fi:
Start by fetching the token’s core info — name, symbol, images, social links, and safety signals. This single query gives you everything for the header of your token page.
Token verification: Codex uses isScam rather than isVerified for token safety. isScam: false is the equivalent of a token being “verified.” For Solana tokens, also check mintable and freezable — if these return an address, the token’s supply can be increased or holdings can be frozen.
Resolve the creator inline. Alongside the raw creatorAddress, EnhancedToken exposes creator, a fully resolved Wallet. Select it to pull the creator’s display name, identity labels, category, and tokensCreatedCount / tokensMigratedCount in the same call — a useful trust signal (e.g. a serial deployer) without a follow-up query.
Fetch the token’s current price, volume, and liquidity from its top trading pair using pairMetadata. This gives you the price stats panel for your dashboard.
query TokenPrice { pairMetadata( pairId: "7GtLUbEStB1xjqVcGHqpAo4hW8uFNbLKDMcoHb7QSEXY:1399811149" ) { price liquidity volume5m volume1 volume4 volume12 volume24 priceChange5m priceChange1 priceChange4 priceChange12 priceChange24 highPrice24 lowPrice24 enhancedToken0 { name symbol isScam } enhancedToken1 { name symbol isScam } }}
Finding the pair ID with listPairsWithMetadataForToken
If you don’t already have the pair ID, use listPairsWithMetadataForToken to find it. Results are sorted by liquidity so the first result is the most active pair.Test this query in the Explorer →
query TokenChart { getTokenBars( symbol: "9wK8yN6iz1ie5kEJkvZCTxyN1x5sTdNfx8yeMY8Ebonk:1399811149" from: 1740000000 to: 1740604800 resolution: "60" ) { o h l c t volume }}
subscription LiveChart { onTokenBarsUpdated( tokenId: "9wK8yN6iz1ie5kEJkvZCTxyN1x5sTdNfx8yeMY8Ebonk:1399811149" ) { aggregates { r1 { usd { o h l c t volume } } } }}
Each subscription uses one connection toward your plan’s limit (300 for Growth plans). A single token dashboard page with all four subscriptions above uses 4 connections. Share connections across subscriptions where possible — see Subscriptions › Multiple Subscriptions for guidance on how to size each connection.
Here’s the recommended data flow for a token dashboard:On page load (queries):
token — metadata, safety, social links
pairMetadata — price, volume, liquidity
holders + tokenTopTraders — holder and trader tabs
getTokenEvents — recent trade history
getTokenBars — chart OHLCV data
After load (subscriptions):
onPairMetadataUpdated — live price and volume
onTokenEventsCreated — live trade feed
onTokenBarsUpdated — live chart updates
onHoldersUpdated — live holder changes
Optimizing calls: You can reduce initial load by running queries 1-5 in parallel — they’re all independent. For the subscriptions, open them on a single WebSocket connection to minimize connection usage.