{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/harness/main/json-schema/harness-alert-search-request-schema.json",
  "title": "AlertSearchRequest",
  "description": "Request payload for searching and filtering alerts with pagination support",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/harness-autostopping-alerts-api-openapi.yml#/components/schemas/AlertSearchRequest",
  "type": "object",
  "properties": {
    "page": {
      "type": "integer",
      "description": "Page number for pagination (1-indexed)",
      "default": 1
    },
    "limit": {
      "type": "integer",
      "description": "Number of records per page",
      "default": 10
    },
    "sort": {
      "type": "object",
      "description": "Sorting options for the results",
      "properties": {
        "field": {
          "type": "string",
          "description": "Field to sort by",
          "enum": [
            "updated_at",
            "created_at"
          ]
        },
        "type": {
          "type": "string",
          "description": "Sort direction",
          "enum": [
            "ASC",
            "DESC"
          ]
        }
      }
    },
    "filters": {
      "type": "array",
      "description": "Advanced filters for querying alerts",
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "description": "Field name to filter on"
          },
          "fields": {
            "type": "array",
            "description": "Multiple fields to filter with OR clause (higher priority than single field)",
            "items": {
              "type": "string"
            }
          },
          "operator": {
            "type": "string",
            "description": "Filter operator",
            "enum": [
              "equals",
              "not_equals"
            ]
          },
          "values": {
            "type": "array",
            "description": "Values to filter by",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "entity_type": {
      "type": "string",
      "description": "Filter by entity type",
      "enum": [
        "autostopping_rule"
      ]
    },
    "entity_id": {
      "type": "array",
      "description": "Filter by specific entity IDs (AutoStopping rule IDs)",
      "items": {
        "type": "string"
      }
    },
    "enabled": {
      "type": "boolean",
      "description": "Filter by enabled status"
    },
    "events": {
      "type": "array",
      "description": "Filter by event types",
      "items": {
        "type": "string",
        "enum": [
          "autostopping_warmup_failed",
          "autostopping_cooldown_failed",
          "autostopping_rule_created",
          "autostopping_rule_updated",
          "autostopping_rule_deleted"
        ]
      }
    },
    "query": {
      "type": "string",
      "description": "Search query to filter alerts by name (case-insensitive partial match)"
    }
  }
}