---
type: api
title: Delete a data view
description: Delete a data view by its identifier. WARNING: When you delete a data view, it cannot be recovered.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v0/operation/operation-deletedataviewdefault
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v0/operation/operation-deletedataviewdefault
products:
  - Kibana
---

# Delete a data view

- Server: `https://{kibana_url}`

## Paths

- `DELETE` `/api/data_views/data_view/{viewId}`

#### Path parameters

- `viewId` (string) — required
  An identifier for the data view.
  Example: `ff959d40-b880-11e8-a6d9-e546fe2bba5f`

## Description

Delete a data view by its identifier. WARNING: When you delete a data view, it cannot be recovered.

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## Header parameters

- `kbn-xsrf` (string) — required
  Cross-site request forgery protection

## Responses

#### `204`

Indicates a successful call.

#### `404`

Object is not found.

`application/json`

- `error` (enum)
  Values: `Not Found`
- `message` (string)
- `statusCode` (enum)
  Values: `404`
## Code examples

#### Console

```console
DELETE kbn://api/data_views/data_view/{viewId}
```

#### curl

```curl
curl \
  -X DELETE "${KIBANA_URL}/api/data_views/data_view/${DATA_VIEW_ID}" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "kbn-xsrf: true"
```

## Response examples

#### A not found response.

The requested data view or runtime field was not found in the current Kibana space.

```json
{
  "error": "Not Found",
  "message": "Saved object [index-pattern/caaad6d0-920c-11ed-b36a-874bd1548a00] not found",
  "statusCode": 404
}
```

