{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/orq/json-schema/orq-update-alert-request-schema.json",
  "title": "UpdateAlertRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/orq-alerts-api-openapi.yml#/components/schemas/UpdateAlertRequest",
  "required": [],
  "type": "object",
  "properties": {
    "display_name": {
      "type": "string",
      "description": "New workspace-unique display name. Omit to keep the current name."
    },
    "description": {
      "type": "string",
      "description": "New description. Omit to keep the current description."
    },
    "signal": {
      "type": "string",
      "description": "New UI signal preset. Omit to keep the current value."
    },
    "query": {
      "allOf": [
        {
          "$ref": "#/$defs/AlertQuery"
        }
      ],
      "description": "Replacement query. Omit to keep the current query."
    },
    "condition": {
      "allOf": [
        {
          "$ref": "#/$defs/AlertCondition"
        }
      ],
      "description": "Replacement condition. Omit to keep the current condition."
    },
    "notifier_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Replacement notifier set. Omit to keep the current notifiers."
    },
    "enabled": {
      "type": "boolean",
      "description": "New enabled state. Omit to keep the current state."
    },
    "display": {
      "allOf": [
        {
          "$ref": "#/$defs/AlertDisplay"
        }
      ],
      "description": "Display options to merge. Omitted fields keep their current values."
    }
  },
  "$defs": {
    "AlertCondition": {
      "required": [
        "comparator",
        "threshold",
        "window",
        "interval"
      ],
      "type": "object",
      "properties": {
        "comparator": {
          "enum": [
            "gt",
            "gte",
            "lt",
            "lte",
            "eq"
          ],
          "type": "string",
          "description": "Comparison applied as `value <comparator> threshold`."
        },
        "threshold": {
          "type": "number",
          "description": "Critical-tier threshold. Breaching it opens (or escalates) a\n trigger at critical severity.",
          "format": "double"
        },
        "degraded_threshold": {
          "type": "number",
          "description": "Optional degraded-tier threshold. Values past it but short of\n `threshold` open a trigger at degraded severity. Must sit on the\n recovery side of `threshold` for the chosen comparator and is not\n supported with `eq`.",
          "format": "double"
        },
        "resolve_threshold": {
          "type": "number",
          "description": "Optional custom resolve bound (hysteresis). An open trigger\n resolves only once the value recovers past this bound; defaults to\n the lowest configured tier. Must sit at or past that tier on the\n recovery side. Not supported with `eq`.",
          "format": "double"
        },
        "window": {
          "enum": [
            "5m",
            "15m",
            "30m",
            "1h",
            "4h",
            "1d"
          ],
          "type": "string",
          "description": "Look-back window aggregated on each evaluation tick."
        },
        "interval": {
          "enum": [
            "5m",
            "15m",
            "1h",
            "1d"
          ],
          "type": "string",
          "description": "How often the alert is evaluated. Plan limits may enforce a minimum."
        },
        "delay": {
          "enum": [
            "30s",
            "60s",
            "120s",
            "300s",
            "600s"
          ],
          "type": "string",
          "description": "Ingestion delay subtracted from the evaluation window. Defaults to `30s`."
        }
      }
    },
    "AlertDisplay": {
      "type": "object",
      "properties": {
        "visualization": {
          "enum": [
            "lines",
            "bars"
          ],
          "type": "string",
          "description": "Chart style for the alert activity chart."
        },
        "preview_range": {
          "enum": [
            "1h",
            "4h",
            "1d",
            "7d"
          ],
          "type": "string",
          "description": "Default time range for the alert activity chart."
        }
      }
    },
    "AlertQuery": {
      "required": [
        "metric"
      ],
      "type": "object",
      "properties": {
        "metric": {
          "type": "string",
          "description": "Reporting API catalogue metric, e.g. `genai.cost` or\n `genai.latency.avg`. Validated against the catalogue when the alert\n is saved."
        },
        "filters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MonitorFilter"
          },
          "description": "Reporting filters combined with AND."
        }
      }
    },
    "MonitorFilter": {
      "required": [
        "field",
        "op",
        "values"
      ],
      "type": "object",
      "properties": {
        "field": {
          "type": "string",
          "description": "Reporting dimension to filter on. Valid fields depend on the\n metric; validated when the monitor is saved."
        },
        "op": {
          "enum": [
            "eq",
            "neq",
            "in",
            "not_in",
            "gt",
            "gte",
            "lt",
            "lte",
            "between",
            "contains",
            "exists",
            "not_exists"
          ],
          "type": "string",
          "description": "Predicate operator. `eq` and `neq` accept exactly one value; `in` and `not_in` accept 1-100 values."
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Values compared against the selected field."
        }
      }
    }
  }
}