Skip to main content

Test notification filter

POST

Evaluates a notification filter against an alert event and returns whether the filter passes.

Use this endpoint to test filter behavior before saving a subscription filter.

This endpoint only evaluates filters. It does not create or update notification subscriptions.

Request modes

  • Use eventId when you want to test against an existing stored alert event
  • Use event when you want to submit a modified event body for a custom test case

Request body

FieldTypeRequiredDescription
filterobjectYesFilter expression to evaluate
eventobjectConditionallyEvent payload to evaluate against
eventIdstringConditionallyExisting event identifier to load and evaluate
prevEventobjectNoPrevious event payload used when the filter depends on prior state
overridesobjectNoOverride values for selected computed max fields during evaluation

Provide either event or eventId.

You can obtain eventId values from the Alerts API event endpoints, such as List alert events and Get alert event.

If you want to provide a custom event body instead of eventId, start from an alert event returned by the Alerts API and modify it for your test case.

Request behavior

  • If eventId is provided, the API resolves the event from the caller's environment
  • If prevEvent is omitted and eventId resolves to an event with a prior sequence, the API attempts to load the previous event automatically
  • overrides can be used to inject test values for computed max fields without changing stored data
  • Invalid request bodies return 400
  • If eventId is not found, the endpoint returns 404
  • Filter evaluation errors return 200 with an error field in the response body
Historical computed values are not populated automatically in this test endpoint

computed values based on historical notification stats are not populated unless you provide them through overrides.

Event-derived computed values, such as current values, previous values, and presence arrays, are still included in the evaluation context.

Response

  • 200 OK
FieldTypeDescription
passbooleanWhether the filter matched the evaluated event
errorstringPresent when filter evaluation fails
traceobjectValues resolved for variable paths referenced by the filter; use this to understand why the filter passed or failed
contextobjectFull evaluation context used for the filter test

Errors

  • 400: invalid request body, invalid filter, invalid eventId, or neither event nor eventId was provided
  • 404: eventId not found

Example request

{
"filter": {
">=": [
{
"var": "computed.impact.max_24h"
},
3
]
},
"eventId": "alert-123|7",
"overrides": {
"impact": {
"max_24h": 4
}
}
}

Example response

{
"pass": true,
"trace": {
"computed.impact.max_24h": 4
},
"context": {
"event": {},
"computed": {
"impact": {
"max_24h": 4
}
}
}
}