{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/instana/json-schema/instana-service-levels-alert-config-schema.json",
  "title": "ServiceLevelsAlertConfig",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/instana-service-levels-alert-configuration-api-openapi.yml#/components/schemas/ServiceLevelsAlertConfig",
  "type": "object",
  "properties": {
    "alertChannelIds": {
      "type": "array",
      "description": "This is the list of channel IDs when alert triggered and sent to.",
      "items": {
        "type": "string",
        "description": "This is the list of channel IDs when alert triggered and sent to."
      },
      "maxItems": 1024,
      "minItems": 0,
      "uniqueItems": true
    },
    "burnRateConfig": {
      "type": "array",
      "description": "This is the burn rate alert configuration which defines alerting windows and corresponding thresholds. This configuration must to specified for BURN_RATE_V2 Alerts.",
      "items": {
        "$ref": "#/$defs/ServiceLevelsBurnRateConfig"
      },
      "uniqueItems": true
    },
    "burnRateTimeWindows": {
      "$ref": "#/$defs/ServiceLevelsBurnRateTimeWindows"
    },
    "customPayloadFields": {
      "type": "array",
      "description": "This is the custom name and value pairs to be sent along with the alert to the alert channels.",
      "items": {
        "$ref": "#/$defs/CustomPayloadField"
      },
      "maxItems": 20,
      "minItems": 0
    },
    "description": {
      "type": "string",
      "description": "The description of the alert. It is also the alert message content.",
      "maxLength": 65536,
      "minLength": 0
    },
    "name": {
      "type": "string",
      "description": "Name of the Service Levels Smart Alerts Configuration.",
      "maxLength": 256,
      "minLength": 0
    },
    "rule": {
      "$ref": "#/$defs/ServiceLevelsAlertRule"
    },
    "severity": {
      "type": "integer",
      "format": "int32",
      "description": "This is the severity of the alert. The value can be: <b>5</b>: warning, <b>10</b>: critical."
    },
    "sloIds": {
      "type": "array",
      "description": "This is the list of SLO configurations related to this alert.",
      "items": {
        "type": "string",
        "description": "This is the list of SLO configurations related to this alert."
      },
      "maxItems": 1024,
      "minItems": 0,
      "uniqueItems": true
    },
    "threshold": {
      "$ref": "#/$defs/StaticThreshold"
    },
    "timeThreshold": {
      "$ref": "#/$defs/ServiceLevelsTimeThreshold"
    },
    "triggering": {
      "type": "boolean",
      "description": "Incident flag. If value is true, this alert will become an accident."
    }
  },
  "required": [
    "alertChannelIds",
    "customPayloadFields",
    "description",
    "name",
    "rule",
    "severity",
    "sloIds",
    "timeThreshold"
  ],
  "$defs": {
    "AlertingTimeWindow": {
      "type": "object",
      "properties": {
        "duration": {
          "type": "integer",
          "format": "int32"
        },
        "durationType": {
          "type": "string",
          "enum": [
            "millisecond",
            "second",
            "minute",
            "hour",
            "day",
            "week",
            "month"
          ]
        },
        "durationUnit": {
          "type": "string",
          "enum": [
            "millisecond",
            "second",
            "minute",
            "hour",
            "day",
            "week",
            "month"
          ],
          "writeOnly": true
        }
      },
      "required": [
        "duration",
        "durationType"
      ]
    },
    "CustomPayloadField": {
      "type": "object",
      "description": "Custom payload fields to send additional information in the alert notifications. Can be left empty.",
      "properties": {
        "key": {
          "type": "string",
          "description": "A user-specified unique identifier or name for a custom payload entry."
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "key",
        "type"
      ]
    },
    "ServiceLevelsAlertRule": {
      "type": "object",
      "description": "This is the service levels alert type. It could be error budget alert or service levels object alert.",
      "properties": {
        "alertType": {
          "type": "string"
        }
      },
      "required": [
        "alertType"
      ]
    },
    "ServiceLevelsBurnRateConfig": {
      "type": "object",
      "description": "This is the burn rate alert configuration which defines alerting windows and corresponding thresholds. This configuration must to specified for BURN_RATE_V2 Alerts.",
      "properties": {
        "alertWindowType": {
          "type": "string",
          "description": "Specifies the Burn Rate Alerting Window type: SINGLE for single window/threshold alerts, or LONG and SHORT for multi-window/threshold alerts.",
          "enum": [
            "SINGLE",
            "LONG",
            "SHORT"
          ]
        },
        "duration": {
          "type": "integer",
          "format": "int32",
          "description": "Duration of the Burn Rate Alerting Window."
        },
        "durationUnitType": {
          "type": "string",
          "description": "Duration Unit Type of the Burn Rate Alerting Window.",
          "enum": [
            "millisecond",
            "second",
            "minute",
            "hour",
            "day",
            "week",
            "month"
          ]
        },
        "threshold": {
          "$ref": "#/$defs/ServiceLevelsStaticThresholdConfig"
        }
      },
      "required": [
        "duration",
        "durationUnitType",
        "threshold"
      ]
    },
    "ServiceLevelsBurnRateTimeWindows": {
      "type": "object",
      "deprecated": true,
      "description": "This is the short and long time window setting for the burn rate alerts.",
      "properties": {
        "longTimeWindow": {
          "$ref": "#/$defs/AlertingTimeWindow"
        },
        "shortTimeWindow": {
          "$ref": "#/$defs/AlertingTimeWindow"
        }
      }
    },
    "ServiceLevelsStaticThresholdConfig": {
      "type": "object",
      "description": "This threshold defines a static value to be evaluated with a specific operator for burn rate v2 alerts.",
      "properties": {
        "lastUpdated": {
          "type": "integer",
          "format": "int64",
          "minimum": 0
        },
        "operator": {
          "type": "string",
          "enum": [
            ">",
            ">=",
            "<",
            "<="
          ]
        },
        "value": {
          "type": "number",
          "format": "double",
          "minimum": 0
        }
      },
      "required": [
        "operator"
      ]
    },
    "ServiceLevelsTimeThreshold": {
      "type": "object",
      "description": "This is the warm-up and cool-down setting to emit or stop alert event after threshold reached.",
      "properties": {
        "expiry": {
          "type": "integer",
          "format": "int64",
          "description": "This is the cooldown period when the active alert misses threshold and stop emitting notification."
        },
        "timeWindow": {
          "type": "integer",
          "format": "int64",
          "description": "This is the grace period when the threshold is reached and the alert becomes active to emit notification."
        }
      },
      "required": [
        "expiry",
        "timeWindow"
      ]
    },
    "StaticThreshold": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/Threshold"
        },
        {
          "type": "object",
          "properties": {
            "lastUpdated": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            },
            "value": {
              "type": "number",
              "format": "double",
              "minimum": 0
            }
          }
        }
      ],
      "description": "This threshold defines a static value to be evaluated with a specific operator.",
      "required": [
        "operator"
      ]
    },
    "Threshold": {
      "type": "object",
      "deprecated": true,
      "description": "Indicates the type of threshold this alert rule is evaluated on.",
      "properties": {
        "operator": {
          "type": "string",
          "enum": [
            ">",
            ">=",
            "<",
            "<="
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "operator",
        "type"
      ]
    }
  }
}