﻿---
title: Exceptions action steps
description: Add exception items to detection rules and shared exception lists from a workflow with the security.createRuleException and security.createExceptionListItem action steps in Elastic Security.
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/explore-analyze/workflows/steps/exceptions
products:
  - Elastic Cloud Enterprise
  - Elastic Cloud Hosted
  - Elastic Cloud Serverless
  - Elastic Cloud on Kubernetes
  - Elastic Documentation
  - Elastic Stack
  - Kibana
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Planned
---

# Exceptions action steps
Exceptions action steps let workflows add an [exception](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/security/detect-and-alert/add-manage-exceptions) to a detection rule or to an exception list in Elastic Security. Use these named steps instead of a generic [`kibana.request`](/elastic/docs-content/pull/9663/explore-analyze/workflows/steps/kibana#kibana-request) call to the exceptions APIs.
Use exceptions steps for patterns like:
- Exclude a host from a rule for the length of a maintenance window.
- Add a scanner's IP address to a shared allowlist when an alert confirms it.
- Create the same exception on every run without producing duplicates.


## Shared conventions

Both exceptions steps share the same conventions.
**Privileges.** The user whose privileges authorize the run needs the privileges described in [Exception privileges](/elastic/docs-content/pull/9663/solutions/security/detect-and-alert/add-manage-exceptions#exception-privileges). To find out which user that is, refer to [Whose privileges authorize a run](/elastic/docs-content/pull/9663/explore-analyze/workflows/authorization#workflows-authorization-user).
**All parameters live under `with`.** There are no top-level fields specific to these steps.
**Entries.** `entries` is an array of conditions, and all must match for the exception to apply. Create separate items for alternative conditions. Each entry combines a `field` with an `operator`. For how each operator matches, and the field types and escaping it needs, refer to [Configure exception conditions](/elastic/docs-content/pull/9663/solutions/security/detect-and-alert/add-manage-exceptions#configure-exception-conditions).

| Operator                                    | Operand                                                                                                                                                                                                                                      |
|---------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `is`, `is_not`, `matches`, `does_not_match` | A single `value`. The match operators support `*` and `?` wildcards.                                                                                                                                                                         |
| `is_one_of`, `is_not_one_of`                | A `values` array.                                                                                                                                                                                                                            |
| `exists`, `does_not_exist`                  | None.                                                                                                                                                                                                                                        |
| `is_in_list`, `is_not_in_list`              | A [value list](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/security/detect-and-alert/create-manage-value-lists), as `list.id` and `list.type`. An item can't mix a value-list entry with other entry types. |

These steps can't target fields mapped as `nested` in Elasticsearch, such as most Elastic Endpoint objects. Manage those exceptions in the Elastic Security UI.
**Re-run safely with `item_id`.** Without `item_id`, every run creates a new exception item, so a retry, a scheduled trigger, or a loop produces duplicates. Provide `item_id` whenever the workflow might run more than once for the same exception. When an item with that `item_id` already exists on the target list, the step skips creation and returns the existing item. When `overwrite` is `true`, the step updates the item instead and keeps its existing comments. `overwrite` requires `item_id`. If the `item_id` exists on a different list, the step fails and leaves that item unchanged.
**Temporary exceptions.** Set `expire_time` to an ISO 8601 datetime to make the exception stop applying after that time.
**Schema convention.** In each schema table on this page, the `Location` column indicates where each parameter sits in the YAML:
- `top level`: Alongside `type` and `name`, at the top of the step or trigger definition.
- ``with``: Inside the step's `with:` block.
- ``on``: Inside the trigger's `on:` block.


## Step catalog

Jump to either step:
[`security.createRuleException`](#security-createruleexception) ·
[`security.createExceptionListItem`](#security-createexceptionlistitem)
---


### `security.createRuleException`

Add an exception item to a detection rule's own default exception list. The step creates the list if the rule doesn't have one yet, and the exception affects only that rule.

| Parameter     | Location | Type       | Required | Description                                                                                                                |
|---------------|----------|------------|----------|----------------------------------------------------------------------------------------------------------------------------|
| `rule_id`     | `with`   | string     | Yes      | The rule's `id`, for example `kibana.alert.rule.uuid` on an alert. Not the rule's `rule_id`.                               |
| `name`        | `with`   | string     | Yes      | Exception item name.                                                                                                       |
| `description` | `with`   | string     | Yes      | Exception item description. Can be empty.                                                                                  |
| `entries`     | `with`   | array      | Yes      | 1 to 100 conditions. Refer to [Shared conventions](#workflows-exceptions-conventions).                                     |
| `item_id`     | `with`   | string     | No       | Stable identifier, so that a re-run updates or skips this item instead of creating a duplicate.                            |
| `overwrite`   | `with`   | boolean    | No       | When `true`, update the existing item with this `item_id` instead of skipping it. Requires `item_id`. Defaults to `false`. |
| `os_types`    | `with`   | `string[]` | No       | Operating systems the exception applies to: `linux`, `macos`, or `windows`.                                                |
| `tags`        | `with`   | `string[]` | No       | Tags for the item.                                                                                                         |
| `expire_time` | `with`   | string     | No       | ISO 8601 datetime after which the exception no longer applies.                                                             |
| `comments`    | `with`   | `string[]` | No       | Comments attached to the item.                                                                                             |

```yaml
- name: exclude_maintenance_host
  type: security.createRuleException
  with:
    rule_id: "{{ event.kibana.alert.rule.uuid }}"
    item_id: "maintenance-window-{{ event.host.name }}"
    overwrite: true
    name: "Exclude maintenance host"
    description: "Host is under maintenance"
    expire_time: "{{ variables.expiration }}"
    entries:
      - field: host.name
        operator: is
        value: "{{ event.host.name }}"
```


### `security.createExceptionListItem`

Add an exception item to an existing exception list. Adding to a shared list affects every rule that uses the list. The step fails if the list doesn't exist.

| Parameter        | Location | Type       | Required | Description                                                                                                                                                                                                      |
|------------------|----------|------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `list_id`        | `with`   | string     | Yes      | The target list's `list_id`.                                                                                                                                                                                     |
| `namespace_type` | `with`   | string     | No       | `single` for a list in the current [space](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/deploy-manage/manage-spaces), or `agnostic` for a list shared across spaces. Defaults to `single`. |
| `name`           | `with`   | string     | Yes      | Exception item name.                                                                                                                                                                                             |
| `description`    | `with`   | string     | Yes      | Exception item description. Can be empty.                                                                                                                                                                        |
| `entries`        | `with`   | array      | Yes      | 1 to 100 conditions. Refer to [Shared conventions](#workflows-exceptions-conventions).                                                                                                                           |
| `item_id`        | `with`   | string     | No       | Stable identifier, so that a re-run updates or skips this item instead of creating a duplicate.                                                                                                                  |
| `overwrite`      | `with`   | boolean    | No       | When `true`, update the existing item with this `item_id` instead of skipping it. Requires `item_id`. Defaults to `false`.                                                                                       |
| `os_types`       | `with`   | `string[]` | No       | Operating systems the exception applies to: `linux`, `macos`, or `windows`.                                                                                                                                      |
| `tags`           | `with`   | `string[]` | No       | Tags for the item.                                                                                                                                                                                               |
| `expire_time`    | `with`   | string     | No       | ISO 8601 datetime after which the exception no longer applies.                                                                                                                                                   |
| `comments`       | `with`   | `string[]` | No       | Comments attached to the item.                                                                                                                                                                                   |

```yaml
- name: allow_approved_scanners
  type: security.createExceptionListItem
  with:
    list_id: corporate-allowlist
    namespace_type: agnostic
    name: "Allow approved scanner IPs"
    description: "Source IPs of the approved scanners"
    entries:
      - field: source.ip
        operator: is_in_list
        list:
          id: approved_scanner_ips
          type: ip
```


## Output

Both steps return the created or existing item.

| Field            | Type     | Description                                                                           |
|------------------|----------|---------------------------------------------------------------------------------------|
| `id`             | `string` | The item's unique ID in Kibana.                                                       |
| `item_id`        | `string` | The item's `item_id`.                                                                 |
| `list_id`        | `string` | The list the item is on. For `security.createRuleException`, the rule's default list. |
| `namespace_type` | `string` | `single` or `agnostic`. Always `single` for a rule's default list.                    |
| `name`           | `string` | The item's name.                                                                      |
| `created_at`     | `string` | When the item was created.                                                            |
| `created_by`     | `string` | The user who created the item.                                                        |
| `expire_time`    | `string` | Present only when set on the item.                                                    |
| `outcome`        | `string` | What the step did: `created`, `skipped`, or `overwritten`.                            |


## Related

- [Security action steps](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/explore-analyze/workflows/steps/security): Overview of the `security.*` step namespace.
- [Detection rules action steps](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/explore-analyze/workflows/steps/detection-rules): Enable or disable detection rules.
- [Add and manage exceptions](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/solutions/security/detect-and-alert/add-manage-exceptions): How exceptions and exception lists work in Elastic Security.
- [Kibana action steps](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9663/explore-analyze/workflows/steps/kibana): Generic `kibana.request` for other exceptions API calls.