Chart generations
Generate a publication-style chart from a data table
POST /api/v1/charts/generations accepts multipart/form-data. Required scope:
charts:generate. The service reads your table, chooses or applies the requested
chart types, and returns one finished PNG figure. No streaming or intermediate
state is exposed; poll the job like any other.
Form fields
| Field | Type | Required | Default | Rules |
|---|---|---|---|---|
data | file | yes | — | CSV, TSV, TXT, XLSX, or XLS; maximum 5 MB; first row must be unique column names |
prompt | string | no | — | What to show or emphasise, up to 8,000 characters |
chart_types | string | no | automatic | Comma-separated or repeated; up to 4 of the types below |
journal_style | string | no | default | default, nature, science, cell, plos, or acs |
figure_width | string | no | double | single or double column width |
color_palette | string | no | okabe_ito | okabe_ito, wong, tol_bright, or tol_muted |
Files that cannot be parsed, exceed the size limit, or have duplicate or empty
column names return 400 INVALID_REQUEST (HTTP 413 for oversized uploads).
Chart types
bar, line, scatter, boxplot, violin, histogram, heatmap, regression, errorbar, timeseries, volcano, kaplan_meier, forest, dot, radar, upset, dendrogram, qq, ogive, funnel, density, roc, sankey, stem_leaf, correlation, pca, manhattan, bland_altman, waterfall, dose_response, growth_curve, standard_curve, raincloud, beeswarm, ecdf, ma_plot, enrichment, enzyme_kinetics, calendar_heatmap, choropleth, stacked_area, ridgeline, bubble, hexbin, paired_dot, precision_recall, calibration_curve, confusion_matrix.
Credits
Each chart job costs 10 credits, reserved when the job is accepted and settled only when the job succeeds. Failed jobs release the reservation.
Output
result.files contains exactly one PNG at journal print resolution with its
width and height. Figure dimensions follow the selected journal style and
column width, so the pixel size varies between requests.
cURL
curl https://sci-draw.com/api/v1/charts/generations \
-H 'Authorization: Bearer sd_YOUR_KEY' \
-H 'Idempotency-Key: study-12-figure-2' \
-H 'Prefer: wait=30' \
-F 'data=@results.csv;type=text/csv' \
-F 'prompt=Compare treatment groups and mark significance' \
-F 'chart_types=boxplot' \
-F 'journal_style=nature' \
-F 'figure_width=single'JavaScript
const form = new FormData();
form.set('data', file);
form.set('prompt', 'Compare treatment groups and mark significance');
form.set('chart_types', 'boxplot');
const response = await fetch('https://sci-draw.com/api/v1/charts/generations', {
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}`, 'Idempotency-Key': crypto.randomUUID() },
body: form,
});Python
with open("results.csv", "rb") as table:
response = requests.post(
"https://sci-draw.com/api/v1/charts/generations",
headers={"Authorization": f"Bearer {api_key}", "Idempotency-Key": str(uuid.uuid4())},
files={"data": ("results.csv", table, "text/csv")},
data={"prompt": "Compare treatment groups and mark significance", "chart_types": "boxplot"},
)The uploaded table is private job input and is never returned in job or log responses. Accepted sources are removed after a terminal result.

API Docs