---
title: "Create Chart"
method: POST
path: "/api/projects/charts"
---

# Create Chart

`POST /api/projects/charts`

## Request

- Base URL: `https://api.openpaper.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.openpaper.ai/api/projects/charts`
- Auth: API key in header `Authorization`

## Request body

- CreateChartRequest
  - `project_id` string, required
  - `prompt` string, required
  - `paper_ids` string[]
  - `plan` ChartPlan, required
    - `title` string, required
    - `chart_type` 'bar' | 'line' | 'scatter', required
    - `x` ChartField, required: One field the chart extractor must find in a paper.
      - `key` string, required: Stable short key used in chart records
      - `label` string, required: Human-readable axis or grouping label
      - `unit` string, nullable: The unit this field's numbers are plotted in — s, %, mg/dL, kg. One field is one unit, so name it here even when the papers are expected to disagree: each paper's number is converted into this one. Leave empty only for a measure that has no unit at all — a count, an index, a dimensionless score.
    - `y` ChartField, required: One field the chart extractor must find in a paper.
      - `key` string, required: Stable short key used in chart records
      - `label` string, required: Human-readable axis or grouping label
      - `unit` string, nullable: The unit this field's numbers are plotted in — s, %, mg/dL, kg. One field is one unit, so name it here even when the papers are expected to disagree: each paper's number is converted into this one. Leave empty only for a measure that has no unit at all — a count, an index, a dimensionless score.
    - `series` ChartField: One field the chart extractor must find in a paper.
      - `key` string, required: Stable short key used in chart records
      - `label` string, required: Human-readable axis or grouping label
      - `unit` string, nullable: The unit this field's numbers are plotted in — s, %, mg/dL, kg. One field is one unit, so name it here even when the papers are expected to disagree: each paper's number is converted into this one. Leave empty only for a measure that has no unit at all — a count, an index, a dimensionless score.
    - `fields` ChartField[]: Primitive fields extracted for the chart, including x/y when raw
      - `key` string, required: Stable short key used in chart records
      - `label` string, required: Human-readable axis or grouping label
      - `unit` string, nullable: The unit this field's numbers are plotted in — s, %, mg/dL, kg. One field is one unit, so name it here even when the papers are expected to disagree: each paper's number is converted into this one. Leave empty only for a measure that has no unit at all — a count, an index, a dimensionless score.
    - `calculation` ChartCalculation: A derived y value computed only from cited primitive fields.
      - `label` string, required
      - `spec` string, required
      - `inputs` string[]

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/openpaper/apis/open-paper.md) - [All operations](https://skmtc.dev/openpaper/apis/open-paper/llms.txt) - [OpenAPI document](https://skmtc.dev/openpaper/apis/open-paper/revisions/c2ad03216101?raw)
