---
type: api
title: Preview a saved object reference swap
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-previewswapdataviewsdefault
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-previewswapdataviewsdefault
products:
  - Kibana
---

# Preview a saved object reference swap

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

## Paths

- `POST` `/api/data_views/swap_references/_preview`
- `POST` `/s/{space_id}/api/data_views/swap_references/_preview`

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

## Description

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

Preview the impact of swapping saved object references from one data view identifier to another.

## Request Body

`application/json`

- `delete` (boolean) — optional
  Deletes referenced saved object if all references are removed.
- `forId` (union string | [] string) — optional
  Limit the affected saved objects to one or more by identifier.
- `forType` (string) — optional
  Limit the affected saved objects by type.
- `fromId` (string) — required
  The saved object reference to change.
- `fromType` (string) — optional
  Specify the type of the saved object reference to alter. The default value is `index-pattern` for data views.
- `toId` (string) — required
  New saved object reference value to replace the old value.

## Response

Indicates a successful call.

`application/json`

- `result` ([] object)
  - `id` (string)
    A saved object identifier.
  - `type` (string)
    The saved object type.
## Code Examples

#### Console

```console
POST /api/data_views/swap_references/_preview
{
  "fromId": "abcd-efg",
  "toId": "xyz-123"
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/data_views/swap_references/_preview" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "fromId": "abcd-efg",
  "toId": "xyz-123"
}'
```

