Skip to main content
POST
Save a chart generated by the AI chat agent

Authorizations

authorization
string
header
required

Body

application/json

POST /v1/api/chart/save-from-chat Request body

chartConfig
object
required

The chart configuration exactly as returned by the chat endpoint's generateChart tool result (toolResult.result.chartConfig). Should include the sqlOverride field the agent bakes onto the config; if it doesn't, pass the query on the top-level sql field instead — without either the saved chart cannot query data when rendered on a dashboard.

apiKey
string

Upsolve API key, generated under Account → Developer settings in the Upsolve Hub. Keys are user-scoped: pass organizationId alongside the key to select which org to act on.

Minimum string length: 1
organizationId
string

The ID of the organization. Required when using Supabase JWT authentication.

connectionId
string<uuid>

Explicit connection ID to associate with the chart. Overrides the connection resolved from workspaceId. When both are given, the connection must belong to the workspace's project. A resolvable connection (from either field) is required.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
sql
string

The chart's source SQL. Only needed when chartConfig.sqlOverride is absent — some generateChart tool-result shapes carry the query on the tool's sibling sql field instead of on the config. When both are present, chartConfig.sqlOverride wins.

workspaceId
string<uuid>

The workspace the chart was generated in (the same ID used to call the workspace chat endpoint). When provided, the chart is linked to the workspace's project and to the connection of its production version (the one chat queries), so it can be rendered on any dashboard.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
agentId
string<uuid>

Deprecated: pass workspaceId. The ID of a legacy agent, resolved to the workspace that replaced it. Ignored when workspaceId is given.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
name
string

Display name for the saved chart. Defaults to the chart config's title.

thumbnail
string

Optional thumbnail image (data URL) for the chart.

Response

POST /v1/api/chart/save-from-chat Positive response

status
string
required
Allowed value: "success"
data
object
required