Create or replace an action policy
https://{kibana_url}
- PUT /api/alerting/v2/action_policies/{id}
Creates an action policy with the given identifier, or fully replaces it if one already exists.
[Required authorization] Route required privileges: manage_alerting-v2-action-policies AND read_alerting-v2-rules.
Path Parameters
-
idstring · min: 1 · max: 150required -
The ID of the action policy. Copy it from the response when you create a policy, fetch one policy, or fetch the policy list.
Request
-
descriptionstring · max: 1024required -
A description of the action policy.
-
destinations· min: 1 · max: 10required -
The list of destinations. At least one is required.
-
group_bystring · max: 16 -
The fields used to group alerts.
-
grouping_mode -
The grouping mode: per_episode groups by episode lifecycle, all sends a single notification for all alerts, per_field groups by the specified fields.
-
Values:
per_episodeallper_field -
matcherobject -
Selects the alerts this policy applies to. Set
tagsto match alerts from rules with those tags. Setexpressionto a KQL query, which will be evaluated against each alert.
If you set bothtagsandexpression, an alert must match the tags and the expression for the policy to apply. Whenmatcherisnull, or when bothtagsandexpressionare empty, the policy applies to all alerts. -
expressionstring · max: 4096nullable -
A KQL query that's evaluated against each alert. Supported fields are:
episode_id,episode_status,group_hash,last_event_timestamp,severity, and your rule's query output columns underdata.*(for example,data.host.name). Referencing other fields won't work. Omitmatcher.expressionor set it tonullto match ontagsalone. -
Rule tags this policy should match. The policy applies to alerts from any rule that has at least one of these tags. Omit
matcher.tagsor set it tonullto match onmatcher.expressionalone. -
namestring · min: 1 · max: 256required -
The name of the action policy.
Responses
Returns the replaced action policy.
-
authobjectrequired -
Authentication and ownership information.
-
created_by_userbooleanrequired -
Whether this policy was created by a user (vs system-generated).
-
ownerstringrequired -
The owner of the action policy.
-
created_atstringrequired -
The ISO datetime when the action policy was created.
-
created_bystringrequired nullable -
The user ID who created the action policy.
-
descriptionstringrequired -
A description of the action policy.
-
destinationsrequired -
The list of destinations.
-
enabledbooleanrequired -
Whether the action policy is enabled.
-
group_bystringrequired nullable -
The fields used to group alerts, or null for no grouping.
-
grouping_modeobjectrequired -
The grouping mode for alert notifications.
-
Values:
per_episodeallper_field -
idstringrequired -
The unique identifier for the action policy.
-
matcherobjectrequired nullable -
Selects the alerts this policy applies to. Set
tagsto match alerts from rules with those tags. Setexpressionto a KQL query, which will be evaluated against each alert.
If you set bothtagsandexpression, an alert must match the tags and the expression for the policy to apply. Whenmatcherisnull, or when bothtagsandexpressionare empty, the policy applies to all alerts. -
expressionstring · max: 4096nullable -
A KQL query that's evaluated against each alert. Supported fields are:
episode_id,episode_status,group_hash,last_event_timestamp,severity, and your rule's query output columns underdata.*(for example,data.host.name). Referencing other fields won't work. Omitmatcher.expressionor set it tonullto match ontagsalone. -
Rule tags this policy should match. The policy applies to alerts from any rule that has at least one of these tags. Omit
matcher.tagsor set it tonullto match onmatcher.expressionalone. -
namestringrequired -
The name of the action policy.
-
snoozed_untilstringrequired nullable -
The ISO datetime until which the policy is snoozed, or null if not snoozed.
-
throttleobjectrequired nullable -
The throttle configuration for notifications.
-
updated_atstringrequired -
The ISO datetime when the action policy was last updated.
-
updated_bystringrequired nullable -
The user ID who last updated the action policy.
-
versionstring -
The version, used for optimistic concurrency control.
Returns the newly created action policy.
-
authobjectrequired -
Authentication and ownership information.
-
created_by_userbooleanrequired -
Whether this policy was created by a user (vs system-generated).
-
ownerstringrequired -
The owner of the action policy.
-
created_atstringrequired -
The ISO datetime when the action policy was created.
-
created_bystringrequired nullable -
The user ID who created the action policy.
-
descriptionstringrequired -
A description of the action policy.
-
destinationsrequired -
The list of destinations.
-
enabledbooleanrequired -
Whether the action policy is enabled.
-
group_bystringrequired nullable -
The fields used to group alerts, or null for no grouping.
-
grouping_modeobjectrequired -
The grouping mode for alert notifications.
-
Values:
per_episodeallper_field -
idstringrequired -
The unique identifier for the action policy.
-
matcherobjectrequired nullable -
Selects the alerts this policy applies to. Set
tagsto match alerts from rules with those tags. Setexpressionto a KQL query, which will be evaluated against each alert.
If you set bothtagsandexpression, an alert must match the tags and the expression for the policy to apply. Whenmatcherisnull, or when bothtagsandexpressionare empty, the policy applies to all alerts. -
expressionstring · max: 4096nullable -
A KQL query that's evaluated against each alert. Supported fields are:
episode_id,episode_status,group_hash,last_event_timestamp,severity, and your rule's query output columns underdata.*(for example,data.host.name). Referencing other fields won't work. Omitmatcher.expressionor set it tonullto match ontagsalone. -
Rule tags this policy should match. The policy applies to alerts from any rule that has at least one of these tags. Omit
matcher.tagsor set it tonullto match onmatcher.expressionalone. -
namestringrequired -
The name of the action policy.
-
snoozed_untilstringrequired nullable -
The ISO datetime until which the policy is snoozed, or null if not snoozed.
-
throttleobjectrequired nullable -
The throttle configuration for notifications.
-
updated_atstringrequired -
The ISO datetime when the action policy was last updated.
-
updated_bystringrequired nullable -
The user ID who last updated the action policy.
-
versionstring -
The version, used for optimistic concurrency control.
Indicates an invalid schema or parameters.
-
codestringrequired -
Stable error code you can branch on, for example
INVALID_SCHEDULEorRULE_ALREADY_EXISTS. -
detailsmap string to object -
Optional extra information about the error, for example field validation issues or the
rule_idwhen that ID already exists. -
errorstringrequired -
A short human-readable summary of the error category (e.g., "Not Found", "Bad Request"). Subject to change without notice. Do not parse or rely on its content.
-
messagestringrequired -
A readable explanation of the error. The wording can change without notice. Do not parse this field.
Indicates the request was not authenticated.
-
codestringrequired -
Stable error code you can branch on, for example
INVALID_SCHEDULEorRULE_ALREADY_EXISTS. -
detailsmap string to object -
Optional extra information about the error, for example field validation issues or the
rule_idwhen that ID already exists. -
errorstringrequired -
A short human-readable summary of the error category (e.g., "Not Found", "Bad Request"). Subject to change without notice. Do not parse or rely on its content.
-
messagestringrequired -
A readable explanation of the error. The wording can change without notice. Do not parse this field.
Indicates the user does not have the required privileges to perform the request.
-
codestringrequired -
Stable error code you can branch on, for example
INVALID_SCHEDULEorRULE_ALREADY_EXISTS. -
detailsmap string to object -
Optional extra information about the error, for example field validation issues or the
rule_idwhen that ID already exists. -
errorstringrequired -
A short human-readable summary of the error category (e.g., "Not Found", "Bad Request"). Subject to change without notice. Do not parse or rely on its content.
-
messagestringrequired -
A readable explanation of the error. The wording can change without notice. Do not parse this field.
Indicates the action policy was created or updated concurrently by another caller.
-
codestringrequired -
Stable error code you can branch on, for example
INVALID_SCHEDULEorRULE_ALREADY_EXISTS. -
detailsmap string to object -
Optional extra information about the error, for example field validation issues or the
rule_idwhen that ID already exists. -
errorstringrequired -
A short human-readable summary of the error category (e.g., "Not Found", "Bad Request"). Subject to change without notice. Do not parse or rely on its content.
-
messagestringrequired -
A readable explanation of the error. The wording can change without notice. Do not parse this field.
Indicates an unexpected server-side error.
-
codestringrequired -
Stable error code you can branch on, for example
INVALID_SCHEDULEorRULE_ALREADY_EXISTS. -
detailsmap string to object -
Optional extra information about the error, for example field validation issues or the
rule_idwhen that ID already exists. -
errorstringrequired -
A short human-readable summary of the error category (e.g., "Not Found", "Bad Request"). Subject to change without notice. Do not parse or rely on its content.
-
messagestringrequired -
A readable explanation of the error. The wording can change without notice. Do not parse this field.
Indicates the alerting engine is disabled by the alerting:v2:enabled advanced setting.
-
codestringrequired -
Stable error code you can branch on, for example
INVALID_SCHEDULEorRULE_ALREADY_EXISTS. -
detailsmap string to object -
Optional extra information about the error, for example field validation issues or the
rule_idwhen that ID already exists. -
errorstringrequired -
A short human-readable summary of the error category (e.g., "Not Found", "Bad Request"). Subject to change without notice. Do not parse or rely on its content.
-
messagestringrequired -
A readable explanation of the error. The wording can change without notice. Do not parse this field.