---
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/4493/api/doc/kibana/v8/operation/operation-setdefaultdatailviewdefault
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v8/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`

## Description

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

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

## 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 "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "data_view_id": "ff959d40-b880-11e8-a6d9-e546fe2bba5f",
    "force": true
  }'
```

