Import detection rules
- Base URL
-
https://{kibana_url}
- POST /api/detection_engine/rules/_import
- POST /s/{space_id}/api/detection_engine/rules/_import
Refer to Spaces for more information.
Import detection rules from an .ndjson file, including actions and exception lists. The request must include:
- The
Content-Type: multipart/form-dataHTTP header. - A link to the
.ndjsonfile containing the rules.
When used with API key authentication, the user's key gets assigned to the created or updated rules. If the user's key gets deleted or the user becomes inactive, the rules will stop running.
If the API key that is used for authorization has different privileges than the key that created or most recently updated the rule, the rule behavior might change.
To import rules with actions, you need at least Read privileges for the Action and Connectors feature. To overwrite or add new connectors, you need All privileges for the Actions and Connectors feature. To import rules without actions, you don’t need Actions and Connectors privileges. Refer to Enable and access detections for more information.
Rule actions and connectors are included in the exported file, but sensitive information about the connector (such as authentication credentials) is not included. You must re-add missing connector details after importing detection rules.
You can use Kibana’s Saved Objects UI (Stack Management → Kibana → Saved Objects) or the Saved Objects APIs (experimental) to export and import any necessary connectors before importing detection rules.
Similarly, any value lists used for rule exceptions are not included in rule exports or imports. Use the Manage value lists UI (Rules → Detection rules (SIEM) → Manage value lists) to export and import value lists separately.
Query parameters
-
overwriteboolean · default: false -
Determines whether existing rules with the same
rule_idare overwritten. If an imported rule matches the existing rule's settings, including whether it's enabled, the existing rule isn't updated. It keeps itsrevision,updated_attimestamp, and API key, and is counted inrules_summary.skipped. -
overwrite_exceptionsboolean · default: false -
Determines whether existing exception lists with the same
list_idare overwritten. Both the exception list container and its items are overwritten.
Response
Indicates a successful call.
-
action_connectors_errorsobjectrequired -
rule_idstring -
A stable unique identifier for the rule object. It can be assigned during rule creation. It can be any string, but often is a UUID. It should be unique not only within a given Kibana space, but also across spaces and Elastic environments. The same prebuilt Elastic rule, when installed in two different Kibana spaces or two different Elastic environments, will have the same
rule_ids. -
errorsobjectrequired -
rule_idstring -
A stable unique identifier for the rule object. It can be assigned during rule creation. It can be any string, but often is a UUID. It should be unique not only within a given Kibana space, but also across spaces and Elastic environments. The same prebuilt Elastic rule, when installed in two different Kibana spaces or two different Elastic environments, will have the same
rule_ids. -
exceptions_errorsobjectrequired -
rule_idstring -
A stable unique identifier for the rule object. It can be assigned during rule creation. It can be any string, but often is a UUID. It should be unique not only within a given Kibana space, but also across spaces and Elastic environments. The same prebuilt Elastic rule, when installed in two different Kibana spaces or two different Elastic environments, will have the same
rule_ids.