Skip to main content
Metastreams and Codex cover the same core problem: real-time token, trade, candle, holder, and wallet data for trading apps, bots, and terminals. Every Metastreams chain is also a Codex network (Solana, BNB Smart Chain, Robinhood Chain, and Elysium), so most of your integration has a direct equivalent. This guide maps every Metastreams REST endpoint and stream channel to its Codex query, subscription, or webhook, shows working side-by-side examples for the most common patterns, and ends with a copy-paste prompt you can hand to an LLM to migrate the rest of your codebase.

Mental model

Metastreams is a REST API at https://api.metastreams.io/v1/... plus one WebSocket at wss://api.metastreams.io/v1/stream. Each REST call takes a chains list of lowercase slugs (solana, bsc), lists of tokens or wallets, and costs one credit per token or wallet listed. Each stream channel (spot.trades, spot.candles, spot.tokens, and so on) takes a filter object. Codex is a single GraphQL Supergraph: one endpoint (https://graph.codex.io/graphql), one auth header, one query language, and the network is a numeric networkId argument on each field. What that means in practice:
  • One request can carry many reads. A Metastreams token page calls /v1/tokens, /v1/ohlcv, /v1/trades, and /v1/holders. On Codex, those four reads can go in one GraphQL request, and you only get back the fields you ask for.
  • Network selection lives next to the data, so the same query shape covers the four Metastreams chains plus Ethereum, Base, Arbitrum, and 80+ more networks.
  • Real-time data has two delivery options instead of one. Metastreams is WebSocket only; Codex gives you WebSocket subscriptions and webhooks, and you can mix them in the same app.
  • Billing is in compute units. Each query, subscription message, and webhook delivery has a listed cost on Compute Unit Costs, and cost does not grow with the number of tokens in a list the way Metastreams credits do.
If you’ve never used GraphQL, Learn GraphQL is a 10-minute primer that’s enough to follow the rest of this guide.

Conventions that change

The data is the same; the shapes differ. Keep this table next to you while migrating. Codex network IDs for every Metastreams chain: solana → 1399811149, bsc → 56, robinhood → 4663, elysium → 99901. For anything else, call getNetworks once and build a lookup.

Authentication

Metastreams sends Authorization: Bearer meta_.... Codex uses the same Authorization header with your API key from the dashboard, without the Bearer prefix for long-lived keys. The request body becomes GraphQL. For trying queries without writing code, use the explorer or the “Try it” panels throughout the reference.
Metastreams session tokens (POST /v1/session-tokens) map to createApiTokens: your server mints a short-lived JWT and the browser sends it as Authorization: Bearer <token>. See Authentication for the full pattern.

Endpoint mapping

The tables cover every Metastreams REST endpoint, grouped by what they return. The deprecated per-token paths (/v1/tokens/{chain}/{address}/..., /v1/wallets/balances, /v1/activity) map the same way as their collection replacements.

Security

Holders

Candles

Timeframe names change. Metastreams 1s → Codex 1S, 5s → 5S, 15s → 15S, 30s → 30S, 1m → 1, 5m → 5, 15m → 15, 30m → 30, 1h → 60, 4h → 240, 12h → 720, 1d → 1D, 7d → 7D. Metastreams 3m and 6h have no direct Codex resolution; request the next finer resolution and roll up client-side. Sub-minute resolutions cover the last 24 hours. denomination=usd is currencyCode: USD on Codex; denomination=native is currencyCode: TOKEN. Metastreams omits empty buckets; set removeEmptyBars: true on Codex for the same behavior.

Trades

Metastreams timestamps are milliseconds; Codex timestamp: { from, to } is seconds.

Wallets

Metastreams’ discovery boards (newPairs, graduating, graduated), trending boards, and token search all collapse into one Codex query: filterTokens. It filters and ranks across 100+ attributes in one request, including price, market cap, liquidity, windowed volume and transaction counts, holders, age, held percentages, launchpad state, and creator.
filterTokens has a real-time twin: onFilterTokensUpdated pushes the live, re-ranked result set for a filter as the market moves. It replaces the spot.discovery and spot.trending streams. See the Launchpads recipe and Discover Tokens recipe for worked examples.

Side-by-side examples

The five patterns below are the ones trading apps migrate first. Replace TOKEN_ADDRESS and WALLET_ADDRESS with your own values.

1. Token snapshot (metadata + price + stats)

Metastreams returns this from GET /v1/tokens. On Codex, filterTokens with a tokens list returns the same picture for up to 200 tokens in one call.
change24 is a decimal (0.0375 = 3.75%), and priceUSD, marketCap, and volume24 are strings. For safety data (Metastreams’ security object), add risk { verdict reasons buyTax sellTax } to the token selection, or query token directly. The Detailed Token Page recipe shows the full pattern.

2. OHLCV chart

