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

# 更新跟进事项

> 部分更新跟进事项的标题、描述、状态或优先级。

## 限制说明

| 项目   | 说明                             |
| ---- | ------------------------------ |
| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |
| 权限要求 | **故障管理**（`on-call`）            |

## 使用说明

* 需要 On-call Pro 许可。
* 部分更新：未提供的字段保持不变；显式传 `null` 则清空该字段。
* 乐观锁 —— `version` 必须与事项当前版本一致；不一致返回冲突错误。
* 负责人、`item_type` 以及故障/复盘锚点不能在此修改 —— 请使用专用接口。
* 已审计 —— 变更会记录到审计日志。


## OpenAPI

````yaml /api-reference/on-call.openapi.zh.json post /incident/work-item/update
openapi: 3.1.0
info:
  title: Flashduty 开放 API
  description: >-
    Flashduty 事件管理平台的公开 HTTP API —— 覆盖故障、通知模板、协作空间、值班排班、监控、RUM、以及平台管理。每次调用都需在
    query 中携带 `app_key`，该 key 在 Flashduty 控制台 账户 → APP Key 中签发。所有响应使用统一结构：成功时为
    `{ request_id, data }`，失败时为 `{ request_id, error }`。
  version: 1.0.0
servers:
  - url: https://api.flashcat.cloud
    description: Flashduty Open API
security:
  - AppKeyAuth: []
tags:
  - name: On-call/故障管理
    description: ''
  - name: On-call/协作空间
    description: ''
  - name: On-call/告警管理
    description: 查询、查看和处理告警，管理卡片视图与告警处理规则。
  - name: On-call/集成中心
    description: ''
  - name: On-call/IM 集成
    description: IM 集成相关查询，例如查看哪些集成开启了作战室。
  - name: On-call/值班排班
    description: ''
  - name: On-call/许可管理
    description: ''
  - name: On-call/日历管理
    description: ''
  - name: On-call/通知模板
    description: ''
  - name: On-call/标签增强
    description: 自定义字段、富化规则及数据映射（映射规则、映射数据、映射 API）管理。
  - name: On-call/分析看板
    description: ''
  - name: On-call/状态页
    description: ''
  - name: On-call/变更管理
    description: ''
