---
type: api
title: Export saved objects
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-saved-objects-export
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-saved-objects-export
products:
  - Kibana
---

# Export saved objects

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

## Paths

- `POST` `/api/saved_objects/_export`
- `POST` `/s/{space_id}/api/saved_objects/_export`

- [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.

Retrieve sets of saved objects that you want to import into Kibana. You must include `type` or `objects` in the request body. The output of exporting saved objects must be treated as opaque. Tampering with exported data risks introducing unspecified errors and data loss.

Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.

NOTE: The exported saved objects include `coreMigrationVersion` and `typeMigrationVersion` metadata. If you store exported saved objects outside of Kibana (for example in NDJSON files) or generate them yourself, you must preserve or include these fields to retain forward compatibility across Kibana versions.

NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be exported.

## Request Body

`application/json`

- `excludeExportDetails` (boolean · default: false) — optional
  Do not add export details entry at the end of the stream.
- `hasReference` (union anyOf) — optional
  `object` or `object[]`
  - `id` (string · max: 512) — required
  - `type` (string · max: 256) — required
- `includeReferencesDeep` (boolean · default: false) — optional
  Includes all of the referenced objects in the exported objects.
- `objects` ([] object · max: 10000) — optional
  A list of objects to export. NOTE: this optional parameter cannot be combined with the `types` option
  - `id` (string · max: 512) — required
  - `type` (string · max: 256) — required
- `search` (string · max: 10000) — optional
  Search for documents to export using the Elasticsearch Simple Query String syntax.
- `type` (union string | [] string) — optional
  The saved object types to include in the export. Use `*` to export all the types. Valid options depend on enabled plugins, but may include `visualization`, `dashboard`, `search`, `index-pattern`, `tag`, `config`, `config-global`, `lens`, `map`, `event-annotation-group`, `query`, `url`, `action`, `alert`, `alerting_rule_template`, `apm-indices`, `cases-user-actions`, `cases`, `cases-comments`, `infrastructure-monitoring-log-view`, `ml-trained-model`, `osquery-saved-query`, `osquery-pack`, `osquery-pack-asset`.

## Responses

#### `200`

Indicates a successfull call.

`application/x-ndjson`

Type: `object`

#### `400`

Bad request.

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (enum)
  Values: `400`
## Code Examples

#### Console

```console
POST kbn://api/saved_objects/_export
{"objects":[{"type":"dashboard","id":"example-dashboard-1"}],"includeReferencesDeep":false,"excludeExportDetails":true}
```

#### curl

```curl
curl \
  -X POST "${KIBANA_URL}/api/saved_objects/_export" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{"objects":[{"type":"dashboard","id":"example-dashboard-1"}],"includeReferencesDeep":false,"excludeExportDetails":true}'
```

## Response Examples

#### The export response contains an NDJSON record for each exported object

```json
{"id":"example-dashboard-1","type":"dashboard","attributes":{"title":"Example dashboard 1"},"references":[],"managed":false}
{"exportedCount":1,"missingRefCount":0,"missingReferences":[]}
```

#### A bad request error

```json
{
  "error": "Bad Request",
  "message": "Either \u0060type\u0060 or \u0060objects\u0060 are required.: Bad Request",
  "statusCode": 400
}
```

