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

# Import an exception list

Authentication: required

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

## Paths

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

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

## Description

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

## 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:
- **PlatformErrorResponse**
  - `error` (string)
  - `message` (string)
  - `statusCode` (integer)
- **SiemErrorResponse**
  - `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}"
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "error": {
        "message": "string",
        "status_code": 0
      },
      "id": "string",
      "item_id": "string",
      "list_id": "string"
    }
  ],
  "success": false,
  "success_count": 0,
  "success_count_exception_list_items": 0,
  "success_count_exception_lists": 0,
  "success_exception_list_items": false,
  "success_exception_lists": false
}
```

#### 400

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "error": "string",
  "message": "string",
  "statusCode": 0
}
```

#### 401

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "error": "string",
  "message": "string",
  "statusCode": 0
}
```

#### 403

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "error": "string",
  "message": "string",
  "statusCode": 0
}
```

#### 500

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "message": "string",
  "status_code": 0
}
```

