---
type: api
title: Create 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-createexceptionlist
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v8/operation/operation-createexceptionlist
products:
  - Kibana
---

# Create an exception list

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

## Paths

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

## Description

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

An exception list groups exception items and can be associated with detection rules. You can assign detection rules with multiple exception lists.
> info
> All exception items added to the same list are evaluated using `OR` logic. That is, if any of the items in a list evaluate to `true`, the exception prevents the rule from generating an alert. Likewise, `OR` logic is used for evaluating exceptions when more than one exception list is assigned to a rule. To use the `AND` operator, you can define multiple clauses (`entries`) in a single exception item.

## 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>`

## Request body

Exception list's properties

`application/json`

- `description` (string) — required
- `list_id` (string · format: nonempty · min length: 1) — optional
  A string that does not contain only whitespace characters
- `meta` (object) — optional
- `name` (string) — required
- `namespace_type` (enum) — optional
  Determines whether the exception container is available in all Kibana spaces or just the space
in which it is created, where:

- `single`: Only available in the Kibana space in which it is created.
- `agnostic`: Available in all Kibana spaces.
  Values: `agnostic`, `single`
- `os_types` (enum[]) — optional
  Values: `linux`, `macos`, `windows`
- `tags` (string[]) — optional
- `type` (enum) — required
  Values: `detection`, `rule_default`, `endpoint`, `endpoint_trusted_apps`, `endpoint_events`, `endpoint_host_isolation_exceptions`, `endpoint_blocklists`
- `version` (integer · min: 1) — optional

## Responses

#### `200`

Successful response

`application/json`

- `_version` (string)
- `created_at` (string · format: date-time)
- `created_by` (string)
- `description` (string)
- `id` (string · format: nonempty · min length: 1)
  A string that does not contain only whitespace characters
- `immutable` (boolean)
- `list_id` (string · format: nonempty · min length: 1)
  A string that does not contain only whitespace characters
- `meta` (object)
- `name` (string)
- `namespace_type` (enum)
  Determines whether the exception container is available in all Kibana spaces or just the space
in which it is created, where:

- `single`: Only available in the Kibana space in which it is created.
- `agnostic`: Available in all Kibana spaces.
  Values: `agnostic`, `single`
- `os_types` (enum[])
  Values: `linux`, `macos`, `windows`
- `tags` (string[])
- `tie_breaker_id` (string)
- `type` (enum)
  Values: `detection`, `rule_default`, `endpoint`, `endpoint_trusted_apps`, `endpoint_events`, `endpoint_host_isolation_exceptions`, `endpoint_blocklists`
- `updated_at` (string · format: date-time)
- `updated_by` (string)
- `version` (integer · min: 1)
#### `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)
#### `409`

Exception list already exists response

`application/json`

- `message` (string)
- `status_code` (integer)
#### `500`

Internal server error response

`application/json`

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

#### Console

```console
POST kbn:/api/exception_lists
{
  "description": "string",
  "name": "string",
  "type": "detection"
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/exception_lists" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "string",
    "name": "string",
    "type": "detection"
  }'
```

