# Create data dashboard

Create data dashboards and connect data sources.

```text
POST https://api.moi.matrixorigin.cn/v5/data-dashboards
```

## 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.


## Request body

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

::::{div} mo-api-split
:::{div} mo-api-split-main
```{raw} html
<dl class="mo-api-fields">
<div class="mo-api-field"><dt><code>name</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>Data dashboard name.</dd></div>
<div class="mo-api-field"><dt><code>description</code><span class="mo-api-field__type">string</span></dt><dd>Data dashboard description; omission saves an empty string.</dd></div>
<div class="mo-api-field"><dt><code>sources</code><span class="mo-api-field__type">array</span><span class="mo-api-field__required">Required</span></dt><dd>List of data sources.</dd></div>
<div class="mo-api-field"><dt><code>sources[].table_id</code><span class="mo-api-field__type">integer</span><span class="mo-api-field__required">Required</span></dt><dd>Data source table ID.</dd></div>
</dl>
```
:::
:::{div} mo-api-split-aside
```{raw} html
<p class="mo-api-example-label">Request example</p>
```
```bash
curl -X POST "https://api.moi.matrixorigin.cn/v5/data-dashboards" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "销售概览",
    "description": "按日查看销售数据",
    "sources": [{"table_id": 1001}]
  }'
```
:::
::::
## Successful response

Creation succeeds with HTTP `200`, `code: "OK"`, and `msg: "OK"`.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "ID": "0198ce73-3d20-7c12-9a11-1a2b3c4d5e6f",
    "Name": "销售概览",
    "Description": "按日查看销售数据",
    "CreatedByRoleID": "role-001",
    "CreatedAt": "2026-08-21T07:00:00Z",
    "UpdatedAt": "2026-08-21T07:00:00Z"
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `data.ID` | string | Data dashboard ID. |
| `data.Name` | string | Data dashboard name. |
| `data.Description` | string | Data dashboard description. |
| `data.CreatedByRoleID` | string | The role ID used when creating the data dashboard. |
| `data.CreatedAt` | string | Creation time. |
| `data.UpdatedAt` | string | Update time. |

## Error response

This example corresponds to HTTP `400`.

::::{div} mo-api-split
:::{div} mo-api-split-main
```{raw} html
<dl class="mo-api-fields">
<div class="mo-api-field"><dt><code>code</code><span class="mo-api-field__type">string</span></dt><dd>Error code, such as ErrParamInvalid or ErrDataDashboardNotFound.</dd></div>
<div class="mo-api-field"><dt><code>msg</code><span class="mo-api-field__type">string</span></dt><dd>HTTP status text, such as Bad Request or Not Found.</dd></div>
</dl>
```
:::
:::{div} mo-api-split-aside
```json
{
  "code": "ErrParamInvalid",
  "msg": "Bad Request"
}
```
:::
::::

## Follow-up operations

Record `data.ID`, then [create chart](create-data-dashboard-chart.md).
