Skip to main content
Alerting & Response/Alert Events
POSTAlertingSince 1.0SynchronousAuth Required

ValidateAlertExpression

Validate a PromQL expression for syntax correctness

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Request Inputs

Body Fields

  • expressionStringRequired

    PromQL expression to validate

    Example: avg(cpu_usage_percent) > 90

Responses

200 OK

On success, this API returns the following response structure.

  • validBoolean

    Whether the expression is valid

    Example: true

  • parseErrorString

    Parse error if expression is invalid

    Example: syntax error at line 5

  • errorPositionInteger

    Character position of the error

    Example: 20

  • suggestionString

    Suggested correction for the expression

    Example: consider increasing the threshold

  • exprTypeString

    Detected expression type (instant, range, etc.)

    Example: instant

Endpoint

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

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

Operation ID

ValidateAlertExpression

Permalink

Request Example

curl -X POST '{host}/api/v1/alerting/dry-run/validate' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"expression":"avg(cpu_usage_percent) > 90"}'

Response Example

200
{
  "valid": true,
  "parseError": "connection refused",
  "errorPosition": 20,
  "suggestion": "consider increasing the threshold",
  "exprType": "instant"
}

Change History

This API has no change history records yet.

View all change history