---
title: Get Chart JSON
description: Get chart data as structured JSON
url: https://docs.intuition.systems/docs/v1/graphql-api/queries/charts/chart-json
markdown_url: https://docs.intuition.systems/docs/v1/graphql-api/queries/charts/chart-json.md
version: V1
llms_index: https://docs.intuition.systems/docs/v1/llms.txt
---

Retrieve chart data in structured JSON format for use with charting libraries.

## Get Chart JSON - Query Structure

```graphql
query GetChartJson($input: GetChartJsonInput!) {
  getChartJson(input: $input) {
    term_id
    curve_id
    graph_type
    interval
    count
    data {
      timestamp
      value
    }
  }
}
```

## Variables

The query takes a single `input` object of type `GetChartJsonInput`:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `term_id` | `String` | Yes | Term ID to generate chart for |
| `curve_id` | `String` | Yes | Curve ID (bonding curve) |
| `interval` | `String` | Yes | Time interval (e.g. `"1h"`, `"1d"`, `"1w"`) |
| `start_time` | `String` | Yes | Start of time range (ISO 8601) |
| `end_time` | `String` | Yes | End of time range (ISO 8601) |
| `graph_type` | `String` | No | Type of graph data |

```json
{
  "input": {
    "term_id": "0x906527aae4af914b1ac01ff9adfdda5dafde3b5e21f84045e0660b0a15c07769",
    "curve_id": "1",
    "interval": "1d",
    "start_time": "2024-01-01T00:00:00Z",
    "end_time": "2024-01-31T23:59:59Z"
  }
}
```

## Response Fields (`ChartDataOutput`)

| Field | Type | Description |
|-------|------|-------------|
| `term_id` | `String!` | Term ID for this chart |
| `curve_id` | `String` | Curve ID used |
| `graph_type` | `String!` | Type of graph |
| `interval` | `String!` | Interval used for aggregation |
| `count` | `Int!` | Number of data points |
| `data` | `[ChartDataPoint!]!` | Array of chart data points |
| `data[].timestamp` | `String!` | ISO 8601 timestamp for this data point |
| `data[].value` | `String!` | Value at this timestamp |

## Interactive Example

    id: 'chart-json',
    title: 'Chart JSON Data',
    query: `query GetChartJson($input: GetChartJsonInput!) {
  getChartJson(input: $input) {
    term_id
    curve_id
    graph_type
    interval
    count
    data {
      timestamp
      value

}`,
    variables: {
      input: {
        term_id: '0x906527aae4af914b1ac01ff9adfdda5dafde3b5e21f84045e0660b0a15c07769',
        curve_id: '1',
        interval: '1d',
        start_time: '2024-01-01T00:00:00Z',
        end_time: '2024-01-31T23:59:59Z'

];

## Use Cases

### Recharts Integration

```typescript
import { GraphQLClient } from 'graphql-request'
import { API_URL_PROD } from '@0xintuition/graphql'

const client = new GraphQLClient(API_URL_PROD)

async function getChartData(termId: string, curveId: string, days: number = 30) {
  const endTime = new Date()
  const startTime = new Date()
  startTime.setDate(startTime.getDate() - days)

  const query = `
    query GetChartJson($input: GetChartJsonInput!) {
      getChartJson(input: $input) {
        count
        data
        interval
      }
    }
  `

  const result = await client.request(query, {
    input: {
      term_id: termId,
      curve_id: curveId,
      interval: '1d',
      start_time: startTime.toISOString(),
      end_time: endTime.toISOString()
    }
  })

  return result.getChartJson
}
```

## Related

- [Chart Raw JSON](https://docs.intuition.systems/docs/v1/graphql-api/queries/charts/chart-raw-json) - Raw JSON format (same input/output types)
- [Chart SVG](https://docs.intuition.systems/docs/v1/graphql-api/queries/charts/chart-svg) - Pre-rendered SVG charts
