Qyra
ReferenceProjects

Upsert SQL chart as code (deprecated)

Upsert SQL chart as code (deprecated)

POST/api/v1/projects/{projectUuid}/sqlCharts/{slug}/code

Authentication: personal access token. The spec defines an api_key security scheme — send an Authorization: ApiKey <your-personal-access-token> header (value format: ApiKey <your key>). A session_cookie scheme (connect.sid) exists for browser sessions. Operations in this spec declare security: [], an artifact of the upstream spec generator — authentication is still enforced by the server.

Path parameters

NameTypeRequiredDescription
projectUuidstringYes
slugstringYes

Request body

{
  "name": "string",
  "slug": "string",
  "limit": 0,
  "updatedAt": "2024-01-01T00:00:00.000Z",
  "version": 0,
  "contentType": "sql_chart",
  "spaceSlug": "string",
  "downloadedAt": "2024-01-01T00:00:00.000Z",
  "sql": "string",
  "chartKind": "line",
  "description": "string",
  "config": "string",
  "spaceNames": {},
  "force": true,
  "publicSpaceCreate": true,
  "skipSpaceCreate": true
}

Responses

200 — Success

{
  "results": {
    "dataApps": [
      {
        "data": {
          "name": "string",
          "uuid": "string"
        },
        "action": "no changes"
      }
    ],
    "sqlCharts": [
      {
        "data": {
          "spacePath": "string",
          "spaceSlug": "string",
          "description": "string",
          "name": "string",
          "projectUuid": "string",
          "slug": "string",
          "oldUuid": "string",
          "uuid": "string"
        },
        "action": "no changes"
      }
    ],
    "charts": [
      {
        "data": {
          "name": "string",
          "description": "string",
          "tableName": "string",
          "metricQuery": {
            "metadata": {
              "hasADateDimension": {
                "name": "string",
                "label": "string",
                "table": "string"
              }
            },
            "pivotDimensions": [
              "string"
            ],
            "timezone": "string",
            "dimensionOverrides": {
              "property": {
                "formatOptions": {
                  "type": "default",
                  "round": 0,
                  "separator": "default",
                  "currency": "string",
                  "compact": "auto",
                  "prefix": "string",
                  "suffix": "string",
                  "timeInterval": "RAW",
                  "custom": "string"
                }
              }
            },
            "metricOverrides": {
              "property": {
                "formatOptions": {
                  "type": "default",
                  "round": 0,
                  "separator": "default",
                  "currency": "string",
                  "compact": "auto",
                  "prefix": "string",
                  "suffix": "string",
                  "timeInterval": "RAW",
                  "custom": "string"
                }
              }
            },
            "customDimensions": [
              {
                "id": "string",
                "name": "string",
                "table": "string",
                "type": "bin",
                "dimensionId": "string",
                "binType": "fixed_number",
                "binNumber": 0
              }
            ],
            "additionalMetrics": [
              {
                "label": "string",
                "type": "percentile",
                "description": "string",
                "sql": "string",
                "hidden": true,
                "round": 0,
                "compact": "auto",
                "format": "km",
                "separator": "default",
                "table": "string",
                "name": "string",
                "index": 0,
                "filters": [
                  {
                    "includeNull": true,
                    "values": [
                      "string"
                    ],
                    "operator": "isNull",
                    "id": "string",
                    "target": {
                      "fieldRef": "string"
                    },
                    "settings": "string",
                    "disabled": true,
                    "required": true,
                    "caseSensitive": true
                  }
                ],
                "baseDimensionName": "string",
                "baseMetricName": "string",
                "uuid": "string",
                "percentile": 0,
                "distinctKeys": [
                  "string"
                ],
                "formatOptions": {
                  "type": "default",
                  "round": 0,
                  "separator": "default",
                  "currency": "string",
                  "compact": "auto",
                  "prefix": "string",
                  "suffix": "string",
                  "timeInterval": "RAW",
                  "custom": "string"
                },
                "generationType": "periodOverPeriod",
                "baseMetricId": "string",
                "timeDimensionId": "string",
                "granularity": "RAW",
                "periodOffset": 0
              }
            ],
            "tableCalculations": [
              {
                "totalMode": "formula",
                "type": "number",
                "format": {
                  "type": "default",
                  "round": 0,
                  "separator": "default",
                  "currency": "string",
                  "compact": {},
                  "prefix": "string",
                  "suffix": "string",
                  "timeInterval": "RAW",
                  "custom": "string"
                },
                "displayName": "string",
                "name": "string",
                "index": 0,
                "sql": "string"
              }
            ],
            "limit": 0,
            "sorts": [
              {
                "pivotValues": [
                  {
                    "value": "string",
                    "reference": "string"
                  }
                ],
                "nullsFirst": true,
                "descending": true,
                "fieldId": "string"
              }
            ],
            "filters": {
              "tableCalculations": {
                "or": [
                  {}
                ],
                "id": "string"
              },
              "metrics": {
                "or": [
                  {}
                ],
                "id": "string"
              },
              "dimensions": {
                "or": [
                  {}
                ],
                "id": "string"
              }
            },
            "metrics": [
              "string"
            ],
            "dimensions": [
              "string"
            ],
            "exploreName": "string"
          },
          "chartConfig": {
            "config": {
              "comparisonField": "string",
              "conditionalFormattings": [
                {
                  "textStyle": {
                    "underline": true,
                    "italic": true,
                    "bold": true
                  },
                  "applyTo": "cell",
                  "rules": [
                    {}
                  ],
                  "darkColor": "string",
                  "color": "string",
                  "target": {
                    "fieldId": "string"
                  }
                }
              ],
              "comparisonLabel": "string",
              "flipColors": true,
              "comparisonFormat": "raw",
              "showComparison": true,
              "showTableNamesInLabel": true,
              "showBigNumberLabel": true,
              "selectedField": "string",
              "style": "auto",
              "label": "string"
            },
            "type": "big_number"
          },
          "pivotConfig": {
            "rows": [
              "string"
            ],
            "columns": [
              "string"
            ]
          },
          "merge": {
            "tableCalculations": [
              {
                "sql": "string",
                "displayName": "string",
                "name": "string"
              }
            ],
            "joinType": "full",
            "joinKey": [
              {
                "fieldIdBySourceId": {
                  "property": "string"
                },
                "name": "string"
              }
            ],
            "sources": [
              {
                "kind": "chart",
                "id": "string"
              }
            ],
            "primarySourceId": "string"
          },
          "slug": "string",
          "parameters": {
            "property": "string"
          },
          "updatedAt": "2024-01-01T00:00:00.000Z",
          "tableConfig": {
            "columnOrder": [
              "string"
            ]
          },
          "dashboardSlug": "string",
          "verification": {
            "verifiedAt": "2024-01-01T00:00:00.000Z",
            "verifiedBy": {
              "lastName": "string",
              "firstName": "string",
              "userUuid": "string"
            }
          },
          "uuid": "string",
          "organizationUuid": "string",
          "projectUuid": "string",
          "pinnedListUuid": "string",
          "pinnedListOrder": 0,
          "hasUnpublishedChanges": true,
          "draftsAwaitingReview": 0,
          "draftOverlayError": {
            "draftUuid": "string",
            "code": "invalid_chart_draft"
          },
          "dismissedDraftUuid": "string",
          "draftStaleness": {
            "conflictingFields": [
              "string"
            ],
            "changedFields": [
              "string"
            ],
            "draftUuid": "string"
          },
          "updatedByUser": {
            "userUuid": "string",
            "firstName": "string",
            "lastName": "string"
          },
          "spaceUuid": "string",
          "spaceName": "string",
          "colorPaletteUuid": "string",
          "deletedAt": "2024-01-01T00:00:00.000Z",
          "deletedBy": {
            "lastName": "string",
            "firstName": "string",
            "userUuid": "string"
          },
          "dashboardUuid": "string",
          "dashboardName": "string",
          "colorPalette": [
            "string"
          ],
          "resolvedColorPalette": {
            "source": {
              "type": "config"
            },
            "paletteName": "string",
            "paletteUuid": "string",
            "darkColors": [
              "string"
            ],
            "colors": [
              "string"
            ]
          },
          "oldUuid": "string",
          "spacePath": "string",
          "spaceSlug": "string"
        },
        "action": "no changes"
      }
    ],
    "dashboards": [
      {
        "data": {
          "name": "string",
          "description": "string",
          "slug": "string",
          "parameters": {
            "property": {
              "value": "string",
              "parameterName": "string"
            }
          },
          "filters": {
            "tableCalculations": [
              {
                "includeNull": true,
                "values": [
                  "string"
                ],
                "operator": "isNull",
                "id": "string",
                "target": {
                  "fallbackType": "string",
                  "isSqlColumn": true,
                  "tableName": "string",
                  "fieldId": "string"
                },
                "settings": "string",
                "disabled": true,
                "required": true,
                "caseSensitive": true,
                "lockedTabUuids": [
                  "string"
                ],
                "requiredGroupId": "string",
                "singleValue": true,
                "label": "string",
                "tileTargets": {
                  "property": {
                    "fallbackType": "string",
                    "isSqlColumn": true,
                    "tableName": "string",
                    "fieldId": "string"
                  }
                }
              }
            ],
            "metrics": [
              {
                "includeNull": true,
                "values": [
                  "string"
                ],
                "operator": "isNull",
                "id": "string",
                "target": {
                  "fallbackType": "string",
                  "isSqlColumn": true,
                  "tableName": "string",
                  "fieldId": "string"
                },
                "settings": "string",
                "disabled": true,
                "required": true,
                "caseSensitive": true,
                "lockedTabUuids": [
                  "string"
                ],
                "requiredGroupId": "string",
                "singleValue": true,
                "label": "string",
                "tileTargets": {
                  "property": {
                    "fallbackType": "string",
                    "isSqlColumn": true,
                    "tableName": "string",
                    "fieldId": "string"
                  }
                }
              }
            ],
            "dimensions": [
              {
                "includeNull": true,
                "values": [
                  "string"
                ],
                "operator": "isNull",
                "id": "string",
                "target": {
                  "fallbackType": "string",
                  "isSqlColumn": true,
                  "tableName": "string",
                  "fieldId": "string"
                },
                "settings": "string",
                "disabled": true,
                "required": true,
                "caseSensitive": true,
                "lockedTabUuids": [
                  "string"
                ],
                "requiredGroupId": "string",
                "singleValue": true,
                "label": "string",
                "tileTargets": {
                  "property": {
                    "fallbackType": "string",
                    "isSqlColumn": true,
                    "tableName": "string",
                    "fieldId": "string"
                  }
                }
              }
            ]
          },
          "updatedAt": "2024-01-01T00:00:00.000Z",
          "verification": {
            "verifiedAt": "2024-01-01T00:00:00.000Z",
            "verifiedBy": {
              "lastName": "string",
              "firstName": "string",
              "userUuid": "string"
            }
          },
          "tabs": [
            {
              "hidden": true,
              "order": 0,
              "name": "string",
              "uuid": "string"
            }
          ],
          "config": {
            "customMetrics": [
              {
                "label": "string",
                "type": "percentile",
                "description": "string",
                "sql": "string",
                "hidden": true,
                "round": 0,
                "compact": "auto",
                "format": "km",
                "separator": "default",
                "table": "string",
                "name": "string",
                "index": 0,
                "filters": [
                  {
                    "includeNull": true,
                    "values": [
                      "string"
                    ],
                    "operator": "isNull",
                    "id": "string",
                    "target": {
                      "fieldRef": "string"
                    },
                    "settings": "string",
                    "disabled": true,
                    "required": true,
                    "caseSensitive": true
                  }
                ],
                "baseDimensionName": "string",
                "baseMetricName": "string",
                "uuid": "string",
                "percentile": 0,
                "distinctKeys": [
                  "string"
                ],
                "formatOptions": {
                  "type": "default",
                  "round": 0,
                  "separator": "default",
                  "currency": "string",
                  "compact": "auto",
                  "prefix": "string",
                  "suffix": "string",
                  "timeInterval": "RAW",
                  "custom": "string"
                },
                "generationType": "periodOverPeriod",
                "baseMetricId": "string",
                "timeDimensionId": "string",
                "granularity": "RAW",
                "periodOffset": 0
              }
            ],
            "requiredFiltersNote": "string",
            "dateZoomConfig": {
              "tileTargets": {
                "property": {
                  "tableName": "string",
                  "fieldId": "string",
                  "controlUuid": "string"
                }
              },
              "controls": [
                {
                  "hidden": true,
                  "granularity": "Second",
                  "name": "string",
                  "uuid": "string"
                }
              ]
            },
            "defaultDateZoomGranularity": "Second",
            "dateZoomGranularities": [
              "Second"
            ],
            "parameterOrder": [
              "string"
            ],
            "pinnedParameters": [
              "string"
            ],
            "isAddFilterDisabled": true,
            "isDateZoomDisabled": true
          },
          "uuid": "string",
          "tiles": [
            {
              "uuid": "string",
              "type": "saved_chart",
              "x": 0,
              "y": 0,
              "h": 0,
              "w": 0,
              "tabUuid": "string",
              "properties": {
                "chartSlug": "string",
                "lastVersionChartKind": {},
                "chartName": "string",
                "belongsToDashboard": true,
                "savedChartUuid": "string",
                "hideTitle": true,
                "title": "string"
              }
            }
          ],
          "organizationUuid": "string",
          "projectUuid": "string",
          "pinnedListUuid": "string",
          "pinnedListOrder": 0,
          "hasUnpublishedChanges": true,
          "draftsAwaitingReview": 0,
          "draftOverlayError": {
            "draftUuid": "string",
            "code": "invalid_dashboard_draft"
          },
          "dismissedDraftUuid": "string",
          "draftStaleness": {
            "conflictingFields": [
              "string"
            ],
            "changedFields": [
              "string"
            ],
            "draftUuid": "string"
          },
          "dashboardVersionId": 0,
          "versionUuid": "string",
          "updatedByUser": {
            "userUuid": "string",
            "firstName": "string",
            "lastName": "string"
          },
          "spaceUuid": "string",
          "spaceName": "string",
          "views": 0,
          "firstViewedAt": "string",
          "colorPaletteUuid": "string",
          "owner": {
            "email": "string",
            "lastName": "string",
            "firstName": "string",
            "userUuid": "string"
          },
          "deletedAt": "2024-01-01T00:00:00.000Z",
          "deletedBy": {
            "lastName": "string",
            "firstName": "string",
            "userUuid": "string"
          },
          "spacePath": "string",
          "spaceSlug": "string"
        },
        "action": "no changes"
      }
    ],
    "spaces": [
      {
        "data": {
          "name": "string",
          "slug": "string",
          "uuid": "string",
          "organizationUuid": "string",
          "projectUuid": "string",
          "inheritParentPermissions": true,
          "projectMemberAccessRole": {},
          "pinnedListUuid": "string",
          "pinnedListOrder": 0,
          "parentSpaceUuid": "string",
          "path": "string",
          "deletedBy": {
            "lastName": "string",
            "firstName": "string",
            "userUuid": "string"
          },
          "deletedAt": "2024-01-01T00:00:00.000Z",
          "appCount": 0,
          "childSpaceCount": 0,
          "dashboardCount": 0,
          "chartCount": 0
        },
        "action": "no changes"
      }
    ]
  },
  "status": "ok"
}

default — Error

{
  "error": {
    "data": "string",
    "message": "string",
    "name": "string",
    "statusCode": 0
  },
  "status": "error"
}