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

# Import saved objects

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

## Paths

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

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

Create sets of Kibana saved objects from a file created by the export API.
Saved objects can be imported only into the same version, a newer minor on the same major, or the next major. Exported saved objects are not backwards compatible and cannot be imported into an older version of Kibana.

## Query String Parameters

- `createNewCopies` (boolean)
  Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict errors are avoided. NOTE: This option cannot be used with the `overwrite` and `compatibilityMode` options.
- `overwrite` (boolean)
  Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object. NOTE: This option cannot be used with the `createNewCopies` option.
- `compatibilityMode` (boolean)
  Applies various adjustments to the saved objects that are being imported to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with imported saved objects. NOTE: This option cannot be used with the `createNewCopies` option.

## Request Body

`multipart/form-data`

- `file` (object) — optional
  A file exported using the export API. Changing the contents of the exported file in any way before importing it can cause errors, crashes or data loss. NOTE: The `savedObjects.maxImportExportSize` configuration setting limits the number of saved objects which may be included in this file. Similarly, the `savedObjects.maxImportPayloadBytes` setting limits the overall size of the file that can be imported.

## Responses

#### `200`

Indicates a successful call.

`application/json`

- `errors` ([] object)
  Indicates the import was unsuccessful and specifies the objects that failed to import.

NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and conflict error.
- `success` (boolean)
  Indicates when the import was successfully completed. When set to false, some objects may not have been created. For additional information, refer to the `errors` and `successResults` properties.
- `successCount` (integer)
  Indicates the number of successfully imported records.
- `successResults` ([] object)
  Indicates the objects that are successfully imported, with any metadata if applicable.

NOTE: Objects are created only when all resolvable errors are addressed, including conflicts and missing references. If objects are created as new copies, each entry in the `successResults` array includes a `destinationId` attribute.
#### `400`

Bad request.

`application/json`

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

#### curl

```curl
curl \
  -X POST api/saved_objects/_import?createNewCopies=true
  -H "kbn-xsrf: true"
  --form file=@file.ndjson
```

## Request Examples

#### Import objects

```json
{
  "file": "file.ndjson"
}
```

## Response Examples

#### The import objects API response indicates a successful import and the objects are created. Since these objects are created as new copies, each entry in the successResults array includes a destinationId attribute.

```json
{
  "success": true,
  "successCount": 1,
  "successResults": [
    {
      "destinationId": "82d2760c-468f-49cf-83aa-b9a35b6a8943",
      "id": "90943e30-9a47-11e8-b64d-95841ca0b247",
      "managed": false,
      "meta": {
        "icon": "indexPatternApp",
        "title": "Kibana Sample Data Logs"
      },
      "type": "index-pattern"
    }
  ]
}
```

