Skip to main content
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:
Token-Dashboard

Step 1: Token Metadata & Safety

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.
Test this query in the Explorer →
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.
Screen for suspicious-wallet concentration. Alongside isScam, Codex reports how much of a token’s supply sits in risky wallet cohorts. filterTokens exposes suspiciousHeldPercentage and suspiciousCount — the deduplicated union of snipers, bundlers, and insiders — plus the per-cohort sniperHeldPercentage, bundlerHeldPercentage, insiderHeldPercentage, and devHeldPercentage. These are available as result fields, filter inputs, and ranking attributes, so you can both display them and screen risky tokens out at discovery time. For launchpad tokens, the same breakdown is available inline on pairMetadata via walletActivity (shown in Step 2).
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.

Step 2: Price & Pair Data

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.
Test this query in the Explorer →
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 →
Use enhancedToken0 and enhancedToken1 to get enriched token metadata directly from the pair query — this saves you an extra call to token. The walletActivity block returns suspicious-wallet concentration (snipers, bundlers, insiders) and is populated for launchpad tokens — it’s null for others, where you should read these stats from filterTokens instead.

Step 3: Holders & Top Traders

Build the holders tab. Use holders for the top holder list and tokenTopTraders for the most active traders with PnL data.
Test this query in the Explorer →
Test this query in the Explorer →

Step 4: Trade History

Show recent buys and sells. Use getTokenEvents for the initial load and paginate with cursor for older trades.
Test this query in the Explorer →
Test this query in the Explorer →

Step 5: Chart Data

Fetch OHLCV bars for rendering a price chart. See the Charts recipe for full details on rendering with TradingView.
Test this query in the Explorer →

Step 6: Real-Time Updates

Once the page is loaded, open subscriptions to keep it live. Here are the key subscriptions for a token dashboard:
Subscribe to onPairMetadataUpdated to keep price, volume, and liquidity current without polling.Test this query in the Explorer →
Subscribe to onTokenEventsCreated to stream new trades as they happen.Test this query in the Explorer →
Subscribe to onTokenBarsUpdated to keep the chart updating in real time.Test this query in the Explorer →
Subscribe to onHoldersUpdated to keep the holders list current.Test this query in the Explorer →
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.

Putting It All Together

Here’s the recommended data flow for a token dashboard: On page load (queries):
  1. token — metadata, safety, social links
  2. pairMetadata — price, volume, liquidity
  3. holders + tokenTopTraders — holder and trader tabs
  4. getTokenEvents — recent trade history
  5. getTokenBars — chart OHLCV data
After load (subscriptions):
  1. onPairMetadataUpdated — live price and volume
  2. onTokenEventsCreated — live trade feed
  3. onTokenBarsUpdated — live chart updates
  4. 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.

Subscriptions vs Queries Quick Reference

Check out the related endpoints in their respective pages: