Create Scheduled Alert
POSThttps://api.confident-ai.com/v1/scheduled-alerts
Creates an alert that re-runs an aggregate query on a schedule and notifies when the result crosses the threshold.
Notifications are delivered through the project's integrations that have alerting enabled for the alert's severity, so an alert in a project with no such integration still evaluates but reaches nobody.
Retrieve the alert by id to read back the stored definition, including the schedule the server derived.
curl -X POST "https://api.confident-ai.com/v1/scheduled-alerts" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Trace error rate spike",
"description": "Errors above 5% over the last hour",
"dataModel": "TRACE",
"aggregation": "ERROR_RATE",
"thresholdSettings": {
"value": 0.05,
"direction": "above"
},
"severity": "ERROR",
"recurrence": "INTERVAL",
"repeatEvery": 1,
"repeatUnit": "HOUR"
}'{
"success": true,
"data": {
"id": "SCHEDULED-ALERT-ID"
},
"link": "https://app.confident-ai.com/project/<PROJECT-ID>/monitors"
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Request body
descriptionstringWhat the alert means and what to do about it. Included in the notification.
filtersobjectA set of filter groups combined by a top-level operator.
Show 2 propertiesHide 2 properties
operatorenumRequiredHow filters or groups are combined.
Show 2 enum valuesHide 2 enum values
ANDOR
groupslist of objectsRequiredThe filter groups.
Show 2 propertiesHide 2 properties
operatorenumRequiredHow filters or groups are combined.
Show 2 enum valuesHide 2 enum values
ANDOR
filterslist of objectsRequiredThe filter rows in this group.
Show 4 propertiesHide 4 properties
categorystringRequiredThe property a filter row matches on (e.g. "Name", "User Id", "Model", "Metadata"). The set of valid values depends on the line's dataModel.
conditionenumRequiredThe comparison a filter row applies. Valid conditions depend on the category.
Show 18 enum valuesHide 18 enum values
IsIs notIs equal toDoes not equalIs less thanIs equal or less thanIs greater thanIs equal or greater thanHasHas notContainsContains onlyDoes not containHas increased by more thanHas increased by less thanHas decreased by more thanHas decreased by less thanHas changed from
valuestring | number | list of stringsRequiredThe value to match against.
Show 3 variantsHide 3 variants
string
- OR
number
- OR
list of strings
keystringThe property key. Auto-populated from category when omitted; required for Metadata, Metric, and Classifier filters.
severityenumHow urgent the alert is. Also decides which of the project's integrations receive it. Defaults to
WARNING.Show 4 enum valuesHide 4 enum values
CRITICALERRORWARNINGINFO
recurrenceenumWhether the alert runs repeatedly or a single time. Defaults to
INTERVAL.Show 2 enum valuesHide 2 enum values
ONCEINTERVAL
repeatEveryintegerHow many
repeatUnits between runs. Required forINTERVAL.repeatUnitenumThe unit paired with
repeatEvery. Together they also set the measurement window, so an alert repeating every hour compares the last hour of data. AONCEalert measures the last 24 hours.Show 5 enum valuesHide 5 enum values
MINUTEHOURDAYWEEKMONTH
startAtstringWhen the schedule starts running. Starts immediately when omitted.
maxRunsintegerStop the alert after it has triggered this many times.
endAtstringWhen the schedule stops running.
enabledbooleanWhether the schedule runs. Defaults to true on create. An alert whose run limit or end date has passed cannot be re-enabled.
namestringRequiredA name for the alert, shown in the notification.
dataModelenumRequiredWhat kind of item the alert measures over.
Show 3 enum valuesHide 3 enum values
TRACESPANTHREAD
aggregationstringRequiredWhat to measure. Which values are valid depends on
dataModel:TRACEaccepts COUNT, ERROR_RATE, PASS_RATE, UNIQUE_END_USERS, UNIQUE_THREADS, AVG_LATENCY, P50_LATENCY, P90_LATENCY, P99_LATENCY;SPANaccepts COUNT, AVG_LATENCY, P50_LATENCY, P90_LATENCY, P99_LATENCY, INPUT_COST, OUTPUT_COST, TOTAL_COST, AVG_COST, INPUT_TOKENS, OUTPUT_TOKENS, TOTAL_TOKENS;THREADaccepts COUNT and UNIQUE_USERS. NoteSPANhas no error rate andTRACEhas no cost aggregation.thresholdSettingsobjectRequiredWhen the alert fires. Latency is compared in seconds, cost in USD, and rates such as
ERROR_RATEas fractions between 0 and 1.Show 2 propertiesHide 2 properties
valuenumberRequiredThe number the measured value is compared against.
directionenumRequiredWhether the alert fires when the measured value rises above the threshold or falls below it.
Show 2 enum valuesHide 2 enum values
abovebelow
Response
successbooleanIndicates if the scheduled alert was successfully created.
dataobjectShow 1 propertyHide 1 property
idstringThe unique identifier of the created scheduled alert.
linkstringA link to the monitors page.