> ## Documentation Index
> Fetch the complete documentation index at: https://test-8ad8522e-feat-ai-sre.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 列出自动化运行历史

> 列出调用者可管理规则的运行历史。

## 限制说明

| 项目   | 说明                             |
| ---- | ------------------------------ |
| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |
| 权限要求 | 有效 `app_key`；调用者必须可管理目标规则      |

## 使用说明

* 仅当调用者可管理规则时才可查看运行历史：个人规则仅限创建者；团队规则限账户管理员或规则所属团队成员。


## OpenAPI

````yaml /api-reference/safari.openapi.zh.json post /safari/automation/run/list
openapi: 3.1.0
info:
  title: Flashduty 开放 API
  description: >-
    Flashduty AI SRE 平台的公开 HTTP API —— 技能、MCP 服务器（连接器）、A2A 智能体与会话。所有接口均使用
    Flashduty 控制台签发的 `app_key` 查询参数进行认证。
  version: 1.0.0
servers:
  - url: https://api.flashcat.cloud
    description: Flashduty Open API
security:
  - AppKeyAuth: []
tags:
  - name: AI SRE/技能
    description: AI SRE 智能体技能管理。
  - name: AI SRE/MCP 服务器
    description: MCP（Model Context Protocol）服务器管理。
  - name: AI SRE/A2A 智能体
    description: A2A（智能体到智能体）远程智能体管理。
  - name: AI SRE/会话
    description: AI SRE 智能体会话历史 —— 查询、查看与导出会话记录。
  - name: AI SRE/自动化
  - name: AI SRE/知识
  - name: AI SRE/产物
    description: AI SRE 产物库 —— 发布、浏览并公开分享智能体生成的文件。
