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

# tokenSparklines

> Returns a list of token simple chart data (sparklines) for the given tokens. tokenSparklines query reference: arguments and response fields.

## GraphQL

```
type Query {
  tokenSparklines(
    input: TokenSparklineInput!
  ): [TokenSparkline!]!
}

enum SparklineAttribute {
  PRICE
}

type SparklineValue {
  timestamp: Int!
  value: Float!
}

type TokenSparkline {
  id: String!
  resolution: String!
  attribute: SparklineAttribute
  sparkline: [SparklineValue!]!
}

input TokenSparklineInput {
  ids: [String!]!
  from: Int
  to: Int
  resolution: String
  fillMissingBars: Boolean
}
```

### Example

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

```graphql theme={null}
{
  tokenSparklines(
    input: {
      ids: ["So11111111111111111111111111111111111111112:1399811149"]
      resolution: "60"
    }
  ) {
    id
    resolution
    attribute
    sparkline {
      timestamp
      value
    }
  }
}
```

### Usage Guidelines

* Pass an array of token `ids` in the format `tokenAddress:networkId` to fetch sparklines for multiple tokens in one request
* `resolution` specifies the candle size: `1S`, `5S`, `15S`, `30S`, `1` (1 min), `5`, `15`, `30`, `60` (1 hour), `240`, `720`, `1D`, `7D`
* Alternatively, use `pointCount` to specify the desired number of data points — the resolver will automatically choose the best resolution based on token age
* Use `from` and `to` (unix timestamps) to specify a custom time range — defaults to the last 7 days
* Set `fillMissingBars: true` to include empty bars with the previous bar's value, ensuring consistent data density
* The response includes `{timestamp, value}` pairs ideal for rendering lightweight price charts or sparkline visualizations

### Troubleshooting Tips

> [accordion] When should I use tokenSparklines vs getBars?
>
> Use `tokenSparklines` for lightweight, display-ready chart data — it returns simple `{timestamp, value}` pairs optimized for sparkline visualizations. Use `getBars` when you need full OHLCV candlestick data with volume, trade counts, and other detailed metrics.

> [accordion] Should I use resolution or pointCount?
>
> Use `pointCount` for adaptive charts that automatically adjust resolution based on the token's age and your desired data density. Use `resolution` when you need a specific candle size (e.g., hourly or daily). If both are provided, `pointCount` takes precedence.

> [accordion] Why are there gaps in my sparkline data?
>
> By default, bars are only returned when there was trading activity. Set `fillMissingBars: true` to fill gaps with the previous bar's value, which is useful for continuous chart displays.

> [accordion] Can I fetch sparklines for multiple tokens at once?
>
> Yes. Pass multiple token IDs in the `ids` array to batch-fetch sparklines for several tokens in a single request. Each token's sparkline is returned as a separate object in the response array.


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