> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# deleteInsight()

- Package: [@gooddata/sdk-ui-dashboard](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/index.md)
- Kind: function
- Stability: alpha
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-ui-dashboard/src/model/commands/insightDelete.ts

> **Alpha API.** Initial API, highly likely to change outside SemVer. Don't build on it in production. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Creates the DeleteInsight command. Dispatching this command will delete the insight (visualization) from the workspace and request a refresh of the visualization list.

**Signature:**

```typescript
export declare function deleteInsight(ref: ObjRef, correlationId?: string): IDeleteInsight;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ref | [ObjRef](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.objref/index.md) | reference of the insight to delete |
| correlationId | string | _(Optional)_ specify correlation id to use for this command. this will be included in all events that will be emitted during the command processing |

**Returns:**

[IDeleteInsight](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui-dashboard/sdk-ui-dashboard.ideleteinsight/index.md)

## Remarks

The command is rejected when the dashboard being edited uses the insight, in a saved or an unsaved widget, visualization switcher entry or drill target; remove it from the dashboard first. Other dashboards are not inspected here; check them before dispatching, for instance with [IWorkspaceInsightsService.getInsightReferencingObjects()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspaceinsightsservice/index.md#iworkspaceinsightsservicegetinsightreferencingobjects).
