> ## 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.

# 查询仓库触发器可选项

> 查询 GitHub、GitLab 或 Gitee 仓库触发器可用的事件、动作与可过滤字段。

## 限制说明

| 项目 | 说明 |
| - | - |
| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |
| 权限要求 | **Automation 查看**（`ai-sre`） |

## 使用说明

* 该响应对同一部署是静态的：平台目录来自触发器 schema 版本，与账号现有的连接无关。
* 用它构造触发器表单：先选 `provider`，再选 `event`，然后订阅 `actions`，并用每个字段列出的操作符在 `fields` 上过滤。


## OpenAPI

````yaml /api-reference/safari.openapi.zh.json post /safari/automation/scm/options
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 产物库 —— 发布、浏览并公开分享智能体生成的文件。
  - name: AI SRE/自托管 Runner
    description: 自托管 Runner（BYOC）管理。
paths:
  /safari/automation/scm/options:
    post:
      tags:
        - AI SRE/自动化
      summary: 查询仓库触发器可选项
      description: 查询 GitHub、GitLab 或 Gitee 仓库触发器可用的事件、动作与可过滤字段。
      operationId: automation-scm-read-options
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SCMEmptyRequest'
            example: {}
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/SCMOptions'
              example:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                data:
                  schema_version: 1
                  max_filters_per_event: 10
                  max_filter_value_bytes: 256
                  max_filter_values: 20
                  providers:
                    - provider: github
                      events:
                        - event: pull_request
                          actions:
                            - open
                            - close
                            - merge
                          fields:
                            - field: author
                              value_type: text
                              operators:
                                - eq
                                - contains
                                - regex
                            - field: labels
                              value_type: labels
                              operators:
                                - contains
                                - in
                                - not_in
                                - regex
                            - field: draft
                              value_type: bool
                              operators:
                                - eq
                      default_event: pull_request
                      default_actions:
                        pull_request:
                          - open
        '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:
    SCMEmptyRequest:
      type: object
      description: 该接口没有参数，传一个空的 JSON 对象即可。
      properties: {}
    ResponseEnvelope:
      type: object
      description: >-
        所有 Flashduty 公开 API 共用的标准响应结构。成功时 `data` 为接口专属载荷且不含 `error`；失败时 `error`
        存在而 `data` 缺失。`request_id` 始终存在，并会同步写入 `Flashcat-Request-Id` 响应头。
      properties:
        request_id:
          type: string
          description: 本次请求的唯一 ID，与 Flashcat-Request-Id 响应头一致。反馈问题时请携带该 ID。
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        error:
          $ref: '#/components/schemas/DutyError'
        data:
          description: 接口返回的数据，格式见各接口的 200 响应。没有返回数据的接口会返回 `{}` 或完全不带 `data`。
      required:
        - request_id
    SCMOptions:
      type: object
      description: 仓库触发器配置的静态说明：schema 版本、各项限制，以及各平台可用的事件、动作与可过滤字段。
      required:
        - schema_version
        - max_filters_per_event
        - max_filter_value_bytes
        - max_filter_values
        - providers
      properties:
        schema_version:
          type: integer
          description: 本次响应描述的触发器配置 schema 版本；保存了旧版本配置的触发器在读取时会被迁移。
        max_filters_per_event:
          type: integer
          description: 触发器配置中单个事件可携带的过滤器数量上限。
        max_filter_value_bytes:
          type: integer
          description: 单个过滤器取值的最大字节数。
        max_filter_values:
          type: integer
          description: 列表型过滤器（`in`、`not_in`）可携带的取值个数上限。
        providers:
          type: array
          items:
            $ref: '#/components/schemas/SCMProviderOption'
          description: 按平台给出的仓库触发器可用事件、动作与可过滤字段说明。
    DutyError:
      type: object
      description: 响应结构中的错误 payload，仅在非 2xx 响应时出现。
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: >-
            按响应语言（query 参数 `locale` / `lang` 或请求头
            `Accept-Language`）返回的错误描述，可能包含出错的字段名，请不要解析它。
          example: The specified parameter template_id is not valid.
      required:
        - code
        - message
    SCMProviderOption:
      type: object
      description: 某一个仓库平台的可选项。
      required:
        - provider
        - events
        - default_event
        - default_actions
      properties:
        provider:
          type: string
          enum:
            - github
            - gitlab
            - gitee
          description: 仓库平台：`github` 表示 GitHub，`gitlab` 表示 GitLab，`gitee` 表示 Gitee。
        events:
          type: array
          items:
            $ref: '#/components/schemas/SCMEventOption'
          description: 该平台可以上报的事件，每个事件带上触发器可用的动作与可过滤字段。
        default_event:
          type: string
          description: 调用方未指定时，该平台新触发器默认订阅的事件。
        default_actions:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
              description: 动作名。
          description: 该平台新触发器默认开启的动作，键为事件名。
    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: >-
        错误码。所有失败响应都会把 `error.code` 设为下列稳定字符串之一，请以它而不是 HTTP 状态码做判断。


        | 错误码 | HTTP | 含义 |

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

        | `OK` | 200 | 保留值，失败的请求不会返回。 |

        | `InvalidParameter` | 400 | 参数缺失、类型错误或未通过校验，`message` 通常会指出字段名。 |

        | `BadRequest` | 400 | 请求违反业务规则或与对象当前状态冲突，`message` 会说明原因。 |

        | `InvalidContentType` | 400 | 请求体没有以 `application/json` 发送。 |

        | `ResourceNotFound` | 400 | 引用的对象在本账户中不存在或已删除。注意 HTTP 状态码是 400 而不是 404。
        |

        | `NoLicense` | 400 | 账户套餐不包含该功能、套餐配额已用完、套餐已过期或额度不足。 |

        | `ReferenceExist` | 400 | 对象仍被其他对象引用，无法删除。 |

        | `Unauthorized` | 401 | APP Key 缺失、无效或已删除。 |

        | `BalanceNotEnough` | 402 | 仅用于控制台计费流程，Open API 接口不会返回。 |

        | `AccessDenied` | 403 | APP Key 的权限范围或创建者角色不允许该操作或该对象。 |

        | `RouteNotFound` | 404 | 没有与该 HTTP 方法和路径匹配的接口。 |

        | `MethodNotAllowed` | 405 | 路径存在，但不支持该 HTTP 方法。 |

        | `UndonedOrderExist` | 409 | 仅用于控制台计费流程，Open API 接口不会返回。 |

        | `EntityTooLarge` | 413 | 请求体超出大小限制。 |

        | `RequestLocked` | 423 | 仅用于控制台登录保护，Open API 接口不会返回。 |

        | `RequestVerifyRequired` | 428 | 仅用于控制台验证码流程，Open API 接口不会返回。 |

        | `DangerousOperation` | 428 | 仅用于控制台高风险操作的 MFA 校验，Open API 接口不会返回。 |

        | `RequestTooFrequently` | 429 | 触发频率限制；请等待响应头
        `Flashcat-Request-Rate-Limit-Delay` 给出的秒数后再重试。 |

        | `InternalError` | 500 | 服务端意外错误；请退避后重试，反馈问题时附上 `request_id`。 |

        | `ServiceUnavailable` | 503 | 后端依赖过载或不可用，请退避后重试。 |
      enum:
        - OK
        - InvalidParameter
        - BadRequest
        - InvalidContentType
        - ResourceNotFound
        - NoLicense
        - ReferenceExist
        - Unauthorized
        - BalanceNotEnough
        - AccessDenied
        - RouteNotFound
        - MethodNotAllowed
        - UndonedOrderExist
        - EntityTooLarge
        - RequestLocked
        - RequestVerifyRequired
        - DangerousOperation
        - RequestTooFrequently
        - InternalError
        - ServiceUnavailable
      x-enumDescriptions:
        OK: 保留值，失败的请求不会返回。
        InvalidParameter: 参数缺失、类型错误或未通过校验，`message` 通常会指出字段名。
        BadRequest: 请求违反业务规则或与对象当前状态冲突，`message` 会说明原因。
        InvalidContentType: 请求体没有以 `application/json` 发送。
        ResourceNotFound: 引用的对象在本账户中不存在或已删除。注意 HTTP 状态码是 400 而不是 404。
        NoLicense: 账户套餐不包含该功能、套餐配额已用完、套餐已过期或额度不足。
        ReferenceExist: 对象仍被其他对象引用，无法删除。
        Unauthorized: APP Key 缺失、无效或已删除。
        BalanceNotEnough: 仅用于控制台计费流程，Open API 接口不会返回。
        AccessDenied: APP Key 的权限范围或创建者角色不允许该操作或该对象。
        RouteNotFound: 没有与该 HTTP 方法和路径匹配的接口。
        MethodNotAllowed: 路径存在，但不支持该 HTTP 方法。
        UndonedOrderExist: 仅用于控制台计费流程，Open API 接口不会返回。
        EntityTooLarge: 请求体超出大小限制。
        RequestLocked: 仅用于控制台登录保护，Open API 接口不会返回。
        RequestVerifyRequired: 仅用于控制台验证码流程，Open API 接口不会返回。
        DangerousOperation: 仅用于控制台高风险操作的 MFA 校验，Open API 接口不会返回。
        RequestTooFrequently: 触发频率限制；请等待响应头 `Flashcat-Request-Rate-Limit-Delay` 给出的秒数后再重试。
        InternalError: 服务端意外错误；请退避后重试，反馈问题时附上 `request_id`。
        ServiceUnavailable: 后端依赖过载或不可用，请退避后重试。
      example: InvalidParameter
    SCMEventOption:
      type: object
      description: 某个平台的一个事件，及其动作与可过滤字段。
      required:
        - event
        - actions
        - fields
      properties:
        event:
          type: string
          description: >-
            平台使用的事件名，例如
            `pull_request`、`merge_request`、`release`、`issue`、`push`、`tag_push`、`note`。
        actions:
          type: array
          items:
            type: string
            description: 动作名，例如 `open`、`merge`。
          description: 该事件下触发器可以订阅的动作；只有订阅的动作发生时触发器才会运行。
        fields:
          type: array
          items:
            $ref: '#/components/schemas/SCMFieldOption'
          description: 该事件下触发器可以用于过滤的字段。
    SCMFieldOption:
      type: object
      description: 事件的一个可过滤字段。
      required:
        - field
        - value_type
        - operators
      properties:
        field:
          type: string
          description: 字段名，在过滤器的 `field` 中使用。
        value_type:
          type: string
          description: 字段值类型，决定可用的操作符：`text` 字符串、`bool` 布尔、`labels` 标签列表。
        operators:
          type: array
          items:
            type: string
            enum:
              - eq
              - contains
              - starts_with
              - in
              - not_in
              - regex
            description: >-
              `eq` 精确匹配、`contains` 包含子串、`starts_with` 前缀匹配、`in` 属于列表、`not_in`
              不属于列表、`regex` RE2 正则。
          description: 该字段可用的操作符。
  responses:
    BadRequest:
      description: 请求非法 — 通常是参数缺失或格式不正确。
      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: 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: app_key 有效，但其权限范围或创建者角色不允许该操作或该对象。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            accessDenied:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: AccessDenied
                  message: Access Denied.
    TooManyRequests:
      description: 触发频率限制。请等待响应头 `Flashcat-Request-Rate-Limit-Delay` 给出的秒数后重试。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: RequestTooFrequently
                  message: Request too frequently.
      headers:
        Flashcat-Request-Rate-Limit-Delay:
          description: 距当前限流窗口重置的秒数。请求被网关全局保护限流拒绝时不返回该响应头。
          schema:
            type: integer
            minimum: 0
    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。可通过 query 参数 `app_key` 或请求头
        `Fd-App-Key` 传入。实际可访问范围是该 APP Key 的权限范围与创建者当前角色权限的交集，请妥善保管。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.