---
title: "Create a chart"
method: POST
path: "/v1/chat/charts"
tags: ["charts"]
---

# Create a chart

`POST /v1/chat/charts`

Create charts.

## Request body

- CreateChartRequest
  - `query` string, required — The chart query to create

## Response `200`

Returns chart data.

- ChartResponse
  - `success` boolean, required
  - `chart_json` object, required — The plotly fig.to_json() JSON representation of the chart
  - `query` string, nullable
  - `reasoning` string, nullable
  - `parameters` ChartParameters
    - `chart_type` 'line' | 'bar' | 'bar_pct', required — The type of chart to create
    - `title` string, nullable — The title of the chart
    - `series` SeriesConfig[], required — The series configurations for the chart
      - `name` string, required
      - `start_datetime` string, date-time, required
      - `end_datetime` string, date-time, required
      - `sampling` string, nullable
      - `time_filter` string, nullable
      - `categories` string[], nullable
      - `domains` string[], nullable
      - `bad_domain_url` string[], nullable
      - `page_rank` integer, nullable
      - `string_guarantee` string[], nullable
      - `string_guarantee_op` string, nullable
      - `reverse_string_guarantee` string[], nullable
      - `entity_guarantee` string[], nullable
      - `entity_guarantee_op` string, nullable
      - `countries` string[], nullable
      - `countries_blacklist` string[], nullable
      - `continents` string[], nullable
      - `languages` string[], nullable
      - `sentiment` string, nullable
      - `reporting_voice` string[], nullable
      - `provocative` string, nullable
  - `context` object, nullable
  - `iterations_used` integer, nullable
  - `last_reasoning` string, nullable
  - `last_parameters` ChartParameters
    - `chart_type` 'line' | 'bar' | 'bar_pct', required — The type of chart to create
    - `title` string, nullable — The title of the chart
    - `series` SeriesConfig[], required — The series configurations for the chart
      - `name` string, required
      - `start_datetime` string, date-time, required
      - `end_datetime` string, date-time, required
      - `sampling` string, nullable
      - `time_filter` string, nullable
      - `categories` string[], nullable
      - `domains` string[], nullable
      - `bad_domain_url` string[], nullable
      - `page_rank` integer, nullable
      - `string_guarantee` string[], nullable
      - `string_guarantee_op` string, nullable
      - `reverse_string_guarantee` string[], nullable
      - `entity_guarantee` string[], nullable
      - `entity_guarantee_op` string, nullable
      - `countries` string[], nullable
      - `countries_blacklist` string[], nullable
      - `continents` string[], nullable
      - `languages` string[], nullable
      - `sentiment` string, nullable
      - `reporting_voice` string[], nullable
      - `provocative` string, nullable
  - `png_data` string, nullable — Base64-encoded PNG image data of the chart
  - `png_url` string, nullable — URL to the PNG image of the chart
  - `chart_url` string, nullable — URL to the chart JSON object in S3

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/asknews/apis/asknews-api.md) · [All operations](https://skmtc.dev/asknews/apis/asknews-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/asknews/asknews-api/revisions/dd4286769887/schema)
