Skip to main content
Alerting & Response/Alert Events

ValidateAlertExpression

Validate a PromQL expression for syntax correctness

POST/api/v1/alerting/dry-run/validate

Operation ID

ValidateAlertExpression

Since

1.0.0

Execution Mode

Synchronous

Auth Context

Auth Required

Auth Context

Send these values as request headers when calling this API.

AuthorizationstringRequired

Bearer Token

X-Tenant-IDstring

X-Tenant-ID

Request Inputs

application/json

Body Fields

  • expression
    StringRequired

    PromQL expression to validate

    Example: avg(cpu_usage_percent) > 90

Responses

200 OK
200 OK

On success, this API returns the following response structure.

  • valid
    Boolean

    Whether the expression is valid

    Example: true

  • parseError
    String

    Parse error if expression is invalid

    Example: syntax error at line 5

  • errorPosition
    Integer

    Character position of the error

    Example: 20

  • suggestion
    String

    Suggested correction for the expression

    Example: consider increasing the threshold

  • exprType
    String

    Detected expression type (instant, range, etc.)

    Example: instant