Create dashboard chart

Create a chart in the specified data dashboard.

POST https://moi.matrixorigin.cn/newmoi/data-dashboards/{dashboard_id}/charts

Preparation before calling

Prepare a personal access token and target workspace ID that has access to the target workspace.

The example below uses:

  • $AI_STUDIO_API_KEY: The actual personal access token, passed through the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through X-Workspace-ID Header.

  • $DASHBOARD_ID: dashboard_id to use, specifying the target resource via the request path.

Request body

Replace caller-specific values in the example with actual values.

namestringRequired
Chart name.
chart_typestringRequired
Chart type.
sql_textstringRequired
Chart SQL.
chart_configstringRequired
Chart configuration.
layout_configstringRequired
Layout configuration.
refresh_intervalstringRequired
Refresh cycle.
alert_enabledbooleanRequired
Whether to enable alarms.
alert_configstringRequired
Alarm configuration.

Request example

curl -X POST "https://moi.matrixorigin.cn/newmoi/data-dashboards/$DASHBOARD_ID/charts" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "每日订单数",
    "chart_type": "line",
    "sql_text": "SELECT 1",
    "chart_config": "{}",
    "layout_config": "{}",
    "refresh_interval": "manual",
    "alert_enabled": false,
    "alert_config": "{}"
  }'

Successful response

When the creation is successful, the HTTP status code is 201, and the code in the response body is 0.

{
  "code": 0,
  "data": {
    "ID": "0198ce79-2320-76aa-9d34-7f8e9d0c1b2a",
    "DashboardID": "0198ce73-3d20-7c12-9a11-1a2b3c4d5e6f",
    "Name": "每日订单数",
    "ChartType": "line",
    "SQLText": "SELECT 1",
    "DatabaseName": "analytics",
    "ChartConfig": "{}",
    "LayoutConfig": "{}",
    "RefreshInterval": "manual",
    "SchedulerTaskID": "",
    "ScheduleVersion": 1,
    "ScheduleStatus": "ready",
    "ScheduleError": "",
    "ScheduleOperationID": "operation-001",
    "AlertEnabled": false,
    "AlertConfig": "{}",
    "SnapshotEpochAt": "2026-08-21T07:00:00Z",
    "CreatedAt": "2026-08-21T07:00:00Z",
    "UpdatedAt": "2026-08-21T07:00:00Z"
  }
}

The response fields are as follows.

Field

Type

Description

data.ID

string

Chart ID.

data.DashboardID

string

The ID of the data dashboard.

data.Name

string

Chart name.

data.ChartType

string

Chart type.

data.SQLText

string

Chart SQL.

data.DatabaseName

string

Database name used for chart query.

data.ChartConfig

string

Chart configuration.

data.LayoutConfig

string

Layout configuration.

data.RefreshInterval

string

Refresh cycle.

data.SchedulerTaskID

string

Scheduling task ID; empty when no scheduling task is created.

data.ScheduleVersion

integer

Scheduling configuration version.

data.ScheduleStatus

string

Scheduling status.

data.ScheduleError

string

Scheduling error; empty if there is no error.

data.ScheduleOperationID

string

ID of this scheduling operation.

data.AlertEnabled

boolean

Whether to enable alarms.

data.AlertConfig

string

Alarm configuration.

data.SnapshotEpochAt

string

Result snapshot starting time.

data.CreatedAt

string

Creation time.

data.UpdatedAt

string

Update time.

Error response

codeinteger or string
Error code or status.
messagestring
Error message.

Error response example

{
  "code": 2,
  "message": "invalid argument",
  "details": {
    "domain": "moi-core.catalog.data_dashboard",
    "reason": "DATA_DASHBOARD_INVALID_REQUEST"
  }
}
Last updated on