paths:
  /incident/work-item/update:
    post:
      tags:
        - On-call/Incidents
      summary: 更新跟进事项
      description: 部分更新跟进事项的标题、描述、状态或优先级。
      operationId: incidentWorkItemUpdate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWorkItemRequest'
            example:
              work_item_id: wi_9fK2mNqRtVwXyZaBcDeFgH
              version: 1
              title: >-
                Roll back the v2.14 deployment on web-server-01 and
                web-server-02
              status: in_progress
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/WorkItemMutationResult'
              example:
                request_id: 01J8XQ3E5Z7JM2NTFQ5YJ8P9R4
                data:
                  item:
                    work_item_id: wi_68MHnkWBiyjrh6uhkxUyiZ
                    item_type: follow_up
                    incident_id: 6a5f1e28807515413b384bce
                    post_mortem_id: 51d65cd9525c369379ba471b5512df63
                    title: Follow-ups assigned to Bowen and Weili
                    status: done
                    source_kind: native
                    version: 2
                    assignee_ids:
                      - 3790925372131
                      - 4756301322131
                      - 5068740052131
                    created_by: 5329873302131
                    updated_by: 3790925372131
                    created_at_seconds: 1785495329
                    updated_at_seconds: 1785496384
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    UpdateWorkItemRequest:
      type: object
      description: 跟进事项的部分更新。未提供的字段保持不变；显式传 `null` 则清空该字段。
      required:
        - work_item_id
        - version
      properties:
        work_item_id:
          type: string
          maxLength: 128
          description: 跟进事项 ID（不透明字符串，最长 128 字符）。
        version:
          type: integer
          format: int64
          description: 事项当前版本号，用于乐观锁。必须与存储的版本一致。
        title:
          type:
            - string
            - 'null'
          description: 新标题（最长 512 字符）。
          maxLength: 512
        description:
          type:
            - string
            - 'null'
          description: 新描述（最长 65,535 字符）。
          maxLength: 65535
        status:
          type:
            - string
            - 'null'
          description: 新的客户端自定义状态（最长 64 字符）。
          maxLength: 64
        priority:
          type:
            - string
            - 'null'
          description: 新的客户端自定义优先级（最长 64 字符）。
          maxLength: 64
    SuccessEnvelope:
      type: object
      description: >-
        成功响应结构。2xx 响应中 `request_id` 标识本次调用（同时出现在 `Flashcat-Request-Id`
        响应头中），`data` 为接口业务 payload。失败响应使用不同结构，参见 `ErrorResponse`。
      properties:
        request_id:
          type: string
          description: 本次请求的唯一 ID，也会在 Flashcat-Request-Id 响应头中返回。反馈问题时请一并附上。
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        data:
          description: 每个接口自己的业务 payload，详见各接口的 200 响应 schema。
      required:
        - request_id
        - data
    WorkItemMutationResult:
      type: object
      description: 变更跟进事项的结果。
      properties:
        item:
          $ref: '#/components/schemas/WorkItemItem'
        added_assignee_ids:
          type: array
          items:
            type: integer
            format: int64
          description: 新添加（并已通知）的负责人成员 ID。
        removed_assignee_ids:
          type: array
          items:
            type: integer
            format: int64
          description: 被移除（不通知）的负责人成员 ID。
        idempotent_replay:
          type: boolean
          description: 为 true 表示本次调用以相同幂等键重放了之前的请求。
    WorkItemItem:
      type: object
      description: 结构化的故障跟进事项（行动项或复盘后续行动）及其负责人。
      required:
        - work_item_id
        - item_type
        - incident_id
        - title
        - status
        - source_kind
        - version
        - assignee_ids
        - created_by
        - updated_by
        - created_at_seconds
        - updated_at_seconds
      properties:
        work_item_id:
          type: string
          maxLength: 128
          description: 跟进事项 ID（不透明字符串，最长 128 字符）。
        item_type:
          type: string
          enum:
            - action
            - follow_up
          description: '`action` 表示锚定在活动故障上的行动项；`follow_up` 表示复盘后续行动。'
        incident_id:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: 事项锚定的故障 ID（MongoDB ObjectID）。
        post_mortem_id:
          type: string
          description: 故障复盘 ID（32 位十六进制字符串）。后续行动绑定复盘后返回。
        title:
          type: string
          maxLength: 512
          description: 事项标题（最长 512 字符）。
        description:
          type: string
          maxLength: 65535
          description: 可选的详细描述（最长 65,535 字符）。
        status:
          type: string
          maxLength: 64
          description: 客户端自定义状态（最长 64 字符），没有固定状态机。
        priority:
          type: string
          maxLength: 64
          description: 可选的客户端自定义优先级（最长 64 字符）。
        source_kind:
          type: string
          enum:
            - native
            - legacy_follow_up
          description: '`native` 表示通过本 API 创建的事项；`legacy_follow_up` 表示从旧版复盘后续行动迁移而来的事项。'
        legacy_source_id:
          type: string
          description: 该事项迁移自旧版后续行动的原始标识。仅当 `source_kind` 为 `legacy_follow_up` 时返回。
        version:
          type: integer
          format: int64
          description: 乐观锁版本号，每次变更递增。
        assignee_ids:
          type: array
          items:
            type: integer
            format: int64
          description: 当前负责人的成员 ID 列表。不会为 null；空数组表示未指派。
        created_by:
          type: integer
          format: int64
          description: 创建者成员 ID。
        updated_by:
          type: integer
          format: int64
          description: 最后更新人成员 ID。
        converted_by:
          type: integer
          format: int64
          description: 将行动项转化为后续行动的操作人成员 ID。仅转化后返回。
        converted_at_seconds:
          type: integer
          format: int64
          description: 转化时间，Unix 秒级时间戳。仅转化后返回。
        created_at_seconds:
          type: integer
          format: int64
          description: 创建时间，Unix 秒级时间戳。
        updated_at_seconds:
          type: integer
          format: int64
          description: 最后更新时间，Unix 秒级时间戳。
    ErrorResponse:
      type: object
      description: 错误响应结构。`error` 必填，`data` 不存在。
      properties:
        request_id:
          type: string
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
          description: 本次请求的唯一追踪 ID（trace ID），反馈问题时请提供该值以便检索日志。
        error:
          $ref: '#/components/schemas/DutyError'
      required:
        - request_id
        - error
    DutyError:
      type: object
      description: 响应结构中的错误 payload，仅在非 2xx 响应时出现。
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: 用户可读的错误描述，语言会跟随调用方的 Accept-Language。可能包含字段名、ID 等请求上下文。
          example: The specified parameter template_id is not valid.
      required:
        - code
        - message
    ErrorCode:
      type: string
      description: >-
        Flashduty 错误码枚举。每个失败响应的 `error.code` 都是下列稳定值之一，HTTP 状态码仅作参考。


        | 错误码 | HTTP | 含义 |

        |---|---|---|

        | `OK` | 200 | 保留值，正常错误响应不会返回。 |

        | `InvalidParameter` | 400 | 必填参数缺失或未通过校验。 |

        | `BadRequest` | 400 | 通用的 400 错误，通常是请求本身不合法。 |

        | `InvalidContentType` | 400 | 请求头 `Content-Type` 不是 `application/json`。
        |

        | `ResourceNotFound` | 400 | 目标资源不存在。注意 HTTP 状态码是 400 而非 404（历史设计）。 |

        | `NoLicense` | 400 | 功能需要有效授权，但未找到可用的 license。 |

        | `ReferenceExist` | 400 | 该资源仍被其他实体引用，无法删除。 |

        | `Unauthorized` | 401 | `app_key` 缺失、无效或已过期。 |

        | `BalanceNotEnough` | 402 | 账户余额不足，无法执行需要计费的操作。 |

        | `AccessDenied` | 403 | 身份认证通过，但 RBAC 权限不足以执行该操作。 |

        | `RouteNotFound` | 404 | 请求的 URL 路径不是已知路由。 |

        | `MethodNotAllowed` | 405 | 当前路径不接受所使用的 HTTP 方法。 |

        | `UndonedOrderExist` | 409 | 账户存在未完成的订单，请稍后重试。 |

        | `RequestLocked` | 423 | 因连续失败被临时锁定。 |

        | `EntityTooLarge` | 413 | 请求体超过允许的最大长度。 |

        | `RequestTooFrequently` | 429 | 命中限流（全局、账户级或集成级）。 |

        | `RequestVerifyRequired` | 428 | 操作需要二次验证码，但未提供。 |

        | `DangerousOperation` | 428 | 危险操作，需要进行 MFA 验证。 |

        | `InternalError` | 500 | 服务端未预期错误。反馈问题请附上 `request_id`。 |

        | `ServiceUnavailable` | 503 | 后端依赖不可用，请稍后重试。 |
      enum:
        - OK
        - InvalidParameter
        - BadRequest
        - InvalidContentType
        - ResourceNotFound
        - NoLicense
        - ReferenceExist
        - Unauthorized
        - BalanceNotEnough
        - AccessDenied
        - RouteNotFound
        - MethodNotAllowed
        - UndonedOrderExist
        - RequestLocked
        - EntityTooLarge
        - RequestTooFrequently
        - RequestVerifyRequired
        - DangerousOperation
        - InternalError
        - ServiceUnavailable
      x-enumDescriptions:
        OK: 保留值，正常错误响应不会返回。
        InvalidParameter: 必填参数缺失或未通过校验。
        BadRequest: 通用的 400 错误，通常是请求本身不合法。
        InvalidContentType: 请求头 `Content-Type` 不是 `application/json`。
        ResourceNotFound: 目标资源不存在。注意 HTTP 状态码是 400 而非 404（历史设计）。
        NoLicense: 功能需要有效授权，但未找到可用的 license。
        ReferenceExist: 该资源仍被其他实体引用，无法删除。
        Unauthorized: '`app_key` 缺失、无效或已过期。'
        BalanceNotEnough: 账户余额不足，无法执行需要计费的操作。
        AccessDenied: 身份认证通过，但 RBAC 权限不足以执行该操作。
        RouteNotFound: 请求的 URL 路径不是已知路由。
        MethodNotAllowed: 当前路径不接受所使用的 HTTP 方法。
        UndonedOrderExist: 账户存在未完成的订单，请稍后重试。
        RequestLocked: 因连续失败被临时锁定。
        EntityTooLarge: 请求体超过允许的最大长度。
        RequestTooFrequently: 命中限流（全局、账户级或集成级）。
        RequestVerifyRequired: 操作需要二次验证码，但未提供。
        DangerousOperation: 危险操作，需要进行 MFA 验证。
        InternalError: 服务端未预期错误。反馈问题请附上 `request_id`。
        ServiceUnavailable: 后端依赖不可用，请稍后重试。
      example: InvalidParameter
  responses:
    BadRequest:
      description: 请求非法 — 通常是参数缺失或格式不正确。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingParameter:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InvalidParameter
                  message: The specified parameter is not valid.
    Unauthorized:
      description: app_key 缺失或无效。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingAppKey:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: Unauthorized
                  message: You are unauthorized.
    TooManyRequests:
      description: 命中限流。可能是全局 API 限流、账户级限流或集成级限流。限流按账户聚合。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: RequestTooFrequently
                  message: Request too frequently.
    ServerError:
      description: 服务端未预期错误。反馈问题时请携带 request_id。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InternalError
                  message: >-
                    We encountered an internal error, and it has been reported.
                    Please try again later.
  securitySchemes:
    AppKeyAuth:
      type: apiKey
      in: query
      name: app_key
      description: >-
        在 Flashduty 控制台 账户 → APP Key 中签发的 app_key。调用任何公开 API
        时都必须携带。它等同于所属账户的身份凭证，请妥善保管。

````