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

<div data-generated>
  ## 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
  }

  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
  }

  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
    identitySource: String
    identityUpdatedAt: Int
    polymarket: WalletPolymarketProfile
    tokensCreatedCount: Int
    tokensMigratedCount: Int
  }

  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
    isCashbackEnabled: Boolean
    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 Token2022Extensions {
    scaledUiAmountConfig: Token2022ScaledUiAmountConfig
  }

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

  type TokenExtensions {
    token2022: Token2022Extensions
    b20: B20Extensions
  }

  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
  }

  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
    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!]
  }

  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]!
    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
  }
  ```
</div>

### Example

<a href="/explore" target="_blank" rel="noopener noreferrer">Test this query in the Explorer →</a>

```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.
* Refer to [getBars](/api-reference/queries/getbars) for additional usage guidelines and troubleshooting tips.

<Info>
  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.
</Info>

### Troubleshooting Tips

<AccordionGroup>
  <Accordion title="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>

  <Accordion title="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>

  <Accordion title="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](/recipes/charts).
  </Accordion>

  <Accordion title="Incorrect values or errors returned with resolutions under 1m">
    Our chart data for under 1m (`1S, 5S, 15S, 30S`) only goes back 24 hours due to the volume of data required at those resolutions.
  </Accordion>
</AccordionGroup>

### Related Recipes

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