Metastreams returns one object per candle; Codex returns parallel arrays (t[i], o[i], h[i], and so on). Metastreams charts default to metric=marketCap; on Codex, multiply each price by circulatingSupply[i] (or totalSupply[i] for fully diluted). For live candles, layer in onTokenBarsUpdated. See the Charts recipe for a full Lightweight Charts integration.

3. Trade tape, then stream it

Metastreams streams send only updates after you subscribe and do not replay missed frames, so their docs describe a subscribe, buffer, read REST, merge procedure. The same pattern works on Codex: open onTokenEventsCreated, then backfill with getTokenEvents using timestamp: { from } set a couple of seconds before your last seen event, and dedupe on transactionHash + logIndex. See the Events recipe.

4. Wallet trades and holdings

Metastreams splits this across /v1/trades?wallets=, /v1/balances, and /v1/positions. On Codex, one request returns the wallet’s recent trades and its holdings.
For per-token positions with average cost and realized and unrealized PnL (Metastreams’ /v1/positions), use filterTokenWallets with wallets: [...]. For the PnL summary, use detailedWalletStats. See the Trader Dashboard recipe for the full screen.

5. Discovery board column

Metastreams’ graduating column with liquidity and holder filters, as one Codex query.
Swap query for subscription and filterTokens for onFilterTokensUpdated to keep the column live, like spot.discovery.

Real-time data

Metastreams streams over one WebSocket at wss://api.metastreams.io/v1/stream with subscribe / unsubscribe / ping actions, a 30-second ping you send, and per-key limits of 20 connections, 20 subscriptions, and 2,000 addresses. Subscriptions do not survive a reconnect. Codex gives you the same data with two delivery options, and you can use both at once:
  • WebSocket subscriptions: persistent connection, updates pushed inline, API key in the connection init. Best for dashboards, trading UIs, and anything user-facing. Growth plans get 300 connections per key, and each connection can carry many subscriptions.
  • Webhooks: Codex calls an HTTP endpoint you control when an event fires. Best for alerts, background jobs, and queue-driven systems. Metastreams has no equivalent.
Cadence differs. Metastreams lets you slow a channel with throttleMs; Codex’s onPricesUpdated fires once per token per block that contains a trade, and onTokenEventsCreated fires per swap. Each delivered message costs compute units, and each open subscription costs a small amount per minute, so scope subscriptions to what you render. See Compute Units and Rate Limits for sizing.

Gaps

Things Metastreams does that Codex doesn’t, and what to do about them:
  • Wallet transfers (spot.transfers). Codex returns swaps and token lifecycle events, not plain wallet-to-wallet transfers. Pair with an RPC provider if transfer history is core to your product.
  • Wallet search by name (/v1/search?kind=spotWallet). Look wallets up by address instead.
  • Market-cap candles as a direct metric (metric=marketCap). Codex bars carry supply per bar, so you multiply price by supply yourself. Bars before 2026-10-22 have no supply value.
  • Per-subscription throttling (throttleMs). Codex sends every update; drop or merge frames client-side if your UI renders less often.
  • 30-minute and 6-hour stats windows. Use the nearest Codex window (1h, 4h, or 12h) or roll up candles.
  • Dividend-token and fee-allocation detail (dividendToken, fees breakdown). No Codex field.

What you pick up

Things Codex offers that Metastreams doesn’t:
  • 80+ networks, not 4. Everything Metastreams covers plus Ethereum, Base, Arbitrum, Polygon, Sui, and dozens more, all through the same networkId argument. See Networks.
  • One request, many reads. GraphQL lets you combine token metadata, price, holders, recent trades, and chart data in a single request and only pull the fields you render.
  • Webhooks. Server-side delivery for price, swap, and launch events, alongside WebSocket subscriptions.
  • One endpoint for almost any discovery need. filterTokens replaces the discovery boards, trending, and search, and onFilterTokensUpdated streams the same re-ranked list live.
  • Token risk verdicts. token.risk returns a verdict, score, and reason codes, plus measured buy and sell tax and sell checks on Uniswap V4 hooked pools.
  • Wallet discovery by performance. filterWallets finds wallets by PnL, win rate, or volume across networks.
  • Prediction markets. Polymarket and Kalshi events, markets, trades, and trader analytics, live today. See Prediction Markets.
  • Launchpad lifecycle as events. Creation, bonding, graduation, and migration as queryable and streamable events across 200+ launchpads. See Launchpads.
  • Liquidity locks. liquidityLocksV2 surfaces locked-LP context across major EVM chains and Solana.
  • Official TypeScript SDK. @codex-data/sdk on npm, alongside raw GraphQL from any language.
  • 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

Most Metastreams integrations span many call sites: a token service, a chart loader, a discovery board, a WebSocket handler. 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 Metastreams touchpoint, propose a plan, and run the migration with your approval.
Pair this prompt with our Codex Skills and docs MCP server so the agent can look up Codex queries on demand instead of guessing at field names.

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.
Last modified on December 3, 2026