paths:
  /safari/automation/run/list:
    post:
      tags:
        - AI SRE/自动化
      summary: 列出自动化运行历史
      description: 列出调用者可管理规则的运行历史。
      operationId: automation-run-read-list
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutomationRunListRequest'
            example:
              rule_id: arule_7NnLzY2Qp8xS4kUaV3mR6b
              limit: 20
              trigger_kind: schedule
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/AutomationRunListResponse'
              example:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                data:
                  total: 1
                  runs:
                    - run_id: trun_5oDvqiG64uur6sBNsTc4u
                      session_id: sess_f8oDvqiG64uur6sBNsTc4u
                      session_name: Weekly on-call review
                      kind: automation_rule
                      account_id: 10023
                      rule_id: arule_7NnLzY2Qp8xS4kUaV3mR6b
                      trigger_kind: schedule
                      occurrence_key: atrig_6aKp3wT9mQ2xVc8bR1nY7z:1780630800000
                      status: succeeded
                      attempts: 1
                      started_at: 1780630800000
                      completed_at: 1780630923456
                      duration_ms: 123456
                      error_code: ''
                      error_message: ''
                      stats_json: {}
                      result_json:
                        session_id: sess_f8oDvqiG64uur6sBNsTc4u
                      created_at: 1780630800000
                      updated_at: 1780630923456
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - AppKeyAuth: []
components:
  schemas:
    AutomationRunListRequest:
      type: object
      properties:
        rule_id:
          type: string
          description: 目标规则 ID，取自 `POST /safari/automation/rule/list` 返回的列表。
        p:
          type: integer
          default: 1
          description: 页码，从 1 开始。
        limit:
          type: integer
          default: 20
          description: 每页数量。
        status:
          type: string
          enum:
            - queued
            - running
            - retrying
            - succeeded
            - partial
            - failed
            - skipped
            - abandoned
            - blocked
          description: >-
            运行状态过滤：`queued` 排队中、`running` 运行中、`retrying` 重试中、`succeeded`
            成功、`partial` 部分成功、`failed` 失败、`skipped` 已跳过（如规则或触发器失效）、`abandoned`
            已放弃（超过时效未完成被系统终结）、`blocked` 已阻塞（终态：有产出但某个连接器正等待人工完成授权）；省略则不过滤。
        trigger_kind:
          type: string
          enum:
            - schedule
            - debug
            - manual
            - http_post
            - oncall_incident
          description: >-
            触发来源过滤：`schedule` 定时调度、`debug` 调试运行、`manual` 手动触发、`http_post` HTTP
            POST 触发、`oncall_incident` On-call 故障触发；省略则不过滤。
        started_after_ms:
          type: integer
          format: int64
          description: 开始时间下界，Unix 毫秒。早于 180 天运行记录保留下限的值会被截断到下限（省略时默认即为该下限）。
          minimum: 0
        started_before_ms:
          type: integer
          format: int64
          description: 开始时间上界，Unix 毫秒。必须不早于生效后的 `started_after_ms`；早于保留下限时返回空结果。
          minimum: 0
      required:
        - rule_id
    ResponseEnvelope:
      type: object
      description: >-
        Standard response envelope used by every Flashduty public API. On
        success `data` contains the endpoint-specific payload and `error` is
        absent. On failure `error` is present and `data` is absent. `request_id`
        is always present and is also mirrored in the `Flashcat-Request-Id`
        response header.
      properties:
        request_id:
          type: string
          description: 本次请求的唯一 ID，与 Flashcat-Request-Id 响应头一致。反馈问题时请携带该 ID。
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        error:
          $ref: '#/components/schemas/DutyError'
        data:
          description: 端点专属数据负载，具体结构见各操作 200 响应中的 schema。
      required:
        - request_id
    AutomationRunListResponse:
      type: object
      properties:
        total:
          type: integer
          format: int64
          description: 总数。
        runs:
          type: array
          items:
            $ref: '#/components/schemas/AutomationRunItem'
          description: 指定规则（`rule_id`）的运行记录数组，按请求中的状态/触发类型/时间范围过滤并分页。
      required:
        - total
        - runs
    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
    AutomationRunItem:
      type: object
      properties:
        run_id:
          type: string
          description: 运行 ID。
        session_id:
          type: string
          description: 本次运行创建的会话 ID，从 `result_json` 中提取；运行尚未启动会话时省略。
        session_name:
          type: string
          description: 运行会话的显示名称，批量查询填充；为空或查询失败时省略。
        kind:
          type: string
          description: 运行类型；按规则查询时恒为 `automation_rule`。
          enum:
            - automation_rule
        account_id:
          type: integer
          format: int64
          description: 账户 ID。
        rule_id:
          type: string
          description: 规则 ID。
        trigger_kind:
          type: string
          enum:
            - schedule
            - debug
            - manual
            - http_post
            - oncall_incident
          description: |-
            触发来源。可选值：
            | 值 | 含义 |
            | --- | --- |
            | `schedule` | 定时触发器按调度计划触发 |
            | `debug` | 调试运行（保留值；当前版本的规则运行不产生该来源） |
            | `manual` | 用户手动触发一次运行 |
            | `http_post` | 通过规则的 HTTP POST webhook 触发 |
            | `oncall_incident` | 由值班故障（on-call incident）事件触发 |
        occurrence_key:
          type: string
          description: 幂等键。
        status:
          type: string
          enum:
            - queued
            - running
            - retrying
            - succeeded
            - partial
            - failed
            - skipped
            - abandoned
            - blocked
          description: |-
            运行状态。可选值（前三个为进行中，其余为终态）：
            | 值 | 含义 |
            | --- | --- |
            | `queued` | 已入队，等待工作器执行 |
            | `running` | 正在执行 |
            | `retrying` | 本次尝试失败，已安排重试 |
            | `succeeded` | 成功完成 |
            | `partial` | 部分成功（当前仅记忆整理类运行会产生；规则运行不会落到该状态） |
            | `failed` | 失败终态，不再重试 |
            | `skipped` | 未执行（如超过宽限期、触发器或规则失效），以运行记录形式留存原因 |
            | `abandoned` | 进行中超过陈旧阈值被后台清扫判为未完成（如工作器异常退出） |
            | `blocked` | 终态：有实际产出，但因连接器等待人工完成授权而结束（区别于 `failed`） |
        attempts:
          type: integer
          description: 尝试次数。
        started_at:
          type: integer
          format: int64
          description: 开始时间，Unix 毫秒。
        completed_at:
          type: integer
          format: int64
          description: 完成时间，Unix 毫秒。0 表示尚未完成。
        duration_ms:
          type: integer
          format: int64
          description: 运行耗时，毫秒。
        error_code:
          type: string
          description: 错误码；运行未失败时为空字符串。
        error_message:
          type: string
          description: 错误信息；运行未失败时为空字符串。
        stats_json:
          type:
            - object
            - 'null'
          additionalProperties: true
          description: 运行统计原始 JSON；为空时为 null。
        result_json:
          type:
            - object
            - 'null'
          additionalProperties: true
          description: 运行结果原始 JSON（运行启动后携带 `session_id`）；为空时为 null。
        created_at:
          type: integer
          format: int64
          description: 创建时间，Unix 毫秒。
        updated_at:
          type: integer
          format: int64
          description: 更新时间，Unix 毫秒。
      required:
        - run_id
        - kind
        - account_id
        - rule_id
        - trigger_kind
        - occurrence_key
        - status
        - attempts
        - started_at
        - completed_at
        - duration_ms
        - created_at
        - updated_at
        - error_code
        - error_message
        - stats_json
        - result_json
    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
    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: Invalid request — usually a missing or malformed parameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingParameter:
              summary: Missing required parameter
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InvalidParameter
                  message: The specified parameter skill_id is not valid.
    Unauthorized:
      description: Missing or invalid app_key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingAppKey:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: Unauthorized
                  message: You are unauthorized.
    Forbidden:
      description: The app_key is valid but lacks permission for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            accessDenied:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: AccessDenied
                  message: Access Denied.
    TooManyRequests:
      description: Rate limit hit. Either the global API limit or a per-account limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: RequestTooFrequently
                  message: Request too frequently.
    ServerError:
      description: Unexpected server-side error. Include the request_id when reporting.
      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: >-
        App key issued from the Flashduty console. Required on every public API
        call. Keep it secret — it grants the same access as the owning account.

````