> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upsolve.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Canvas Item Chart

> Change the chart a tile shows: a new chart (stored as a new chart of this canvas), or one of this canvas's earlier charts (Undo).



## OpenAPI

````yaml put /v2/api/projects/{projectId}/workspaces/{workspaceId}/canvases/{canvasId}/items/{itemId}/chart
openapi: 3.1.0
info:
  title: Upsolve API
  version: 1.5.0
servers:
  - url: https://api.upsolve.ai
security: []
tags: []
paths:
  /v2/api/projects/{projectId}/workspaces/{workspaceId}/canvases/{canvasId}/items/{itemId}/chart:
    put:
      summary: 'Change the chart a tile shows: a new chart (store…'
      description: >-
        Change the chart a tile shows: a new chart (stored as a new chart of
        this canvas), or one of this canvas's earlier charts (Undo).
      operationId: >-
        PutV2ApiProjectsProjectIdWorkspacesWorkspaceIdCanvasesCanvasIdItemsItemIdChart
      parameters:
        - name: projectId
          in: path
          required: true
          description: The project in the URL. The caller's project user is read from it.
          schema:
            type: string
            format: uuid
            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})$
            description: The project in the URL. The caller's project user is read from it.
        - name: workspaceId
          in: path
          required: true
          description: >-
            PUT
            /v2/api/projects/:projectId/workspaces/:workspaceId/canvases/:canvasId/items/:itemId/chart
            Parameter
          schema:
            type: string
            format: uuid
            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: canvasId
          in: path
          required: true
          description: >-
            PUT
            /v2/api/projects/:projectId/workspaces/:workspaceId/canvases/:canvasId/items/:itemId/chart
            Parameter
          schema:
            type: string
            format: uuid
            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: itemId
          in: path
          required: true
          description: >-
            PUT
            /v2/api/projects/:projectId/workspaces/:workspaceId/canvases/:canvasId/items/:itemId/chart
            Parameter
          schema:
            type: string
            format: uuid
            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})$
      requestBody:
        description: >-
          PUT
          /v2/api/projects/:projectId/workspaces/:workspaceId/canvases/:canvasId/items/:itemId/chart
          Request body
        content:
          application/json:
            schema:
              type: object
              properties:
                apiKey:
                  description: >-
                    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.
                  type: string
                  minLength: 1
                organizationId:
                  type: string
                  description: >-
                    The ID of the organization. Required when using Supabase JWT
                    authentication.
                connectionId:
                  type: string
                  description: The ID of the connection a guest has access to
                chart:
                  description: >-
                    The tile's new chart (query, shape, render). Stored as a new
                    chart of this canvas; the tile's old one is kept for Undo.
                  type: object
                  properties:
                    v:
                      type: number
                      const: 3
                    query:
                      type:
                        - string
                        - 'null'
                      maxLength: 100000
                    shape:
                      type: object
                      properties:
                        dimensions:
                          maxItems: 100
                          type: array
                          items:
                            type: object
                            properties:
                              field:
                                type: string
                                minLength: 1
                                maxLength: 300
                                description: >-
                                  A column of the chart's query, exactly as it
                                  is spelled there
                              type:
                                type: string
                                enum:
                                  - string
                                  - number
                                  - date
                                  - boolean
                                description: >-
                                  The column's type. A date dimension is
                                  truncated to its bucket (a day when unset)
                              bucket:
                                description: >-
                                  For a date dimension: the period its values
                                  are grouped into
                                type: string
                                enum:
                                  - minute
                                  - hour
                                  - day
                                  - week
                                  - month
                                  - quarter
                                  - year
                            required:
                              - field
                              - type
                        measures:
                          maxItems: 200
                          type: array
                          items:
                            type: object
                            properties:
                              field:
                                type: string
                                minLength: 1
                                maxLength: 300
                                description: >-
                                  A column of the chart's query, exactly as it
                                  is spelled there
                              aggregation:
                                type: string
                                enum:
                                  - count
                                  - distinct_count
                                  - sum
                                  - avg
                                  - min
                                  - max
                                  - first
                                  - collect_list
                                description: >-
                                  How the column's values are combined into one
                                  per group
                            required:
                              - field
                              - aggregation
                        filters:
                          maxItems: 500
                          type: array
                          items:
                            type: object
                            properties:
                              field:
                                type: string
                                minLength: 1
                                maxLength: 300
                                description: >-
                                  A column of the chart's query, exactly as it
                                  is spelled there
                              operator:
                                type: string
                                enum:
                                  - '='
                                  - '!='
                                  - '>'
                                  - '>='
                                  - <
                                  - <=
                                  - LIKE
                                  - NOT LIKE
                                  - IN
                                  - NOT IN
                                  - BETWEEN
                              value:
                                anyOf:
                                  - anyOf:
                                      - type: string
                                      - type: number
                                      - type: boolean
                                  - maxItems: 1000
                                    type: array
                                    items:
                                      anyOf:
                                        - type: string
                                        - type: number
                                        - type: boolean
                            required:
                              - field
                              - operator
                              - value
                        having:
                          maxItems: 100
                          type: array
                          items:
                            type: object
                            properties:
                              field:
                                type: string
                                minLength: 1
                                maxLength: 300
                                description: A measure's field
                              aggregation:
                                description: >-
                                  The aggregation compared; unset is the chart's
                                  measure on this field, else a sum
                                type: string
                                enum:
                                  - sum
                                  - avg
                                  - count
                                  - distinct_count
                                  - min
                                  - max
                              operator:
                                type: string
                                enum:
                                  - '='
                                  - '!='
                                  - '>'
                                  - '>='
                                  - <
                                  - <=
                                  - LIKE
                                  - NOT LIKE
                                  - IN
                                  - NOT IN
                                  - BETWEEN
                              value:
                                anyOf:
                                  - type: number
                                  - type: string
                                  - maxItems: 1000
                                    type: array
                                    items:
                                      anyOf:
                                        - type: number
                                        - type: string
                                description: >-
                                  A number, or a string compared as one (a date,
                                  a text value); a list for IN, NOT IN and
                                  BETWEEN
                            required:
                              - field
                              - operator
                              - value
                        sort:
                          maxItems: 100
                          type: array
                          items:
                            type: object
                            properties:
                              field:
                                type: string
                                minLength: 1
                                maxLength: 300
                                description: >-
                                  A column of the chart's query, exactly as it
                                  is spelled there
                              direction:
                                type: string
                                enum:
                                  - asc
                                  - desc
                            required:
                              - field
                              - direction
                        limit:
                          description: Top N rows, after grouping and sorting
                          type: integer
                          minimum: 1
                          maximum: 1000
                      required:
                        - dimensions
                        - measures
                    render:
                      type: object
                      properties:
                        preset:
                          type: object
                          properties:
                            form:
                              type: string
                              enum:
                                - bar
                                - horizontalBar
                                - stackedBar
                                - line
                                - area
                                - combo
                                - pie
                                - donut
                                - funnel
                                - gauge
                                - treemap
                                - scatter
                                - heatmap
                                - radar
                                - kpi
                                - table
                                - list
                                - status
                                - keyValue
                            title:
                              type: string
                              minLength: 1
                              maxLength: 200
                            description:
                              type: string
                              minLength: 1
                              maxLength: 500
                            fields:
                              type: object
                              propertyNames:
                                type: string
                              additionalProperties:
                                type: object
                                properties:
                                  label:
                                    type: string
                                    minLength: 1
                                    maxLength: 200
                                  format:
                                    type: object
                                    properties:
                                      style:
                                        type: string
                                        enum:
                                          - decimal
                                          - percent
                                          - currency
                                          - unit
                                      currency:
                                        type: string
                                        minLength: 3
                                        maxLength: 3
                                      currencyDisplay:
                                        type: string
                                        enum:
                                          - symbol
                                          - narrowSymbol
                                          - code
                                          - name
                                      unit:
                                        type: string
                                        minLength: 1
                                        maxLength: 40
                                      unitDisplay:
                                        type: string
                                        enum:
                                          - short
                                          - long
                                          - narrow
                                      notation:
                                        type: string
                                        enum:
                                          - standard
                                          - compact
                                          - scientific
                                          - engineering
                                      compactDisplay:
                                        type: string
                                        enum:
                                          - short
                                          - long
                                      signDisplay:
                                        type: string
                                        enum:
                                          - auto
                                          - always
                                          - never
                                          - exceptZero
                                      useGrouping:
                                        type: boolean
                                      minimumFractionDigits:
                                        type: integer
                                        minimum: 0
                                        maximum: 20
                                      maximumFractionDigits:
                                        type: integer
                                        minimum: 0
                                        maximum: 20
                                      minimumSignificantDigits:
                                        type: integer
                                        minimum: 1
                                        maximum: 21
                                      maximumSignificantDigits:
                                        type: integer
                                        minimum: 1
                                        maximum: 21
                                  locale:
                                    type: string
                                    minLength: 2
                                    maxLength: 35
                                  prefix:
                                    type: string
                                    maxLength: 20
                                  suffix:
                                    type: string
                                    maxLength: 20
                            colors:
                              minItems: 1
                              maxItems: 12
                              type: array
                              items:
                                type: string
                                pattern: ^#[0-9a-fA-F]{6}$
                                description: 'A colour as #RRGGBB hex'
                            legend:
                              type: string
                              enum:
                                - top
                                - bottom
                                - right
                                - none
                                - show
                            dataLabels:
                              type: boolean
                            cornerRadius:
                              type: integer
                              minimum: 0
                              maximum: 16
                            secondAxis:
                              type: boolean
                            sliceLimit:
                              type: integer
                              minimum: 1
                              maximum: 50
                            list:
                              description: >-
                                Which columns a list form draws. Unset: the
                                first text column is the title and the second
                                the subtitle
                              type: object
                              properties:
                                titleColumn:
                                  type: string
                                  minLength: 1
                                  maxLength: 300
                                  description: The column each row's title is read from
                                subtitleColumn:
                                  description: >-
                                    The column drawn in smaller text under the
                                    title
                                  type: string
                                  minLength: 1
                                  maxLength: 300
                                badgeColumn:
                                  description: >-
                                    The column drawn as a badge at the end of
                                    the row, e.g. a ticket's status
                                  type: string
                                  minLength: 1
                                  maxLength: 300
                                linkColumn:
                                  description: >-
                                    The column holding a URL the title links to.
                                    Only http and https links are drawn as links
                                  type: string
                                  minLength: 1
                                  maxLength: 300
                              required:
                                - titleColumn
                            status:
                              description: >-
                                The value and colour rules of a status form.
                                Unset: the first column of the first row,
                                neutral
                              type: object
                              properties:
                                valueColumn:
                                  type: string
                                  minLength: 1
                                  maxLength: 300
                                  description: >-
                                    The column of the first row that holds the
                                    value shown
                                labelColumn:
                                  description: >-
                                    The column of the first row drawn as a
                                    caption under the value
                                  type: string
                                  minLength: 1
                                  maxLength: 300
                                states:
                                  maxItems: 20
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      when:
                                        type: object
                                        properties:
                                          op:
                                            type: string
                                            enum:
                                              - eq
                                              - neq
                                              - gt
                                              - gte
                                              - lt
                                              - lte
                                            description: >-
                                              How the value is compared: eq, neq, gt,
                                              gte, lt or lte
                                          value:
                                            anyOf:
                                              - type: string
                                                maxLength: 300
                                              - type: number
                                            description: >-
                                              What it is compared with. Two numbers
                                              are compared as numbers, anything else
                                              as text (eq and neq ignore case)
                                        required:
                                          - op
                                          - value
                                      tone:
                                        type: string
                                        enum:
                                          - good
                                          - warning
                                          - bad
                                          - neutral
                                        description: >-
                                          The colour the tile takes when the rule
                                          matches
                                    required:
                                      - when
                                      - tone
                                  description: >-
                                    Rules in order; the first one the value
                                    matches sets the colour. A value that
                                    matches none is neutral
                              required:
                                - valueColumn
                                - states
                            keyValue:
                              description: >-
                                The columns a keyValue form shows. Unset: every
                                column of the first row
                              type: object
                              properties:
                                columns:
                                  description: >-
                                    The columns of the first row to show, in
                                    order. Unset shows every column
                                  maxItems: 100
                                  type: array
                                  items:
                                    type: string
                                    minLength: 1
                                    maxLength: 300
                        code:
                          description: >-
                            A script defining `function render({ option, rows,
                            theme, size })` that returns an ECharts option as
                            plain JSON
                          type: string
                          maxLength: 20000
                  required:
                    - v
                    - query
                    - shape
                    - render
                baseChartId:
                  description: >-
                    The chart id the tile showed when you read it
                    (`item.favorite_id`). The change is refused (409) when the
                    tile shows another one now.
                  type: string
                  format: uuid
                  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:
                  description: The new chart's name; unset keeps the tile's current one.
                  type: string
                  minLength: 1
                  maxLength: 200
                snapshot_data:
                  description: >-
                    The new chart's rows as last run, shown when the canvas is
                    on Snapshot. At most 500 are kept.
                  type:
                    - array
                    - 'null'
                  items:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                chartId:
                  description: >-
                    Instead of `chart`: point the tile back at one of this
                    canvas's earlier charts (Undo / Redo of an edit).
                  type: string
                  format: uuid
                  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})$
              required: []
      responses:
        '200':
          description: >-
            PUT
            /v2/api/projects/:projectId/workspaces/:workspaceId/canvases/:canvasId/items/:itemId/chart
            Positive response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  data:
                    type: object
                    properties:
                      item:
                        type: object
                        properties:
                          id:
                            type: string
                            format: uuid
                            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})$
                          canvas_id:
                            type: string
                            format: uuid
                            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})$
                          favorite_id:
                            type: string
                            format: uuid
                            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})$
                          x:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          'y':
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          w:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          h:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          created_at: {}
                          favorite:
                            type:
                              - object
                              - 'null'
                            properties:
                              id:
                                type: string
                                format: uuid
                                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})$
                              organization_id:
                                type: string
                                format: uuid
                                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})$
                              created_by_project_user_id:
                                type:
                                  - string
                                  - 'null'
                                format: uuid
                                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})$
                              type:
                                type: string
                                enum:
                                  - sql
                                  - chart
                                  - tool
                              name:
                                type: string
                              thread_id:
                                type:
                                  - string
                                  - 'null'
                              chart_config:
                                type:
                                  - object
                                  - 'null'
                                propertyNames:
                                  type: string
                                additionalProperties: {}
                              chart:
                                type: object
                                properties:
                                  v:
                                    type: number
                                    const: 3
                                required:
                                  - v
                                additionalProperties: {}
                                description: >-
                                  The chart as v3 (query, shape, render): its
                                  stored v3 chart, or its chartsV2 config
                                  converted
                              connection_id:
                                type:
                                  - string
                                  - 'null'
                                format: uuid
                                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})$
                              thumbnail_url:
                                type:
                                  - string
                                  - 'null'
                              sql:
                                type:
                                  - string
                                  - 'null'
                              snapshot_data:
                                type:
                                  - array
                                  - 'null'
                                items:
                                  type: object
                                  propertyNames:
                                    type: string
                                  additionalProperties: {}
                              is_archived:
                                type: boolean
                              copied_from_favorite_id:
                                description: >-
                                  For a canvas tile's own chart: the saved
                                  favorite it was copied from, if any
                                type:
                                  - string
                                  - 'null'
                                format: uuid
                                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})$
                              tool_call:
                                description: >-
                                  For a tool tile (type tool): the API connector
                                  operation it calls (connectorKind,
                                  connectorId, toolName, pinnedArgs)
                                type:
                                  - object
                                  - 'null'
                                properties:
                                  connectorKind:
                                    type: string
                                    enum:
                                      - mcp
                                      - api
                                  toolName:
                                    type: string
                                required:
                                  - connectorKind
                                  - toolName
                                additionalProperties: {}
                              row_transform:
                                description: >-
                                  For a tool tile: the BODY of the JavaScript
                                  function `transform(payload)` that turns the
                                  API's response into the tile's rows (a
                                  complete `function transform(payload) { ... }`
                                  is accepted too)
                                type:
                                  - string
                                  - 'null'
                              row_columns:
                                description: >-
                                  For a tool tile: the columns its transform
                                  returns
                                type:
                                  - array
                                  - 'null'
                                items:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                    type:
                                      type: string
                                  required:
                                    - name
                                    - type
                                  additionalProperties: {}
                              created_at: {}
                              updated_at: {}
                              workspace_id:
                                type: string
                                format: uuid
                                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})$
                            required:
                              - id
                              - organization_id
                              - created_by_project_user_id
                              - type
                              - name
                              - thread_id
                              - chart_config
                              - chart
                              - connection_id
                              - thumbnail_url
                              - sql
                              - snapshot_data
                              - is_archived
                              - created_at
                              - updated_at
                              - workspace_id
                            additionalProperties: false
                        required:
                          - id
                          - canvas_id
                          - favorite_id
                          - x
                          - 'y'
                          - w
                          - h
                          - created_at
                        additionalProperties: false
                    required:
                      - item
                    additionalProperties: false
                required:
                  - status
                  - data
                additionalProperties: false
        '400':
          description: >-
            PUT
            /v2/api/projects/:projectId/workspaces/:workspaceId/canvases/:canvasId/items/:itemId/chart
            Negative response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: error
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      code:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                    required:
                      - message
                    additionalProperties: false
                required:
                  - status
                  - error
                additionalProperties: false
      security:
        - APIKEY_3: []
components:
  securitySchemes:
    APIKEY_3:
      type: apiKey
      in: header
      name: authorization

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.