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

# Import Timelines

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

## Paths

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

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

## Description

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

Import Timelines.

## Request Body

`application/json`

The Timelines to import as a readable stream.

- `file` (object) — required
- `isImmutable` (enum) — optional
  Whether the Timeline should be immutable
  Values: `true`, `false`

## Responses

#### `200`

Indicates a successful call.

`application/json`

- `errors` ([] object)
  The list of failed Timeline imports
  - `error` (object)
    The error containing the reason why the timeline could not be imported
    - `message` (string)
      The reason why the timeline could not be imported
    - `status_code` (number)
      The HTTP status code of the error
  - `id` (string)
    The ID of the timeline that failed to import
- `success` (boolean)
  Indicates whether any of the Timelines were successfully imports
- `success_count` (number)
  The amount of successfully imported/updated Timelines
- `timelines_installed` (number)
  The amount of successfully installed Timelines
- `timelines_updated` (number)
  The amount of successfully updated Timelines
#### `400`

Bad Request response.

`application/json`

- `body` (string)
  The error message
- `statusCode` (number)
#### `404`

Not found response.

`application/json`

- `body` (string)
  The error message
- `statusCode` (number)
#### `409`

Indicates the import of Timelines was unsuccessful.

`application/json`

- `body` (string)
  The error message
- `statusCode` (number)
## Code Examples

#### Console

```console
POST /api/timeline/_import
{
  "file": "{\u0022savedObjectId\u0022:\u002215c1929b-0af7-42bd-85a8-56e234cc7c4e\u0022,\u0022version\u0022:\u0022WzE0LDFd\u0022}\\n",
  "isImmutable": "false"
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/timeline/_import" \
  -H "Content-Type: application/json" \
  -d '{
  "file": "{\u0022savedObjectId\u0022:\u002215c1929b-0af7-42bd-85a8-56e234cc7c4e\u0022,\u0022version\u0022:\u0022WzE0LDFd\u0022}\\n",
  "isImmutable": "false"
}'
```

## Response Examples

#### Import summary

```json
{
  "errors": [],
  "success": true,
  "success_count": 5,
  "timelines_installed": 3,
  "timelines_updated": 2
}
```

#### Invalid import

```json
{
  "body": "Invalid file extension",
  "statusCode": 400
}
```

#### Saved objects client missing

```json
{
  "body": "Unable to find saved object client",
  "statusCode": 404
}
```

#### Import conflict

```json
{
  "body": "Could not import timelines",
  "statusCode": 409
}
```

