Export rulesedit

Exports rules to an .ndjson file. Please note that you cannot export prebuilt rules, but they are available at https://github.com/elastic/detection-rules/tree/main/rules/.

Console supports Elasticsearch APIs only. Console doesn’t allow interactions with Kibana APIs. You must use curl or another HTTP tool instead. For more information, refer to Run Elasticsearch API requests.

Detection rule actions are included in the exported file, but the connectors used by the actions are not included.

Use the Saved Objects UI in Kibana (Stack ManagementKibanaSaved Objects) or the Saved Objects APIs (experimental) to export and import any connectors used by your detection rule actions before you export and import the detection rules.

Request URLedit

POST <kibana host>:<port>/api/detection_engine/rules/_export

URL query parametersedit

Name Type Description Required



Determines whether a summary of the exported rules is returned.

No, defaults to false.



File name for saving the exported rules.

No, defaults to export.ndjson

When using cURL to export rules to a file, use the -O and -J options to save the rules to the file name specified in the URL.

Request bodyedit

An optional JSON objects array containing the rule_id fields of the rules you want to export:

Name Type Description Required



Array of rule_id fields.

No, exports all rules when unspecified.

Example requestedit

Exports two rules without details and saves them to the exported_rules.ndjson file:

POST api/detection_engine/rules/_export?exclude_export_details=true&file_name=exported_rules.ndjson
  "objects": [

Response codeedit

Indicates a successful call.