# Run dashboard chart

Requests to run the specified chart. Acceptance of a request does not mean chart results have been generated.

```text
POST https://api.moi.matrixorigin.cn/v5/data-dashboards/{dashboard_id}/charts/{chart_id}/run
```

## 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.
- `$CHART_ID`: `chart_id` to use, specifying the target resource through the request path.

## Call example

```bash
curl -X POST "https://api.moi.matrixorigin.cn/v5/data-dashboards/$DASHBOARD_ID/charts/$CHART_ID/run" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Path parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `dashboard_id` | string | Yes | Data dashboard ID. |
| `chart_id` | string | Yes | Chart ID. |
## Successful response

When the request is successful, the data of this operation is returned. Just because the write or run request has been accepted does not mean that the subsequent processing has been completed; please confirm the result based on the return status or subsequent query.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {"chart_id": "chart-001", "execution_id": "exec-001", "status": "submitted"}
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `data.chart_id` | string | Chart ID. |
| `data.execution_id` | string | Chart run ID. |
| `data.status` | string | Running status. |

## 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"
}
```
:::
::::

When scheduling or refresh services are unavailable, HTTP `503` uses an integer `code` (`503`) and a localized string `message`.

## Follow-up operations

Use the same identifier [query chart results](get-data-dashboard-chart-result.md).
