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

# chartUrls

> Returns a URL for a pair chart. Reference for the chartUrls query in the Codex API: arguments, response fields, and usage.

## GraphQL

```
type Query {
  # Requires a Growth or Enterprise plan.
  chartUrls(
    input: ChartInput!
  ): ChartUrlsResponse
}

type ChartUrl {
  url: String!
}

type ChartUrlsResponse {
  pair: ChartUrl!
}

input ChartImageOptions {
  expirationSeconds: Int
  width: Int
  height: Int
}

enum QuoteToken {
  token0
  token1
}

enum ChartTheme {
  LIGHT
  DARK
}

input PairChartSettings {
  pairAddress: String!
  networkId: Int!
  from: Int
  to: Int
  quoteToken: QuoteToken
  resolution: String
  theme: ChartTheme
}

input PairChartInput {
  imageOptions: ChartImageOptions
  chartSettings: PairChartSettings!
}

input ChartInput {
  pair: PairChartInput
}
```

### Example

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

```graphql theme={null}
{
  chartUrls(
    input: {
      pair: {
        chartSettings: {
          pairAddress: "PAIR_ADDRESS"
          networkId: 1399811149
          resolution: "60"
          quoteToken: token1
          theme: DARK
        }
        imageOptions: {
          width: 800
          height: 450
          expirationSeconds: 300
        }
      }
    }
  ) {
    pair {
      url
    }
  }
}
```

### Usage Guidelines

* Provide `pairAddress` and `networkId` to generate a chart URL for a specific trading pair
* `resolution` sets the candlestick timeframe — valid values include `"1S"`, `"5S"`, `"15S"`, `"30S"`, `"1"`, `"5"`, `"15"`, `"30"`, `"60"`, `"240"`, `"720"`, `"1D"`, `"7D"`
* `quoteToken` determines which token is the quote currency — use `token0` or `token1`
* `theme` can be `LIGHT` or `DARK` to match your application's design
* Use `from` and `to` (Unix timestamps) to specify a custom time range for the chart
* `imageOptions` lets you customize dimensions (`width`, `height`) and URL lifetime (`expirationSeconds`)
* The returned URL is a pre-signed URL that expires after the specified duration (default varies by plan)

### Troubleshooting Tips

> [accordion] What resolution values are supported?
>
> Resolution values include seconds (`"1S"`, `"5S"`, `"15S"`, `"30S"`), minutes (`"1"`, `"5"`, `"15"`, `"30"`, `"60"`), hours (`"240"`, `"720"`), and days (`"1D"`, `"7D"`). For example, `"60"` gives hourly candles, `"240"` gives 4-hour candles.

> [accordion] How long is the chart URL valid?
>
> The URL expiration depends on `expirationSeconds` in `imageOptions`. If not specified, the default expiration is set by your plan tier. URLs are pre-signed and will return an error after expiration — generate a new URL when needed.

> [accordion] How do I choose between token0 and token1 for quoteToken?
>
> `quoteToken` determines which token's price is shown. If you want the chart to show "Token A in terms of Token B", set `quoteToken` to the token B position. Check `pairMetadata` to see which token is `token0` vs `token1` if you're unsure.

> [accordion] Why am I getting an authorization error?
>
> The `chartUrls` query requires a Growth or Enterprise plan. On any other plan you'll receive an authorization error. Upgrade your plan at [codex.io](https://www.codex.io) to access chart image generation.


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