Skip to main content
Alerting & Response/Alert Rules

ValidateAlertRule

Validate an alert rule definition for correctness before saving

POST/api/v1/alerting/rules/validate

Operation ID

ValidateAlertRule

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

  • rule
    Object

    Alert rule input to validate

    • name
      String

      Rule name to validate

      Example: High CPU Usage

    • promql
      String

      PromQL expression for the rule

      Example: avg(cpu_usage_percent) > 90

    • threshold
      Double

      Threshold value for the rule

      Example: 90

      {"format":"double"}

    • for
      String

      Duration string for the for clause

      Example: 5m

Responses

200 OK

Successful response

Content-Type: application/json

Response body root type: object

  • valid
    Boolean

    Whether the rule definition is valid

    Example: true

  • promqlErrors
    List

    List of PromQL syntax errors if any

  • wouldFireNow
    Boolean

    Whether the rule would currently fire

    Example: false

  • currentValue
    Double

    Current metric value if evaluated

    Example: 45.2

    {"format":"double"}

  • threshold
    Double

    Threshold used in validation check

    Example: 90

    {"format":"double"}

  • nameConflict
    Boolean

    Whether the rule name conflicts with an existing rule

    Example: false

  • validationErrors
    List

    General validation errors beyond PromQL