---
type: api
title: Create rule exception list items
description: Create exception items that apply to a single detection rule.
url: https://www.elastic.co/docs/api/doc/kibana/v8/operation/operation-createruleexceptionlistitems
resource: https://www.elastic.co/docs/api/doc/kibana/v8/operation/operation-createruleexceptionlistitems
products:
  - Kibana
---

# Create rule exception list items

Authentication: required

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

## Paths

- `POST` `/api/detection_engine/rules/{id}/exceptions`
- `POST` `/s/{space_id}/api/detection_engine/rules/{id}/exceptions`

#### 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.
- `id` (string · format: uuid) — required
  Detection rule's identifier

## Description

Create exception items that apply to a single detection rule.

## Request body

Rule exception list items

`application/json`

- `items` (object[]) — required
  - `comments` (object[]) — optional
    - `comment` (string · format: nonempty · min length: 1) — required
      A string that does not contain only whitespace characters
  - `description` (string) — required
  - `entries` (union anyOf[]) — required
    - **type: match**
      - `type` (enum) — required
        Values: `match`
      - `field` (string · format: nonempty · min length: 1) — required
        A string that does not contain only whitespace characters
      - `operator` (enum) — required
        Values: `excluded`, `included`
      - `value` (string · format: nonempty · min length: 1) — required
        A string that does not contain only whitespace characters
    - **type: match_any**
      - `type` (enum) — required
        Values: `match_any`
      - `field` (string · format: nonempty · min length: 1) — required
        A string that does not contain only whitespace characters
      - `operator` (enum) — required
        Values: `excluded`, `included`
      - `value` (string[] · format: nonempty · min items: 1) — required
    - **type: list**
      - `type` (enum) — required
        Values: `list`
      - `field` (string · format: nonempty · min length: 1) — required
        A string that does not contain only whitespace characters
      - `list` (object) — required
        - `id` (string · format: nonempty · min length: 1) — required
          A string that does not contain only whitespace characters
        - `type` (enum) — required
          Values: `binary`, `boolean`, `byte`, `date`, `date_nanos`, `date_range`, `double`, `double_range`, `float`, `float_range`, `geo_point`, `geo_shape`, `half_float`, `integer`, `integer_range`, `ip`, `ip_range`, `keyword`, `long`, `long_range`, `shape`, `short`, `text`
      - `operator` (enum) — required
        Values: `excluded`, `included`
    - **type: exists**
      - `type` (enum) — required
        Values: `exists`
      - `field` (string · format: nonempty · min length: 1) — required
        A string that does not contain only whitespace characters
      - `operator` (enum) — required
        Values: `excluded`, `included`
    - **type: nested**
      - `type` (enum) — required
        Values: `nested`
      - `entries` (union oneOf[] · min items: 1) — required
        - **type: match**
          - `type` (enum) — required
            Values: `match`
          - `field` (string · format: nonempty · min length: 1) — required
            A string that does not contain only whitespace characters
          - `operator` (enum) — required
            Values: `excluded`, `included`
          - `value` (string · format: nonempty · min length: 1) — required
            A string that does not contain only whitespace characters
        - **type: match_any**
          - `type` (enum) — required
            Values: `match_any`
          - `field` (string · format: nonempty · min length: 1) — required
            A string that does not contain only whitespace characters
          - `operator` (enum) — required
            Values: `excluded`, `included`
          - `value` (string[] · format: nonempty · min items: 1) — required
        - **type: exists**
          - `type` (enum) — required
            Values: `exists`
          - `field` (string · format: nonempty · min length: 1) — required
            A string that does not contain only whitespace characters
          - `operator` (enum) — required
            Values: `excluded`, `included`
      - `field` (string · format: nonempty · min length: 1) — required
        A string that does not contain only whitespace characters
    - **type: wildcard**
      - `type` (enum) — required
        Values: `wildcard`
      - `field` (string · format: nonempty · min length: 1) — required
        A string that does not contain only whitespace characters
      - `operator` (enum) — required
        Values: `excluded`, `included`
      - `value` (string · format: nonempty · min length: 1) — required
        A string that does not contain only whitespace characters
  - `expire_time` (string · format: date-time) — optional
  - `item_id` (string · format: nonempty · min length: 1) — optional
    A string that does not contain only whitespace characters
  - `meta` (object) — optional
  - `name` (string · format: nonempty · min length: 1) — required
    A string that does not contain only whitespace characters
  - `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[] · format: nonempty) — optional
  - `type` (enum) — required
    Values: `simple`

## Responses

#### `200`

Successful response

`application/json`

Type: `object[]`

An array; each item has these fields:

- `_version` (string)
- `comments` (object[])
  - `comment` (string · format: nonempty · min length: 1)
    A string that does not contain only whitespace characters
  - `created_at` (string · format: date-time)
  - `created_by` (string · format: nonempty · min length: 1)
    A string that does not contain only whitespace characters
  - `id` (string · format: nonempty · min length: 1)
    A string that does not contain only whitespace characters
  - `updated_at` (string · format: date-time)
  - `updated_by` (string · format: nonempty · min length: 1)
    A string that does not contain only whitespace characters
- `created_at` (string · format: date-time)
- `created_by` (string)
- `description` (string)
- `entries` (union anyOf[])
  Same options as `entries` in `items`
- `expire_time` (string · format: date-time)
- `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
- `meta` (object)
- `name` (string · format: nonempty · min length: 1)
  A string that does not contain only whitespace characters
- `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[] · format: nonempty)
- `tie_breaker_id` (string)
- `type` (enum)
  Values: `simple`
- `updated_at` (string · format: date-time)
- `updated_by` (string)
#### `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/detection_engine/rules/ID/exceptions
{
  "items": [
    {
      "description": "string",
      "entries": [
        {
          "field": "string",
          "operator": "excluded",
          "type": "match",
          "value": "string"
        }
      ],
      "name": "string",
      "type": "simple"
    }
  ]
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/detection_engine/rules/${ID}/exceptions" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "description": "string",
        "entries": [
          {
            "field": "string",
            "operator": "excluded",
            "type": "match",
            "value": "string"
          }
        ],
        "name": "string",
        "type": "simple"
      }
    ]
  }'
```

## 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
[
  {
    "_version": "string",
    "comments": [
      {
        "comment": "string",
        "created_at": "string",
        "created_by": "string",
        "id": "string",
        "updated_at": "string",
        "updated_by": "string"
      }
    ],
    "created_at": "string",
    "created_by": "string",
    "description": "string",
    "entries": [
      {
        "field": "string",
        "operator": "excluded",
        "type": "match",
        "value": "string"
      }
    ],
    "expire_time": "string",
    "id": "string",
    "item_id": "string",
    "list_id": "string",
    "meta": {},
    "name": "string",
    "namespace_type": "agnostic",
    "os_types": [
      "linux"
    ],
    "tags": [
      "string"
    ],
    "tie_breaker_id": "string",
    "type": "simple",
    "updated_at": "string",
    "updated_by": "string"
  }
]
```

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

