Create an alert Deprecated
Deprecated in 7.13.0. Use the create rule API instead.
Path parameters
-
An UUID v1 or v4 identifier for the alert. If this parameter is omitted, the identifier is randomly generated.
Body Required
-
actions array[object]
-
The ID of the alert type that you want to call when the alert is scheduled to run.
-
The name of the application that owns the alert. This name has to match the Kibana feature name, as that dictates the required role-based access control privileges.
-
enabled boolean
Indicates if you want to run the alert on an interval basis after it is created.
-
A name to reference and search.
-
The condition for throttling the notification.
Values are
onActionGroupChange
,onActiveAlert
, oronThrottleInterval
. -
The parameters to pass to the alert type executor
params
value. This will also validate against the alert type params validator, if defined. -
The schedule specifying when this alert should be run. A schedule is structured such that the key specifies the format you wish to use and its value specifies the schedule.
-
throttle string
How often this alert should fire the same actions. This will prevent the alert from sending out the same notification over and over. For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, setting a throttle of
10m
or1h
will prevent it from sending 90 notifications during this period.
curl \
-X POST https://localhost:5601/api/alerts/alert/41893910-6bca-11eb-9e0d-85d233e3ee35 \
-H "Content-Type: application/json; Elastic-Api-Version=2023-10-31" \
-H "kbn-xsrf: string"
# Headers
kbn-xsrf: string
# Payload
{
"actions": [
{
"actionTypeId": "string",
"group": "string",
"id": "string",
"params": {}
}
],
"alertTypeId": "string",
"consumer": "string",
"enabled": true,
"name": "string",
"notifyWhen": "onActionGroupChange",
"params": {},
"schedule": {
"interval": "10s"
},
"tags": [
"string"
],
"throttle": "string"
}
{
"actions": [
{}
],
"alertTypeId": ".index-threshold",
"apiKeyOwner": "elastic",
"createdAt": "2022-12-05T23:36:58.284Z",
"createdBy": "elastic",
"enabled": true,
"executionStatus": {
"lastExecutionDate": "2022-12-06T00:13:43.890Z",
"status": "ok"
},
"id": "b530fed0-74f5-11ed-9801-35303b735aef",
"muteAll": false,
"mutedInstanceIds": [
"string"
],
"name": "my alert",
"notifyWhen": "onActionGroupChange",
"params": {},
"schedule": {
"interval": "string"
},
"scheduledTaskId": "b530fed0-74f5-11ed-9801-35303b735aef",
"tags": [
"string"
],
"throttle": "string",
"updatedAt": "2022-12-05T23:36:58.284Z",
"updatedBy": "elastic"
}
{
"error": "Unauthorized",
"message": "string",
"statusCode": 401
}