> ## 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.

# getTokenBars

> Returns aggregated bar chart data to track price changes over time. getTokenBars query reference: arguments and response fields.

## GraphQL

```
type Query {
  getTokenBars(
    symbol: String!
    from: Int!
    to: Int!
    resolution: String!
    currencyCode: QuoteCurrency
    removeLeadingNullValues: Boolean
    removeEmptyBars: Boolean
    statsType: TokenPairStatisticsType
    countback: Int
  ): TokenBarsResponse
}

type SocialLinks {
  bitcointalk: String
  blog: String
  coingecko: String
  coinmarketcap: String
  discord: String
  email: String
  facebook: String
  github: String
  instagram: String
  linkedin: String
  reddit: String
  slack: String
  telegram: String
  twitch: String
  twitter: String
  website: String
  wechat: String
  whitepaper: String
  youtube: String
  tiktok: String
}

type TokenInfo {
  id: String!
  address: String!
  circulatingSupply: String
  cmcId: Int
  gridAssetId: String
  bluechipRating: String
  isScam: Boolean
  name: String
  networkId: Int!
  symbol: String!
  totalSupply: String
  imageThumbHash: String
  imageThumbUrl: String
  imageSmallUrl: String
  imageLargeUrl: String
  imageBannerUrl: String
  videoExternalUrl: String
  description: String
}

type OrganizationUrl {
  url: String!
  type: String
}

type OrganizationSocial {
  url: String!
  type: String
}

type AssetDeployment {
  id: String!
  networkId: Int!
  address: String!
  standard: String
  assetId: String!
  rootId: String!
  token: EnhancedToken
}

type Asset {
  id: String!
  name: String
  description: String
  ticker: String
  type: String
  status: String
  icon: String
  rootId: String!
  assetDeployments: [AssetDeployment!]!
}

type Organization {
  name: String!
  foundingDate: String
  descriptionShort: String
  descriptionLong: String
  tagLine: String
  type: String
  sector: String
  urls: [OrganizationUrl!]!
  socials: [OrganizationSocial!]!
  logo: String
  icon: String
  header: String
  rootId: String!
  assets: [Asset!]!
}

type ExplorerTokenData {
  id: String!
  blueCheckmark: Boolean
  description: String
  divisor: String
  tokenPriceUSD: String
  tokenType: String
}

type Exchange {
  id: String!
  address: String!
  color: String
  name: String
  exchangeVersion: String
  iconUrl: String
  networkId: Int!
  tradeUrl: String
}

enum WalletCategory {
  NORMIE
  TOKEN_CREATOR
  EXCHANGE
  DEFI_EXCHANGE
  PAIR
  PAIR_TOKEN_HOLDER
  POOL_AUTHORITY
  STAKING_VAULT
  NOTORIOUS
  BURN
  LOCKER
}

type WalletFunding {
  fundedByAddress: String!
  fundedByLabel: String
  fundedAt: Int!
  tokenAddress: String!
  networkId: Int!
  amount: String!
  transactionHash: String!
}

type WalletPolymarketProfile {
  proxyWallet: String!
  xUsername: String
  displayName: String
  pseudonym: String
  profileImageUrl: String
  verifiedBadge: Boolean
  displayUsernamePublic: Boolean
  fetchedAt: Int!
}

type Wallet {
  address: String!
  category: WalletCategory
  firstSeenTimestamp: Int
  firstFunding: WalletFunding
  identityLabels: [String!]
  avatarUrl: String
  displayName: String
  twitterId: String
  twitterUsername: String
  telegramId: String
  telegramUsername: String
  website: String
  discordId: String
  discordUsername: String
  githubId: String
  githubUsername: String
  farcasterId: String
  farcasterUsername: String
  description: String
  ethosScore: Int
  ethosLevel: String
  ethosVerified: Boolean
  tradeSourceIds: [String!]
  identitySource: String
  identityUpdatedAt: Int
  polymarket: WalletPolymarketProfile
  tokensCreatedCount: Int
  tokensMigratedCount: Int
}

enum FeeMode {
  CREATOR_FEE
  CASHBACK
  HOLDER_REWARDS
}

type LaunchpadData {
  launchpadName: String
  graduationPercent: Float
  poolAddress: String
  completedAt: Int
  completed: Boolean
  completedSlot: Int
  migratedSlot: Int
  migratedAt: Int
  migrated: Boolean
  migratedPoolAddress: String
  launchpadProtocol: String
  launchpadIconUrl: String
  feeModes: [FeeMode!]
  holderRewardFeeBps: Int
  holderRewardQuoteMint: String
  category: String
}

type TokenExtrema {
  id: String!
  address: String!
  networkId: Int!
  athPrice: String!
  athPriceTimestamp: Int!
  atlPrice: String!
  atlPriceTimestamp: Int!
  athFdv: String!
  athFdvTimestamp: Int!
  atlFdv: String!
  atlFdvTimestamp: Int!
  athCircMc: String!
  athCircMcTimestamp: Int!
  atlCircMc: String!
  atlCircMcTimestamp: Int!
}

type CoinCommunity {
  id: String!
  createdAt: Int!
  postCount: Int!
  memberCount: Int!
  likeCount: Int!
  lastPostAt: Int
}

type Token2022ScaledUiAmountConfig {
  authority: String
  multiplier: Float!
  newMultiplierEffectiveTimestamp: String
  newMultiplier: Float
}

type Token2022TransferFee {
  epoch: String!
  transferFeeBasisPoints: Int!
  maximumFee: String!
}

type Token2022TransferFeeConfig {
  transferFeeConfigAuthority: String
  olderTransferFee: Token2022TransferFee!
  newerTransferFee: Token2022TransferFee!
}

type Token2022Extensions {
  scaledUiAmountConfig: Token2022ScaledUiAmountConfig
  transferFeeConfig: Token2022TransferFeeConfig
}

type B20Extensions {
  multiplier: String
  multiplierObservedAt: String
  pausedTransfer: Boolean
  pausedMint: Boolean
  pausedBurn: Boolean
  supplyCap: String
}

type RobinhoodStockTokenExtensions {
  uid: String!
  multiplier: String
  multiplierObservedAt: String
  newMultiplier: String
  newMultiplierEffectiveAt: String
  oraclePaused: Boolean
}

type XStockTokenExtensions {
  multiplier: String
  multiplierObservedAt: String
  newMultiplier: String
  newMultiplierEffectiveAt: String
}

type TokenExtensions {
  token2022: Token2022Extensions
  b20: B20Extensions
  robinhoodStockToken: RobinhoodStockTokenExtensions
  xStock: XStockTokenExtensions
}

type Erc7572CustomInfo {
  type: String!
  featuredImage: String
  collaborators: [String!]
}

enum CategoryType {
  CANONICAL
  NARRATIVE
}

enum CategoryStatus {
  DRAFT
  ACTIVE
  ARCHIVED
}

type Category {
  id: String!
  name: String!
  shortName: String
  slug: String!
  description: String
  type: CategoryType!
  status: CategoryStatus!
  parentId: String
  memberCount: Int
}

enum RiskVerdict {
  SCAM
  HIGH_RISK
  CAUTION
  NEUTRAL
  VERIFIED
  VERIFIED_CONTESTED
}

enum RiskAnalysisCoverage {
  NOT_ANALYZED
  INCONCLUSIVE
  ANALYZED
  STALE
}

enum RiskReasonCode {
  PROOF_HONEYPOT_SIM
  PROOF_NON_TRANSFERABLE
  PROOF_TRANSFER_FEE_100
  PROOF_DEFAULT_FROZEN
  PROOF_POOL_TRAP_SIM
  AUTH_MINT
  AUTH_FREEZE
  AUTH_PERMANENT_DELEGATE
  AUTH_TRANSFER_HOOK
  AUTH_PAUSABLE
  AUTH_OWNER_NOT_RENOUNCED
  AUTH_CAN_TRANSFER_OWNERSHIP
  TAX_BUY_HIGH
  TAX_SELL_HIGH
  TAX_HONEYPOT_UNCONFIRMED
  TAX_PAUSED
  TAX_POOL_TRAP
  TAX_POOL_TRAP_HOOK_SHARED
  LIQ_MINIMAL
  LIQ_UNKNOWN
  LIQ_RUG_CLIFF
  LIQ_UNLOCKED
  LIQ_DRAINING
  HOLD_TOP10_CONCENTRATED
  HOLD_DEV_HEAVY
  HOLD_SNIPER_HEAVY
  HOLD_BUNDLER_HEAVY
  HOLD_INSIDER_HEAVY
  HOLD_INSIDER_DUMPED
  FLOW_ONE_WAY
  FLOW_WALLET_FARM
  FLOW_WASH_DOMINATED
  FLOW_BUNDLED_LAUNCH
  FLOW_MECHANICAL_TRADING
  FLOW_RING_DOMINATED
  REP_SERIAL_RUGGER
  REP_RISKY_CREATOR
  REP_SCAMMER_FUNDED
  REP_IMITATOR_SYMBOL
  REP_IMITATOR_NAME
  REP_IMITATOR_IMAGE
  LABEL_MANUAL_SCAM
  LABEL_VERIFIED
}

type TokenRisk {
  verdict: RiskVerdict
  score: Float
  flaggedAt: Int
  analyzedAt: Int
  coverage: RiskAnalysisCoverage
  reasons: [RiskReasonCode!]
  buyTax: Float
  sellTax: Float
}

type TokenIssuer {
  id: String!
  displayName: String
}

type EnhancedToken {
  id: String!
  address: String!
  cmcId: Int
  decimals: Int!
  isScam: Boolean
  name: String
  networkId: Int!
  symbol: String
  socialLinks: SocialLinks
  info: TokenInfo
  gridAssetId: String
  bluechipRating: String
  organization: Organization
  asset: Asset
  exchanges: [Exchange!]
  creatorAddress: String
  creator: Wallet
  creatorBalanceNBT: String
  createBlockNumber: Int
  createTransactionHash: String
  createdAt: Int
  mintable: String
  freezable: String
  isFreezableValid: Boolean
  isMintableValid: Boolean
  launchpad: LaunchpadData
  top10HoldersPercent: Float
  profanity: Boolean
  extrema: TokenExtrema
  coinCommunity: CoinCommunity
  extensions: TokenExtensions
  tokenStandardCustomData: Erc7572CustomInfo
  categories: [Category!]
  risk: TokenRisk
  issuer: TokenIssuer
}

type TokenBarsResponse {
  o: [Float]!
  h: [Float]!
  l: [Float]!
  c: [Float]!
  t: [Int!]!
  s: String!
  volume: [String]
  volumeNativeToken: [String]
  buyers: [Int]!
  buys: [Int]!
  buyVolume: [String]!
  sellers: [Int]!
  sells: [Int]!
  sellVolume: [String]!
  liquidity: [String]!
  totalSupply: [String]
  circulatingSupply: [String]
  traders: [Int]!
  transactions: [Int]!
  poolFees: [String]
  baseFees: [String]
  priorityFees: [String]
  builderTips: [String]
  l1DataFees: [String]
  totalFees: [String]
  feeToVolumeRatio: [String]
  mevToTotalFeesRatio: [String]
  gasPerVolume: [String]
  averageCostPerTrade: [String]
  mevRiskLevel: [String]
  feeRegimeClassification: [String]
  sandwichRate: [String]
  token: EnhancedToken!
}

enum QuoteCurrency {
  USD
  TOKEN
}

enum TokenPairStatisticsType {
  FILTERED
  UNFILTERED
}
```

