Skip to main content
POST
/
api
/
public
/
organizations
/
{orgId}
/
charts
Create a chart
curl --request POST \
  --url https://charts.basedash.com/api/public/organizations/{orgId}/charts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "dashboardId": "<string>",
  "dashboardTabId": "<string>",
  "layout": {
    "x": 1,
    "y": 1,
    "width": 2,
    "height": 2
  },
  "name": "<string>",
  "description": "<string>",
  "chartType": "TABLE",
  "sqlQuery": "<string>",
  "drilldownSqlQuery": "<string>",
  "databaseConnectionId": "<string>",
  "xAxisProperty": "<string>",
  "xAxisSecondaryProperty": "<string>",
  "yAxisProperty": "<string>",
  "staticContent": "<string>"
}
'
{
  "data": {
    "id": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "dashboardId": "<string>",
    "dashboardTabId": "<string>",
    "organizationId": "<string>",
    "name": "<string>",
    "description": "<string>",
    "chartType": "TABLE",
    "sqlQuery": "<string>",
    "drilldownSqlQuery": "<string>",
    "databaseConnectionId": "<string>",
    "xAxisProperty": "<string>",
    "xAxisSecondaryProperty": "<string>",
    "yAxisProperty": "<string>",
    "staticContent": "<string>",
    "layout": {
      "x": 1,
      "y": 1,
      "width": 2,
      "height": 2
    }
  }
}

Authorizations

Authorization
string
header
required

API key authentication using Bearer token format: Bearer <basedash_api_key>

Path Parameters

orgId
string
required

Organization ID

Body

application/json
dashboardId
string
required

ID of the dashboard to place the chart on

Minimum string length: 1
dashboardTabId
string

ID of the dashboard tab to place the chart on. Defaults to the first tab.

layout
object

Position and size of the chart on the dashboard grid. Defaults to the bottom of the tab.

name
string

Name of the chart

Minimum string length: 1
description
string | null

Description of the chart

chartType

Type of the chart

Available options:
TABLE
sqlQuery
string

SQL query powering the chart

drilldownSqlQuery
string | null

SQL query used for chart drill-downs

databaseConnectionId
string | null

ID of the data source the SQL query runs against

xAxisProperty
string | null

Result column used for the x-axis

xAxisSecondaryProperty
string | null

Result column used to break down the x-axis into segments

yAxisProperty
string | null

Result column used for the y-axis

staticContent
string | null

Static content for DASHBOARD_HEADER and DASHBOARD_TEXT chart types

Response

Chart created successfully

data
object
required