---
type: api
title: Import an exception list
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v8/operation/operation-importexceptionlist
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v8/operation/operation-importexceptionlist
products:
  - Kibana
---

# Import an exception list

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

## Paths

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

## Description

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

Import an exception list and its associated items from an NDJSON file.

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## Query string parameters

- `overwrite` (boolean · default: false) — optional
  Determines whether existing exception lists with the same `list_id` are overwritten.
If any exception items have the same `item_id`, those are also overwritten.
- `overwrite_exceptions` (boolean · default: false) — optional
- `overwrite_action_connectors` (boolean · default: false) — optional
- `as_new_list` (boolean · default: false) — optional
  Determines whether the list being imported will have a new `list_id` generated.
Additional `item_id`'s are generated for each exception item. Both the exception
list and its items are overwritten.

## Request body

`multipart/form-data`

- `file` (string · format: binary) — optional
  A `.ndjson` file containing the exception list

## Responses

#### `200`

Successful response

`application/json`

- `errors` (object[])
  - `error` (object)
    - `message` (string)
    - `status_code` (integer)
  - `id` (string · format: nonempty · min length: 1)
    A string that does not contain only whitespace characters
  - `item_id` (string · format: nonempty · min length: 1)
    A string that does not contain only whitespace characters
  - `list_id` (string · format: nonempty · min length: 1)
    A string that does not contain only whitespace characters
- `success` (boolean)
- `success_count` (integer · min: 0)
- `success_count_exception_list_items` (integer · min: 0)
- `success_count_exception_lists` (integer · min: 0)
- `success_exception_list_items` (boolean)
- `success_exception_lists` (boolean)
#### `400`

Invalid input data response

`application/json`

One of:
- **{ error, statusCode }**
  - `error` (string)
  - `message` (string)
  - `statusCode` (integer)
- **{ status_code }**
  - `message` (string)
  - `status_code` (integer)
#### `401`

Unsuccessful authentication response

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (integer)
#### `403`

Not enough privileges response

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (integer)
#### `500`

Internal server error response

`application/json`

- `message` (string)
- `status_code` (integer)
## Code examples

#### Console

```console
POST kbn:/api/exception_lists/_import
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/exception_lists/_import" \
  -H "Authorization: ApiKey ${API_KEY}"
```

