Create Scheduled Alert
(v2)POST
Creates an alert that re-runs an aggregate query on a schedule and notifies when the result crosses the threshold, and returns its id. 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.
curl -X POST "https://api.confident-ai.com/v2/scheduled-alerts" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"recurrence": "ONCE",
"repeatEvery": 1,
"repeatUnit": "MINUTE",
"startAt": "2025-02-01T09:00:00Z",
"maxRuns": 12,
"endAt": "2025-12-31T23:59:59Z",
"description": "Errors above 5% over the last hour.",
"filters": {
"operator": "AND",
"groups": [
{
"operator": "AND",
"filters": [
{
"category": "Trace Name",
"condition": "Is",
"value": "checkout"
}
]
}
]
},
"severity": "CRITICAL",
"name": "Trace error rate spike",
"type": "THRESHOLD",
"dataModel": "TRACE",
"aggregation": "ERROR_RATE",
"thresholdSettings": {
"value": 0.05,
"direction": "above"
},
"detectionSettings": {
"direction": "WORSENED",
"significantOnly": true,
"minAffectedCount": 20
},
"enabled": true
}'{
"success": true,
"data": {
"id": "<SCHEDULED-ALERT-ID>"
},
"link": "https://app.confident-ai.com/project/<PROJECT-ID>/monitors",
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Request body
recurrenceenumHow often a schedule fires:
ONCEruns a single time atstartAt,INTERVALrepeats everyrepeatEveryrepeatUnits.Show 2 enum valuesHide 2 enum values
ONCEINTERVAL
repeatEveryinteger | nullHow many
repeatUnits apart the runs are, for anINTERVALschedule. Sendnullto clear it.repeatUnitenum | nullThe unit
repeatEverycounts for anINTERVALschedule.Show 5 enum valuesHide 5 enum values
MINUTEHOURDAYWEEKMONTH
startAtstring | nullWhen the schedule first runs, as an ISO 8601 datetime. Send
nullto start it immediately.maxRunsinteger | nullHow many times the schedule runs before it stops. Send
nullto let it run indefinitely.endAtstring | nullWhen the schedule stops running, as an ISO 8601 datetime. Send
nullto leave it open-ended.descriptionstring | nullWhat the alert means and what to do about it, included in the notification. Send
nullto clear it.filtersobject | nullA set of filter groups combined by a top-level operator. Each group combines its filter rows by its own operator, and each row matches one property, such as
NameorUser Id, against a value with a condition such asIsorContains.Show 2 propertiesHide 2 properties
operatorenumRequiredShow 2 enum valuesHide 2 enum values
ANDOR
groupslist of objectsRequiredShow 2 propertiesHide 2 properties
operatorenumRequiredShow 2 enum valuesHide 2 enum values
ANDOR
filterslist of objectsRequiredShow 4 propertiesHide 4 properties
categoryenumRequiredShow 98 enum valuesHide 98 enum values
User IdCustomer IdCustomer NameThread IdTrace UUIDTrace NameTrace VersionTrace StatusTrace TagsTraceSpan UUIDNameSpan NameSpan TypeSpan StatusMetrics StatusError StatusCalled toolHanded off toHanded off byNearest parent of typeAnywhere underTop levelNameModelProviderIntegrationInput argumentEmbedderChunk SizeTop-KHyperparameterDatasetDataset NameTest Run IDIdentifierTest FileStatusOfficialEvals ModeTests PassedTests FailedPass RateFail RateStar RatingThumbs RatingExplanationExpected OutputExpected OutcomeAnnotatorEnd UserAnnotation TypeAnnotation NameAnnotation DateAnnotation RatingAnnotation ThumbsAnnotation ChoiceAnnotation Yes / NoAnnotation TextMetric ScoreMetric StatusNameMetadataClassifierMetricMetric NameTrace CountTest Case IDRequested review fromAssigned toTagsLabelsTools CalledFinalizedGolden IDIngestion TaskLatencyEnvironmentReview flagVulnerabilityVulnerability TypeAttack MethodRisk CategoryFrameworkAssessment IDPrompt AliasPrompt VersionPrompt LabelPrompt Commit HashPromptAnnotationsFailure ModeRecommendedSub-mode NameSub-mode RecommendedSub-mode CertaintyStatus CodeActor Type
conditionenum | enum | enum | enum | enum | enum | enum | enum | enum | enumRequiredShow 10 variantsHide 10 variants
enum
Show 6 enum valuesHide 6 enum values
Is less thanIs equal or less thanIs greater thanIs equal or greater thanIs equal toDoes not equal
- OR
enum
Show 2 enum valuesHide 2 enum values
HasHas not
- OR
enum
Show 2 enum valuesHide 2 enum values
IsIs not
- OR
enum
Show 2 enum valuesHide 2 enum values
Is one ofIs not one of
- OR
enum
Show 4 enum valuesHide 4 enum values
IsIs notIs emptyIs not empty
- OR
enum
Show 2 enum valuesHide 2 enum values
ContainsDoes not contain
- OR
enum
Show 3 enum valuesHide 3 enum values
ContainsContains onlyDoes not contain
- OR
enum
Show 4 enum valuesHide 4 enum values
Has decreased by more thanHas decreased by less thanHas increased by more thanHas increased by less than
- OR
enum
Show 1 enum valueHide 1 enum value
Has changed from
- OR
enum
Show 1 enum valueHide 1 enum value
Is between
valuestring | number | list of stringsRequiredShow 3 variantsHide 3 variants
string
- OR
number
- OR
list of strings
keystring
severityenumHow urgent the alert is. It also decides who hears about it: an integration receives an alert only when it subscribes to that severity.
Show 4 enum valuesHide 4 enum values
CRITICALERRORWARNINGINFO
namestringRequiredA name for the alert, shown in the notification.
typeenumWhat the alert watches.
THRESHOLDalerts compare an aggregation againstthresholdSettings.REGRESSION,ANOMALYandSIGNAL_SPIKEalerts notify on every run while Confident AI detects one inside the alert'sfilters, as configured bydetectionSettings. Defaults toTHRESHOLD.Show 4 enum valuesHide 4 enum values
THRESHOLDREGRESSIONANOMALYSIGNAL_SPIKE
dataModelenumRequiredWhat kind of production item an alert measures over.
TRACEandSPANalerts aggregate single requests;THREADalerts aggregate conversations.Show 8 enum valuesHide 8 enum values
TRACESPANLLM_SPANAGENT_SPANRETRIEVER_SPANTOOL_SPANCUSTOM_SPANTHREAD
aggregationstringWhat to measure, as an aggregation token. Which tokens are valid depends on
dataModel:TRACEacceptsCOUNT,ERROR_RATE,PASS_RATE,UNIQUE_END_USERS,UNIQUE_THREADS,AVG_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,TOTAL_COST,AVG_COST,UNIQUE_METADATA_VALUES;SPANacceptsCOUNT,AVG_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,ERROR_RATE,ERROR_COUNT,INPUT_COST,OUTPUT_COST,TOTAL_COST,AVG_COST,INPUT_TOKENS,OUTPUT_TOKENS,TOTAL_TOKENS,UNIQUE_METADATA_VALUES;LLM_SPANacceptsCOUNT,AVG_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,ERROR_RATE,ERROR_COUNT,INPUT_COST,OUTPUT_COST,TOTAL_COST,AVG_COST,INPUT_TOKENS,OUTPUT_TOKENS,TOTAL_TOKENS,UNIQUE_METADATA_VALUES;AGENT_SPANacceptsCOUNT,AVG_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,ERROR_RATE,ERROR_COUNT,INPUT_COST,OUTPUT_COST,TOTAL_COST,AVG_COST,UNIQUE_METADATA_VALUES;RETRIEVER_SPANacceptsCOUNT,AVG_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,ERROR_RATE,ERROR_COUNT,INPUT_COST,OUTPUT_COST,TOTAL_COST,AVG_COST,UNIQUE_METADATA_VALUES;TOOL_SPANacceptsCOUNT,AVG_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,ERROR_RATE,ERROR_COUNT,INPUT_COST,OUTPUT_COST,TOTAL_COST,AVG_COST,UNIQUE_METADATA_VALUES;CUSTOM_SPANacceptsCOUNT,AVG_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,ERROR_RATE,ERROR_COUNT,INPUT_COST,OUTPUT_COST,TOTAL_COST,AVG_COST,UNIQUE_METADATA_VALUES;THREADacceptsCOUNT,UNIQUE_USERS,UNIQUE_METADATA_VALUES. Required forTHRESHOLDalerts only.thresholdSettingsobjectWhen the alert fires. Latency is compared in seconds, cost in
USD, and rates such asERROR_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
detectionSettingsobject | object | objectWhich detections notify, for
REGRESSION,ANOMALYandSIGNAL_SPIKEalerts. Regressions and anomalies take an optionaltraceName(omit for every trace), optionalmetrics(omit for all ofavg_score,error_rate,avg_latency,avg_cost,negative_label_rate),direction(WORSENEDorANY) andminAffectedCount, the fewest affected traces a detection needs; regressions also takesignificantOnly. Signal spikes takeclassifierIds,directionandminAffectedCount, counted in threads whendataModelisTHREAD.Show 3 variantsHide 3 variants
object
Show 5 propertiesHide 5 properties
traceNamestringmetricslist of enumsShow 5 enum valuesHide 5 enum values
avg_scoreerror_rateavg_latencyavg_costnegative_label_rate
directionenumRequiredShow 2 enum valuesHide 2 enum values
WORSENEDANY
minAffectedCountintegerRequiredsignificantOnlybooleanRequired
- OR
object
Show 4 propertiesHide 4 properties
traceNamestringmetricslist of enumsShow 5 enum valuesHide 5 enum values
avg_scoreerror_rateavg_latencyavg_costnegative_label_rate
directionenumRequiredShow 2 enum valuesHide 2 enum values
WORSENEDANY
minAffectedCountintegerRequired
- OR
object
Show 3 propertiesHide 3 properties
classifierIdslist of stringsRequireddirectionenumRequiredShow 2 enum valuesHide 2 enum values
WORSENEDANY
minAffectedCountintegerRequired
enabledbooleanWhether the schedule runs. Defaults to
true.
Response
Create Scheduled Alert succeeded.
successbooleanIndicates if the request was successful.
dataobjectA reference to a scheduled alert by its id.
Show 1 propertyHide 1 property
idstringThe id of the scheduled alert, generated by Confident AI.
linkstringThis is the URL of the resource on the Confident AI platform.
deprecatedbooleanIndicates if this endpoint is deprecated.