> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 更新告警

> 更新现有告警



## OpenAPI

````yaml /zh/_specs/hyperdx-openapi.json put /api/v2/alerts/{id}
openapi: 3.0.0
info:
  description: 用于管理 HyperDX 告警和仪表盘的 API
  title: HyperDX External API
  version: 2.0.0
servers:
  - description: 生产环境 API 服务器
    url: https://api.hyperdx.io
  - description: 当前服务器
    url: /
security:
  - BearerAuth: []
tags:
  - description: 用于管理仪表盘及其可视化内容的端点
    name: Dashboards
  - description: 用于管理监控告警的端点
    name: Alerts
paths:
  /api/v2/alerts/{id}:
    put:
      tags:
        - Alerts
      summary: 更新告警
      description: 更新现有告警
      operationId: updateAlert
      parameters:
        - description: 告警 ID
          example: 65f5e4a3b9e77c001a123456
          in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            examples:
              updateAlert:
                summary: 更新告警属性
                value:
                  channel:
                    type: webhook
                    webhookId: 65f5e4a3b9e77c001a789012
                  dashboardId: 65f5e4a3b9e77c001a567890
                  interval: 1h
                  message: Updated threshold and interval
                  name: Updated Alert Name
                  source: tile
                  threshold: 500
                  thresholdType: above
                  tileId: 65f5e4a3b9e77c001a901234
            schema:
              $ref: '#/components/schemas/UpdateAlertRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertResponse'
          description: 已成功更新告警
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: 未授权
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: 未找到告警
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: 服务器错误或验证失败
components:
  schemas:
    UpdateAlertRequest:
      properties:
        channel:
          properties:
            type:
              example: webhook
              type: string
            webhookId:
              example: 65f5e4a3b9e77c001a789012
              type: string
          type: object
        dashboardId:
          example: 65f5e4a3b9e77c001a567890
          type: string
        interval:
          example: 1h
          type: string
        message:
          example: Updated message
          type: string
        name:
          example: Updated Alert Name
          type: string
        source:
          enum:
            - tile
            - search
          example: tile
          type: string
        threshold:
          example: 500
          type: number
        thresholdType:
          enum:
            - above
            - below
          example: above
          type: string
        tileId:
          example: 65f5e4a3b9e77c001a901234
          type: string
      type: object
    AlertResponse:
      properties:
        data:
          $ref: '#/components/schemas/Alert'
      type: object
    Error:
      properties:
        message:
          type: string
      type: object
    Alert:
      properties:
        channel:
          properties:
            type:
              example: webhook
              type: string
            webhookId:
              example: 65f5e4a3b9e77c001a789012
              type: string
          type: object
        createdAt:
          example: '2023-01-01T00:00:00.000Z'
          format: date-time
          type: string
        dashboard:
          example: 65f5e4a3b9e77c001a567890
          type: string
        groupBy:
          nullable: true
          type: string
        id:
          example: 65f5e4a3b9e77c001a123456
          type: string
        interval:
          example: 15m
          type: string
        message:
          example: Error rate exceeds threshold
          type: string
        name:
          example: High Error Rate
          type: string
        savedSearch:
          nullable: true
          type: string
        silenced:
          nullable: true
          type: boolean
        source:
          enum:
            - tile
            - search
          example: tile
          type: string
        state:
          example: inactive
          type: string
        team:
          example: 65f5e4a3b9e77c001a345678
          type: string
        threshold:
          example: 100
          type: number
        thresholdType:
          enum:
            - above
            - below
          example: above
          type: string
        tileId:
          example: 65f5e4a3b9e77c001a901234
          type: string
        updatedAt:
          example: '2023-01-01T00:00:00.000Z'
          format: date-time
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: API Key
      scheme: bearer
      type: http

````