---
type: api
title: Set the default data view
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-setdefaultdatailviewdefault
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-setdefaultdatailviewdefault
products:
  - Kibana
---

# Set the default data view

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

## Paths

- `POST` `/api/data_views/default`
- `POST` `/s/{space_id}/api/data_views/default`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#basicauth)

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Set the default data view for the current Kibana space. The default data view is used as a fallback when no specific data view is selected.

## Request Body

`application/json`

- `data_view_id` (string) — required — nullable
  The data view identifier. NOTE: The API does not validate whether it is a valid identifier. Use `null` to unset the default data view.
- `force` (boolean · default: false) — optional
  Update an existing default data view identifier.

## Responses

#### `200`

Indicates a successful call.

`application/json`

- `acknowledged` (boolean)
#### `400`

Bad request

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (number)
## Code Examples

#### Console

```console
POST kbn://api/data_views/default
{"data_view_id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f","force":true}
```

#### curl

```curl
curl \
  -X POST "${KIBANA_URL}/api/data_views/default" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{"data_view_id":"ff959d40-b880-11e8-a6d9-e546fe2bba5f","force":true}'
```

## Response Examples

#### The default data view was set successfully.

The acknowledged flag confirms that the default data view for the current Kibana space was updated.

```json
{
  "acknowledged": true
}
```

#### A bad request response.

The request was rejected because the payload or query parameters are missing required fields or contain invalid values.

```json
{
  "error": "Bad Request",
  "message": "[request body.data_view.title]: expected value of type [string] but got [undefined]",
  "statusCode": 400
}
```

