If your product depends on Bitquery’s low-level surface — mempool/pending transactions, decoded logs and instructions across arbitrary contracts, ad-hoc aggregations over any onchain event, NFT trades, or non-EVM chains like Bitcoin, Tron, or Cardano — Codex is not a drop-in replacement for those. See Gaps for the specifics. If you use Bitquery for DEX trades, prices, OHLCV, token metadata, holders, balances, or wallet activity, everything you rely on has a Codex equivalent, usually a shorter one.
Mental model
Bitquery organizes data as a cube: you enter a chain-family block (EVM(network: eth, dataset: combined), Solana, Tron), pick a dataset inside it (DEXTrades, DEXTradeByTokens, BalanceUpdates, Holders, Transfers), and then filter, group, and aggregate the raw rows to produce the answer you want. It’s powerful and general — you can compute almost anything — but you own the aggregation logic, and every query is priced by how much data it touches.
Codex is a single Supergraph of purpose-built fields. One endpoint (https://graph.codex.io/graphql), one auth header, and the network is a numeric networkId parameter. Instead of assembling candles from a trade stream, you call getTokenBars. Instead of grouping DEXTrades by trader to compute profit, you call detailedWalletStats. Instead of inferring “is this a scam” from raw data, you read isScam off the token.
What that means in practice:
- You stop hand-rolling aggregations. OHLCV, trending, holder concentration, wallet PnL, buy/sell volume splits, and multi-timeframe stats are first-class fields, not queries you assemble and maintain.
- The network is a parameter, not a top-level block. You stop nesting everything under
EVM(network: ...)/Solana. PassnetworkId(ornetworks: [Int!]onbalances) and the same query covers any of 80+ networks. - You pull, not compute, safety and lifecycle data. Scam flags, mint/freeze authorities, launchpad graduation, and liquidity locks are indexed and returned directly.
- Queries get shorter. “Give me this token’s current price” is a single
getTokenPricescall, not a trade query you sort and read the latest price from.
networkId, cursors).
Authentication
Bitquery’s V2 API uses OAuth2: you exchange aclient_id/client_secret for a short-lived Bearer token at oauth2.bitquery.io, then send it as Authorization: Bearer <token> against https://streaming.bitquery.io/graphql. (The legacy V1 endpoint graphql.bitquery.io used an X-API-KEY header; if your integration still uses it, you’re on the old model.) Codex uses a single long-lived Authorization header with an API key from the dashboard — no token-exchange step.
createApiTokens and pass it as Bearer <token>. See Authentication for the full pattern.
Endpoint mapping
Bitquery is addressed by dataset, not by URL, so this table pairs each Bitquery dataset (and the common query pattern built on it) with the Codex field that returns the same thing directly.DEX trades and events
Prices and OHLCV
Token data
Holders and balances
Wallets and traders
Discovery, pairs, and markets
Launchpads and prediction markets
Side-by-side examples
The four patterns below are the ones most Bitquery integrations start from. Codex addresses come through asaddress:networkId; Bitquery keeps the network in the top-level block.
1. DEX trades for a token
onTokenEventsCreated.
2. OHLCV chart
Bitquery has no stored candle — you either use the Crypto Price API’s pre-aggregatedOhlc block or bucket DEXTradeByTokens by a time interval and derive open/high/low/close yourself. Codex returns bars directly.
1S, 5S, 15S, 30S, 1, 5, 15, 30, 60, 240, 720, 1D, 7D (1-second up to weekly). Sub-minute bars are retained for the last 24 hours. Layer in onBarsUpdated for live updates, and see the Charts recipe for a full Lightweight Charts integration.
3. Token holders
top10HoldersPercent on the same response, so a concentration metric doesn’t need a second query. Note that Bitquery deprecated the older TokenHolders(date:) dataset in June 2026 in favor of the Holders cube shown here; the Codex query is unaffected either way.
4. Wallet balances
BalanceUpdate_Amount or join a separate price query. For wallet-level PnL and volume, see detailedWalletStats and the Wallets recipe.
Real-time data
Both APIs deliver real-time data over GraphQL WebSocket subscriptions, so the mechanics port cleanly — swap thesubscription { EVM { … } } block for the matching Codex subscription. The difference is that Codex also offers webhooks (Bitquery does not), so server-side consumers don’t have to hold open a socket.
For enterprise-scale throughput, Bitquery offers Kafka and gRPC streams; Codex’s equivalent for high-volume server-side delivery is webhooks via
createWebhooks.
Gaps
Things Bitquery does that Codex doesn’t, and what to do about them:- Mempool / pending transactions (
EVM(mempool: true)). Codex indexes confirmed onchain data, not the pending pool. If you build MEV, sandwich detection, or pre-confirmation UX, keep Bitquery or an RPC/mempool provider for that surface. - Raw and decoded logs, calls, and instructions across arbitrary contracts (
Events,Calls, SolanaInstructions). Codex is a curated DEX/token API, not a general log indexer. For decoding arbitrary contract activity, pair Codex with an RPC provider or a log-indexing service. - Ad-hoc aggregations over any onchain field. Bitquery’s cube model lets you group and aggregate almost anything. Codex exposes fixed, purpose-built aggregates (stats, PnL, holder concentration); it doesn’t run arbitrary group-bys.
- Historical point-in-time balances. Bitquery reconstructs a wallet’s balance at any past date from
BalanceUpdates. Codex returns current balances; for historical snapshots, combine event history yourself or keep Bitquery for that query. - NFT trades and collection analytics. Codex is a fungible-token API. Pair with a dedicated NFT provider (Reservoir, OpenSea, Alchemy NFT).
- Non-EVM/UTXO chains Codex doesn’t index (Bitcoin, Litecoin, Cardano, Tron, XRP, and others). Codex covers 80+ EVM networks plus Solana, Sui, Aptos, and Tron-family where indexed — check Networks. For chains outside that list, keep Bitquery.
- Kafka / gRPC stream transports. Codex delivers real-time via WebSocket subscriptions and webhooks, not Kafka topics or gRPC.
What you pick up
Things Codex offers that Bitquery makes you build or doesn’t have:- First-class token safety signals.
isScam,mintable,freezable,creatorAddress, and top-holder concentration are indexed on thetokenobject. In Bitquery you’d infer these from raw supply and authority data. - Wallet PnL and trader discovery, ready-made.
detailedWalletStats,walletChart,tokenTopTraders, andfilterWalletsreturn realized PnL, win-rate, and volume directly — no groupingDEXTradesby trader and computing profit yourself. - Launchpad lifecycle as an abstraction. pump.fun, LetsBonk, Believe, and other launchpads modeled as lifecycle events with bonding-curve state, graduation, and migration — instead of raw
Instructionsyou decode. See Launchpads. - Prediction markets across venues. Both Polymarket and Kalshi via the
filterPredictionEventsfamily, at the event/market/trader level, not raw Polygon logs. - First-class trending and discovery.
filterTokens/filterPairsranked by trending score, volume, or market cap — no “GMGN-style” aggregation query to maintain. - OHLCV without candle assembly. Stored bars from 1-second to weekly via
getTokenBarsandgetBars. - Simpler ergonomics. One API-key header (no OAuth token exchange), one endpoint, a one-call
getTokenPrices, and an official TypeScript SDK (@codex-data/sdk). Webhooks mean server consumers don’t have to hold a socket open. - Built for AI agents. A docs MCP server, prebuilt Codex Skills for Claude/Cursor/Codex CLI, and pay-per-query access via MPP.
AI migration prompt
Bitquery integrations tend to concentrate in a few files — a GraphQL client, a set of query strings, and the aggregation code that turns raw rows into prices, candles, or PnL. Hand the prompt below to an IDE agent (Claude Code, Cursor, Codex CLI, or similar), run it from the repo root, and it will find every Bitquery touchpoint, propose a plan, and execute the migration with your approval.Getting help
- Browse the API Reference for the full schema.
- Skim the Recipes for end-to-end examples that solve specific product problems.
- Ask in our community if you hit a wall during migration.