---
type: api
title: Get all data views
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana-serverless/operation/operation-getalldataviewsdefault
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana-serverless/operation/operation-getalldataviewsdefault
products:
  - Kibana
---

# Get all data views

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

## Paths

- `GET` `/api/data_views`
- `GET` `/s/{space_id}/api/data_views`

## Description

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

Retrieve a list of all data views. Use this endpoint to identify available data views in the current Kibana space.

## Authentication

- Api key: `Authorization: <value>`
  You must create an API key and use the encoded value in the request header. To learn about creating keys, go to [API keys](https://www.elastic.co/docs/current/serverless/api-keys).

## Responses

#### `200`

Indicates a successful call.

`application/json`

- `data_view` (object[])
  - `id` (string)
  - `name` (string)
  - `namespaces` (string[])
  - `title` (string)
  - `typeMeta` (object)
#### `400`

Bad request

`application/json`

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

#### Console

```console
GET kbn://api/data_views
```

#### curl

```curl
curl \
  -X GET "${KIBANA_URL}/api/data_views" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### The get all data views API returns a list of data views.

A list of available data views including their identifiers, names, and index patterns.

```json
{
  "data_view": [
    {
      "id": "ff959d40-b880-11e8-a6d9-e546fe2bba5f",
      "name": "Kibana Sample Data eCommerce",
      "namespaces": [
        "default"
      ],
      "title": "kibana_sample_data_ecommerce",
      "typeMeta": {}
    },
    {
      "id": "d3d7af60-4c81-11e8-b3d7-01146121b73d",
      "name": "Kibana Sample Data Flights",
      "namespaces": [
        "default"
      ],
      "title": "kibana_sample_data_flights"
    },
    {
      "id": "90943e30-9a47-11e8-b64d-95841ca0b247",
      "name": "Kibana Sample Data Logs",
      "namespaces": [
        "default"
      ],
      "title": "kibana_sample_data_logs"
    }
  ]
}
```

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

