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

# Create rule exception list items

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

## Paths

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

#### Path parameters

- `id` (string · format: uuid) — required
  Detection rule's identifier

## Description

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

Create exception items that apply to a single detection rule.

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

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[]) — required
  - `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[])
- `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:
- **{ 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/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"
      }
    ]
  }'
```

