{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/thousandeyes/json-schema/thousandeyes-alerts-api-rule-detail-update-schema.json",
  "title": "Alerts_API_RuleDetailUpdate",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/thousandeyes-alert-rules-api-openapi.yml#/components/schemas/Alerts_API_RuleDetailUpdate",
  "allOf": [
    {
      "$ref": "#/$defs/Alerts_API_BaseRule"
    },
    {
      "type": "object",
      "properties": {
        "notifications": {
          "$ref": "#/$defs/Alerts_API_AlertNotification"
        },
        "testIds": {
          "$ref": "#/$defs/Alerts_API_RuleTestIds"
        }
      }
    }
  ],
  "$defs": {
    "Alerts_API_AlertDirection": {
      "type": "string",
      "enum": [
        "to-target",
        "from-target",
        "bidirectional"
      ],
      "description": "Direction for applicable alert types (eg. path trace, End-to-End (Agent) etc.)"
    },
    "Alerts_API_AlertGroupType": {
      "type": "string",
      "description": "Category of alert type based on the application or network layer and source of the test.",
      "enum": [
        "bgp",
        "browser-session",
        "cloud-enterprise",
        "endpoint"
      ]
    },
    "Alerts_API_AlertNotification": {
      "type": "object",
      "description": "Alert notification object. See Alert notification integrations.",
      "properties": {
        "email": {
          "$ref": "#/$defs/Alerts_API_NotificationEmail"
        },
        "thirdParty": {
          "type": "array",
          "description": "Third party notifications.",
          "items": {
            "$ref": "#/$defs/Alerts_API_NotificationThirdParty"
          }
        },
        "webhook": {
          "type": "array",
          "description": "Webhook notifications.",
          "items": {
            "$ref": "#/$defs/Alerts_API_NotificationWebhook"
          }
        },
        "customWebhook": {
          "type": "array",
          "description": "Custom webhook notifications.",
          "items": {
            "$ref": "#/$defs/Alerts_API_NotificationCustomWebhook"
          }
        }
      }
    },
    "Alerts_API_AlertRoundsViolationMode": {
      "type": "string",
      "description": "`exact` requires the same agents to meet the threshold in consecutive rounds. `auto` is only enabled for CEA and Endpoint Scheduled test rules. The default is `any`.",
      "enum": [
        "exact",
        "any",
        "auto"
      ],
      "readOnly": true
    },
    "Alerts_API_AlertType": {
      "type": "string",
      "description": "Type of alert being triggered. In multi-layered tests, this value represents the layer the alert relates to. See [Alert Details](https://developer.cisco.com/docs/thousandeyes/retrieve-alert-details/) documentation for a list of possible values",
      "enum": [
        "page-load",
        "http-server",
        "end-to-end-server",
        "end-to-end-agent",
        "voice",
        "dns-server",
        "dns-trace",
        "dnssec",
        "bgp",
        "path-trace",
        "ftp",
        "sip-server",
        "transactions",
        "web-transactions",
        "agent",
        "network-outage",
        "application-outage",
        "device-device",
        "device-interface",
        "endpoint-network-server",
        "endpoint-http-server",
        "endpoint-path-trace",
        "endpoint-browser-sessions-agent",
        "endpoint-browser-sessions-application",
        "api",
        "web-transaction",
        "unknown"
      ]
    },
    "Alerts_API_BaseRule": {
      "type": "object",
      "required": [
        "ruleName",
        "expression",
        "alertType",
        "roundsViolatingOutOf"
      ],
      "properties": {
        "ruleId": {
          "$ref": "#/$defs/Alerts_API_RuleId"
        },
        "ruleName": {
          "type": "string",
          "description": "Name of the alert rule."
        },
        "expression": {
          "type": "string",
          "description": "The expression of the alert rule."
        },
        "description": {
          "type": "string",
          "description": "A description of the alert rule."
        },
        "direction": {
          "$ref": "#/$defs/Alerts_API_AlertDirection"
        },
        "notifyOnClear": {
          "type": "boolean",
          "description": "Send notification when alert clears."
        },
        "isDefault": {
          "type": "boolean",
          "description": "If set to `true`, this alert rule becomes the default for its test type and is automatically applied to newly created tests with relevant metrics. Only one default alert rule is allowed per test type."
        },
        "alertType": {
          "$ref": "#/$defs/Alerts_API_AlertType"
        },
        "alertGroupType": {
          "$ref": "#/$defs/Alerts_API_AlertGroupType"
        },
        "minimumSources": {
          "type": "integer",
          "description": "The minimum number of agents or monitors that must meet the specified criteria to trigger the alert."
        },
        "minimumSourcesPct": {
          "type": "integer",
          "description": "The minimum percentage of all assigned agents or monitors that must meet the specified criteria to trigger the alert."
        },
        "roundsViolatingMode": {
          "$ref": "#/$defs/Alerts_API_AlertRoundsViolationMode"
        },
        "roundsViolatingOutOf": {
          "type": "integer",
          "description": "Specifies the divisor (y value) in the “X of Y times” condition."
        },
        "roundsViolatingRequired": {
          "type": "integer",
          "description": "Specifies the numerator (x value) in the “X of Y times” condition."
        },
        "includeCoveredPrefixes": {
          "type": "boolean",
          "description": "Set true to include covered prefixes in the BGP alert rule. Only applicable to BGP alert rules."
        },
        "sensitivityLevel": {
          "$ref": "#/$defs/Alerts_API_SensitivityLevel"
        },
        "severity": {
          "$ref": "#/$defs/Alerts_API_Severity"
        },
        "endpointAgentIds": {
          "description": "An array of endpoint agent IDs associated with the rule (get `id` from `/endpoint/agents` API). This is applicable when `alertGroupType` is `browser-session`.",
          "type": "array",
          "items": {
            "description": "Unique ID of the agent.",
            "type": "string"
          }
        },
        "endpointLabelIds": {
          "description": "An array of label IDs used to assign specific Endpoint Agents to the test (get `id` from `/endpoint/labels`). This is applicable when `alertGroupType` is `browser-session`.",
          "type": "array",
          "items": {
            "description": "An Endpoint label ID.",
            "type": "string"
          }
        },
        "visitedSitesFilter": {
          "description": "A list of website domains visited during the session. This is applicable when `alertGroupType` is `browser-session`.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "Alerts_API_CustomWebhookIntegrationType": {
      "type": "string",
      "description": "Integration type.",
      "enum": [
        "custom-webhook"
      ]
    },
    "Alerts_API_NotificationCustomWebhook": {
      "type": "object",
      "description": "Custom webhook notification.",
      "properties": {
        "integrationId": {
          "type": "string",
          "format": "uuid",
          "description": "Integration ID."
        },
        "integrationType": {
          "$ref": "#/$defs/Alerts_API_CustomWebhookIntegrationType"
        },
        "integrationName": {
          "type": "string",
          "description": "User-configured name of the integration."
        },
        "target": {
          "type": "string",
          "description": "Webhook target URL."
        }
      }
    },
    "Alerts_API_NotificationEmail": {
      "type": "object",
      "description": "Email notifications.",
      "properties": {
        "recipients": {
          "type": "array",
          "description": "An array containing the email addresses to receive notifications.",
          "items": {
            "type": "string"
          }
        },
        "message": {
          "type": "string",
          "description": "Custom text included in alert email notifications sent to recipients."
        }
      }
    },
    "Alerts_API_NotificationThirdParty": {
      "type": "object",
      "description": "Webhook notification.",
      "properties": {
        "integrationId": {
          "type": "string",
          "description": "Integration ID."
        },
        "integrationType": {
          "$ref": "#/$defs/Alerts_API_ThirdPartyIntegrationType"
        }
      }
    },
    "Alerts_API_NotificationWebhook": {
      "type": "object",
      "description": "Webhook notification.",
      "properties": {
        "integrationId": {
          "type": "string",
          "description": "Integration ID."
        },
        "integrationType": {
          "$ref": "#/$defs/Alerts_API_WebhookIntegrationType"
        },
        "integrationName": {
          "description": "Name of the integration, configured by the user.",
          "type": "string"
        },
        "target": {
          "description": "Webhook target URL.",
          "type": "string"
        }
      }
    },
    "Alerts_API_RuleId": {
      "type": "string",
      "description": "Unique ID of the rule.",
      "readOnly": true
    },
    "Alerts_API_RuleTestIds": {
      "type": "array",
      "description": "Array of test IDs to link to alert rule (get `testId` from `/tests` endpoint).",
      "items": {
        "type": "string"
      }
    },
    "Alerts_API_SensitivityLevel": {
      "type": "string",
      "description": "Used when `roundsViolatingMode` is set to `auto`. The default is `medium`. Higher sensitivity increases the likelihood of triggering alerts.",
      "enum": [
        "high",
        "medium",
        "low"
      ],
      "readOnly": true
    },
    "Alerts_API_Severity": {
      "type": "string",
      "description": "The severity of the alert.",
      "enum": [
        "info",
        "major",
        "minor",
        "critical",
        "unknown"
      ]
    },
    "Alerts_API_ThirdPartyIntegrationType": {
      "type": "string",
      "description": "Integration type.",
      "enum": [
        "pager-duty",
        "slack",
        "app-dynamics",
        "service-now"
      ]
    },
    "Alerts_API_WebhookIntegrationType": {
      "type": "string",
      "description": "Integration type.",
      "enum": [
        "webhook"
      ]
    }
  }
}