Documentation Index
Fetch the complete documentation index at: https://docs.codex.io/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Codex API offers two ways to get data: queries and subscriptions. Many endpoints have both a query and a subscription version that return the same data — the difference is how you receive it.| Query | Subscription | |
|---|---|---|
| Protocol | HTTP (POST to https://graph.codex.io/graphql) | WebSocket (wss://graph.codex.io/graphql) |
| How it works | You request data, you get a response | You subscribe once, data is pushed to you as it changes |
| Best for | Page loads, historical data, one-time lookups | Live feeds, real-time dashboards, streaming updates |
| Billing | 1 request per query execution | 1 request per message received |
| Plan requirement | All plans | Growth or Enterprise |
Which Should I Use?
Use a query when...
Use a query when...
- You need data once (e.g. loading a page, fetching a wallet’s history)
- You need historical data (e.g. OHLCV bars from last week)
- You need to paginate through large result sets (e.g. filtering tokens)
- You’re on a Free plan
Use a subscription when...
Use a subscription when...
- You need real-time updates (e.g. live price ticker, streaming trades)
- You want data pushed to you instantly as it happens
- You’re building a live dashboard or trading bot
- You want to avoid polling the API repeatedly
Endpoint Mapping
The table below maps each subscription to its query equivalent. Both return the same data — the query fetches it on-demand, while the subscription streams updates as they happen.Unconfirmed events: Several subscriptions accept a
commitmentLevel argument. Set it to processed to receive events as soon as they’re observed on-chain (unconfirmed; may be reorged out), or confirmed (default) to receive them only after confirmation. This replaces the previously separate onUnconfirmed* subscriptions. processed is currently available on Solana only.Token Data
| Subscription | Query Equivalent | Description |
|---|---|---|
onPriceUpdated | getTokenPrices | Price for a single token |
onPricesUpdated | getTokenPrices | Prices for multiple tokens (up to 25) |
onTokenBarsUpdated | getTokenBars | Token-level OHLCV bars |
onDetailedTokenStatsUpdated | getDetailedTokenStats | Detailed token statistics |
onTokenEventsCreated | getTokenEvents | Swap/trade events for a token |
onTokenLifecycleEventsCreated | tokenLifecycleEvents | Token lifecycle events (mint, burn, etc.) |
onFilterTokensUpdated | filterTokens (with matching filters) | Live-streamed updates to a filterTokens result set |
onFilterTokensUpdated is self-initializing — the first message delivers the current state, so you don’t need to pair it with a separate filterTokens query. The subscription re-evaluates internally every 30 seconds, and if the result set changes you’ll automatically start receiving updates for the new set.Pair Data
| Subscription | Query Equivalent | Description |
|---|---|---|
onBarsUpdated | getBars | Pair-level OHLCV bars |
onDetailedStatsUpdated | getDetailedPairStats | Detailed pair statistics |
onPairMetadataUpdated | pairMetadata | Pair metadata (volume, liquidity, supply) |
Events
| Subscription | Query Equivalent | Description |
|---|---|---|
onEventsCreated | getTokenEvents | Trade events for a pair |
onEventsCreatedByMaker | getTokenEventsForMaker | Trades by a specific wallet |
onEventLabelCreated | getEventLabels | Event labels (sandwich, front-run, etc.) |
Balances & Holders
| Subscription | Query Equivalent | Description |
|---|---|---|
onHoldersUpdated | holders | Token holder list updates |
onBalanceUpdated | balances | Wallet balance updates |
Launchpads
| Subscription | Query Equivalent | Description |
|---|---|---|
onLaunchpadTokenEvent | filterTokens (with launchpad filters) | Individual launchpad token events |
onLaunchpadTokenEventBatch | filterTokens (with launchpad filters) | Batched launchpad token events |