> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xenovia.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update alert rule

> **Auth:** signed-in organization admin only. Organization API keys are rejected with `403`.

Filters are immutable after creation.



## OpenAPI

````yaml https://cp.xenovia.io/openapi.json patch /api/v1/alert-rules/{rule_id}
openapi: 3.1.0
info:
  title: Xenovia Control Plane API
  version: 1.0.0
  description: >-
    Management API for proxies, providers, policies, telemetry, alerts and
    organization settings.
servers:
  - url: https://cp.xenovia.io
    description: Production
security:
  - BearerAuth: []
paths:
  /api/v1/alert-rules/{rule_id}:
    patch:
      tags:
        - alerts
      summary: Update alert rule
      description: >-
        **Auth:** signed-in organization admin only. Organization API keys are
        rejected with `403`.


        Filters are immutable after creation.
      operationId: update_alert_rule_route_api_v1_alert_rules__rule_id__patch
      parameters:
        - name: rule_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Rule Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlertRuleUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertRuleRead'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AlertRuleUpdate:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: Name
        trigger_type:
          anyOf:
            - type: string
              enum:
                - policy_block
                - policy_redact
                - policy_escalate
                - guardrail_escalate
                - guardrail_block
                - high_latency
                - high_intent_score
                - run_error
                - turn_blocked
                - turn_escalated
                - turn_error
            - type: 'null'
          title: Trigger Type
        threshold:
          anyOf:
            - type: number
            - type: 'null'
          title: Threshold
        severity:
          anyOf:
            - type: string
              enum:
                - info
                - warning
                - critical
            - type: 'null'
          title: Severity
        cooldown_seconds:
          anyOf:
            - type: integer
              maximum: 86400
              minimum: 60
            - type: 'null'
          title: Cooldown Seconds
        operator:
          anyOf:
            - type: string
              enum:
                - gt
                - gte
                - lt
                - lte
            - type: 'null'
          title: Operator
        window_seconds:
          anyOf:
            - type: integer
              enum:
                - 300
                - 900
                - 3600
                - 86400
            - type: 'null'
          title: Window Seconds
        aggregation:
          anyOf:
            - type: string
            - type: 'null'
          title: Aggregation
        min_samples:
          anyOf:
            - type: integer
              maximum: 100000
              minimum: 0
            - type: 'null'
          title: Min Samples
        channels:
          anyOf:
            - items:
                type: string
                enum:
                  - in_app
                  - email
                  - slack
              type: array
            - type: 'null'
          title: Channels
        proxy_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Proxy Id
        enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Enabled
      type: object
      title: AlertRuleUpdate
    AlertRuleRead:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        org_id:
          type: string
          format: uuid
          title: Org Id
        proxy_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Proxy Id
        name:
          type: string
          title: Name
        kind:
          type: string
          title: Kind
        trigger_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Trigger Type
        threshold:
          anyOf:
            - type: number
            - type: 'null'
          title: Threshold
        severity:
          type: string
          title: Severity
        cooldown_seconds:
          type: integer
          title: Cooldown Seconds
        metric:
          anyOf:
            - type: string
            - type: 'null'
          title: Metric
        aggregation:
          anyOf:
            - type: string
            - type: 'null'
          title: Aggregation
        operator:
          anyOf:
            - type: string
            - type: 'null'
          title: Operator
        window_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Window Seconds
        group_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Group By
        min_samples:
          type: integer
          title: Min Samples
        filters:
          additionalProperties:
            type: string
          type: object
          title: Filters
        channels:
          items:
            type: string
          type: array
          title: Channels
        enabled:
          type: boolean
          title: Enabled
        created_by:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Created By
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
      type: object
      required:
        - id
        - org_id
        - proxy_id
        - name
        - kind
        - trigger_type
        - threshold
        - severity
        - cooldown_seconds
        - metric
        - aggregation
        - operator
        - window_seconds
        - group_by
        - min_samples
        - filters
        - channels
        - enabled
        - created_by
        - created_at
        - updated_at
      title: AlertRuleRead
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token: an organization API key (`ak_…`) created under Settings →
        API Keys, or a dashboard user session token. Proxy keys (`xe_…`) are not
        accepted here. Endpoints marked as user-only in their description reject
        organization keys with `403`.

````