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

# 查询自托管 Runner 列表

> 查询账户下的自托管 Runner，包括标签、状态和主机信息。

## 限制说明

| 项目 | 说明 |
| - | - |
| 速率限制 | 每个账户 **1,000 次/分钟**；**50 次/秒** |
| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |

## 使用说明

* 返回账户级 Runner 和调用者所在团队的 Runner；`team_ids` 中调用者不在的团队会被忽略。
* `scope` 优先于 `include_account`：`account` 只返回账户级 Runner，`team` 只返回团队 Runner，`all`（或不传）两者都返回。
* `query` 按子串匹配名称、ID、标签、状态、版本、操作系统、架构、主机名和 IP 地址，不区分大小写，因此用标签值可以找到带该标签的 Runner。
* `p`、`limit`、`query`、`orderby` 都不传时，一次返回全部可见 Runner；传了任意一个就分页（`limit` 默认 20）。默认按 `created_at` 倒序。
* `status` 是实时状态：`degraded` 表示 Runner 已连接但执行器不健康。不会返回连接 token。


## OpenAPI

````yaml /api-reference/safari.openapi.zh.json post /safari/environment/self-hosted/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 产物库 —— 发布、浏览并公开分享智能体生成的文件。
  - name: AI SRE/自托管 Runner
    description: 自托管 Runner（BYOC）管理。
paths:
  /safari/environment/self-hosted/list:
    post:
      tags:
        - AI SRE/自托管 Runner
      summary: 查询自托管 Runner 列表
      description: 查询账户下的自托管 Runner，包括标签、状态和主机信息。
      operationId: environment-read-self-hosted-list
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SelfHostedEnvironmentListRequest'
            example:
              p: 1
              limit: 20
              query: prod
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/SelfHostedEnvironmentListResponse'
              example:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                data:
                  environments:
                    - environment_id: env_9pL3xQ7mN2vK8wR4tY6hJ1
                      name: prod-k8s-bj
                      labels:
                        - prod
                        - k8s
                        - region=cn-beijing
                      status: online
                      team_id: 2586851485973
                      can_edit: true
                      version: 0.1.40
                      os: linux
                      arch: amd64
                      hostname: ops-jump-01
                      ip_address: 10.20.3.17
                      created_at: 1788000000000
                  total: 1
                  latest_version: 0.1.40
        '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:
    SelfHostedEnvironmentListRequest:
      type: object
      description: 自托管 Runner 列表的过滤与分页条件。
      properties:
        p:
          type: integer
          minimum: 1
          description: 页码，从 1 开始。
        limit:
          type: integer
          minimum: 1
          description: 每页条数，分页生效时默认 20。
        scope:
          type: string
          enum:
            - all
            - account
            - team
          description: >-
            `all` 账户级和团队 Runner；`account` 只要账户级；`team` 只要团队 Runner。优先于
            `include_account`。
        query:
          type: string
          maxLength: 128
          description: 按子串过滤名称、ID、标签、状态、版本、操作系统、架构、主机名和 IP 地址，最多 128 个字符。
        team_ids:
          type: array
          items:
            type: integer
            format: int64
          description: 只返回这些团队的团队 Runner；调用者不在的团队 ID 会被忽略。
        include_account:
          type: boolean
          default: true
          description: 是否包含账户级 Runner（`team_id` 为 0），默认 `true`；传了 `scope` 时忽略。
        orderby:
          type: string
          enum:
            - name
            - created_at
          description: 排序字段：`name` 或 `created_at`。不传时保持默认顺序（`created_at` 倒序）并忽略 `asc`。
        asc:
          type: boolean
          default: false
          description: 传了 `orderby` 时是否升序。
    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
    SelfHostedEnvironmentListResponse:
      type: object
      description: 一页自托管 Runner。
      required:
        - environments
        - total
        - latest_version
      properties:
        environments:
          type: array
          items:
            $ref: '#/components/schemas/SelfHostedEnvironmentItem'
          description: 本页的 Runner。
        total:
          type: integer
          format: int64
          description: 符合过滤条件的 Runner 总数。
        latest_version:
          type: string
          description: 平台提供的最新 Runner 版本；与每条的 `version` 对比可找出需要升级的 Runner。
    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
    SelfHostedEnvironmentItem:
      type: object
      description: 一个自托管 Runner。
      required:
        - environment_id
        - name
        - labels
        - status
        - team_id
        - can_edit
        - created_at
      properties:
        environment_id:
          type: string
          description: Runner ID。
        name:
          type: string
          description: Runner 名称。
        labels:
          type: array
          items:
            type: string
          description: Runner 上设置的标签；没有时为空数组。
        status:
          type: string
          enum:
            - pending
            - online
            - offline
            - degraded
          description: >-
            实时状态：`pending` 已创建但从未连接；`online` 已连接；`offline` 曾连接、现已断开；`degraded`
            已连接但执行器不健康。
        team_id:
          type: integer
          format: int64
          description: 所属团队 ID；账户级 Runner 为 0。
        can_edit:
          type: boolean
          description: 调用者可以管理该 Runner 时为 `true`。
        version:
          type: string
          description: Runner 最近一次连接时上报的版本；首次连接前不返回。
        os:
          type: string
          description: Runner 上报的操作系统，例如 `linux`、`darwin`。
        arch:
          type: string
          description: Runner 上报的 CPU 架构，例如 `amd64`、`arm64`。
        hostname:
          type: string
          description: Runner 所在机器的主机名。
        ip_address:
          type: string
          description: Runner 最近一次连接的来源 IP。
        created_at:
          type: integer
          format: int64
          description: 创建时间，Unix 毫秒级时间戳。
        vcs_credentials_disabled:
          type: boolean
          description: 不向该 Runner 上的命令注入 GitHub/GitLab token 时为 `true`；否则不返回。
    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
  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.