### Example

[Test this query in the Explorer →](https://docs.codex.io/explore.md)

```graphql theme={null}
{
  getTokenBars(
    symbol: "So11111111111111111111111111111111111111112:1399811149"
    from: 1753121580
    to: 1758303571
    resolution: "5"
    countback: 10
    removeEmptyBars: true
  ) {
    o
    h
    c
    l
    volume
  }
}
```

### Usage Guidelines

* For data from mid-2025 onwards (timestamp 1753121580), `getTokenBars` returns an aggregated price across all pools. Anything before that falls back to the top pair.
* Historical data only includes OHLC data; volume/traders data cannot be aggregated across all pools on the fly.
* Includes more historical data than `getBars` because it iterates through top pairs rather than using a single pair.
* Response time is slightly faster for current data, but the difference from `getBars` is negligible.
* Maximum 1,500 datapoints per request, the same as `getBars`. A wider range returns an error instead of being cut.
* `currencyCode` here is an enum, so pass `USD` or `TOKEN` without quotes. On `getBars` it is a string (`"USD"`).
* Candle open, high, low and close follow the pool price after each event, not each trade's execution price. For per-trade prices use `priceUsd` from [`getTokenEvents`](https://docs.codex.io/api-reference/queries/gettokenevents).
* Refer to [getBars](https://docs.codex.io/api-reference/queries/getbars.md) for additional usage guidelines and troubleshooting tips.

> [!NOTE]
>
> Pricing for aggregate charts will no longer only use the top pair. Weighted average pricing will be used across a token's top pairs, based on liquidity/recency, while filtering out lower quality pairs from contributing.

### Troubleshooting Tips

> [accordion] When should I use getTokenBars vs getBars?
>
> Use `getTokenBars` when you want aggregate price data for a token across all its trading pairs — it uses weighted average pricing based on liquidity. Use `getBars` when you want price data for a specific trading pair.

> [accordion] Null or empty values returned
>
> * Check that your timestamp window is accurate and long enough for the resolution requested
> * Ensure the token has started trading (we do not index tokens until trades occur)
> * Use `removeLeadingNullValues: true`

> [accordion] Updating charts in real-time
>
> You can use `getTokenBars` to do an initial fetch of bars and then subscribe to `onTokenBarsUpdated` to keep it updated in real-time. More info on creating real-time charts is available [here](https://docs.codex.io/recipes/charts.md).

> [accordion] Incorrect values or errors returned with resolutions under 1m
>
> Sub-minute resolutions (`1S`, `5S`, `15S`, `30S`) are kept for about 24 hours due to the volume of data required at those resolutions. Older windows return forward-filled bars with no volume, so pass `removeEmptyBars: true` or check `volume`.

### Related Recipes

* [Detailed Token Page](https://docs.codex.io/recipes/detailed-token-page.md): Build a comprehensive token detail page with price, holders, trades, and real-time updates
* [Charts](https://docs.codex.io/recipes/charts.md): Render token charts with OHLCV data and real-time updates


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.