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

# 获取服务拓扑图

> 返回以某台主机为锚点、通过实时网络观测发现的出向依赖拓扑图。

## 限制说明

| 项目   | 说明                         |
| ---- | -------------------------- |
| 速率限制 | 每个账户 **20 次/分钟**；**1 次/秒** |
| 权限要求 | **服务拓扑查看**（`monit`）        |

## 使用说明

* 服务拓扑是可选子系统：未配置 `redis.servicemap` 的部署会返回 `ServiceUnavailable`。
* `at` 当前仅支持 `now`（留空效果相同）。
* `direction` 当前仅支持 `outbound`（留空效果相同）。
* `anchor.host_id` 必须已被服务拓扑感知（存在当前或近期的拓扑数据），否则返回 `ResourceNotFound`。
* `depth`（最大 3）、`max_nodes`（最大 500）、`max_edges`（最大 1000）共同限定遍历范围；触发任一上限时 `truncated=true`，并在 `truncation_reasons` 中说明原因。
* `unresolved_mode=summary`（相对默认值 `full`）会从 `edges` 中省略未解析边，仅在 `unresolved_endpoints` 中返回有界样本。


## OpenAPI

````yaml /api-reference/monitors.openapi.zh.json post /monit/servicemap/topology
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: Monitors/告警规则
    description: 创建、管理和导出监控告警规则，查询规则统计和审计历史。
  - name: Monitors/告警数据源
    description: 管理监控告警规则用于查询指标的数据源。
  - name: Monitors/规则集
    description: 管理 Monitors 规则仓库中的共享规则集，规则集可在账户内或公开共享。
  - name: Monitors/诊断分析
    description: Flashduty AI SRE 使用的诊断与查询接口——数据源即席查询、日志/指标诊断,以及监控对象侧的工具调用。
  - name: Monitors/通用工具
    description: 监控服务开通及数据预览工具。
  - name: Monitors/服务拓扑
    description: 查询基于网络观测生成的服务拓扑、依赖摘要，以及主机的服务拓扑采集状态。
paths:
  /monit/servicemap/topology:
    post:
      tags:
        - Monitors/服务拓扑
      summary: 获取服务拓扑图
      description: 返回以某台主机为锚点、通过实时网络观测发现的出向依赖拓扑图。
      operationId: monit-servicemap-read-topology
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceMapTopologyRequest'
            example:
              anchor:
                host_id: host_0123456789abcdef0123456789abcdef
              depth: 2
              max_nodes: 100
              max_edges: 200
              include_metrics: true
              unresolved_mode: full
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/ServiceMapTopologyResponse'
              example:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                data:
                  network_scope_id: ns_0123456789abcdef0123456789abcdef
                  anchor_host_id: host_0123456789abcdef0123456789abcdef
                  observed_at_ms: 1784635556072
                  freshness:
                    status: fresh
                    newest_received_at_ms: 1784635557272
                    oldest_received_at_ms: 1784635557272
                    max_age_ms: 1200
                  coverage:
                    direction: outbound
                    hosts_loaded: 2
                    degraded_hosts: 0
                    truncated_hosts: 0
                    capture_modes:
                      - ebpf
                    network_inventory_status: complete
                    kubernetes_enrichment_status: unavailable
                    listener_address_family_status: complete
                    ipv6_wildcard_listener_count: 0
                    ipv6_only_known_listener_count: 0
                    ipv6_only_unknown_listener_count: 0
                  truncated: false
                  nodes:
                    - host_id: host_0123456789abcdef0123456789abcdef
                      id: procw_v1_source
                      kind: process
                      display_name: orders.service
                      systemd_unit: orders.service
                      first_seen: '2026-07-01T02:00:00Z'
                      last_seen: '2026-07-21T18:45:56.072+08:00'
                    - host_id: host_fedcba9876543210fedcba9876543210
                      id: procw_v1_mysql
                      kind: process
                      display_name: mysqld.service
                      systemd_unit: mysqld.service
                      first_seen: '2026-07-01T02:00:00Z'
                      last_seen: '2026-07-21T18:45:56.072+08:00'
                  edges:
                    - host_id: host_0123456789abcdef0123456789abcdef
                      id: edge_v1_example
                      source_entity_id: procw_v1_source
                      source_netns_id: netns_v1_default
                      destination:
                        ip: 203.0.113.105
                        port: 3306
                        protocol: tcp
                      evidence: connect
                      last_seen: '2026-07-21T18:45:56.072+08:00'
                      depth: 1
                      endpoint_resolution:
                        status: resolved
                        endpoint:
                          ip: 203.0.113.105
                          port: 3306
                          protocol: tcp
                        candidates:
                          - host_id: host_fedcba9876543210fedcba9876543210
                            entity_id: procw_v1_mysql
                            netns_id: netns_v1_default
                            listener_id: listener_v1_mysql
                            listener_ip: 203.0.113.105
                            effective_ip: 203.0.113.105
                            protocol: tcp
                            port: 3306
                            match_kind: exact
                            confidence: 1
                            node_kind: process
                            node_display_name: mysqld.service
                            graph_sequence: 42
                            observed_at_ms: 1784635556072
                  unresolved_endpoints: []
                  resolution_counts:
                    resolved: 1
                    ambiguous: 0
                    unresolved: 0
                  unresolved_projection:
                    mode: full
                    total: 0
                    returned: 0
                    omitted: 0
                    by_reason: []
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    ServiceMapTopologyRequest:
      type: object
      description: 出向拓扑遍历的查询参数。
      required:
        - anchor
      properties:
        anchor:
          $ref: '#/components/schemas/ServiceMapAnchor'
          description: 遍历的起始主机（及可选的实体）。
        network_scope_id:
          type: string
          description: >-
            可选的一致性校验：如果设置，必须与 `anchor.host_id` 已关联的网络域一致，否则返回
            `InvalidParameter`。
        at:
          type: string
          enum:
            - now
          description: 查询的时间选择器。当前仅支持 `now`；省略该字段效果相同。
        direction:
          type: string
          enum:
            - outbound
          description: 遍历方向。当前仅支持 `outbound`；省略该字段效果相同。
        depth:
          type: integer
          description: 从锚点开始的最大遍历深度。默认 1，最大 3。
          default: 1
          maximum: 3
        max_nodes:
          type: integer
          description: 返回节点数量的上限，超出则截断。默认 100，最大 500。
          default: 100
          maximum: 500
        max_edges:
          type: integer
          description: 遍历边数量的上限，超出则截断。默认 200，最大 1000。
          default: 200
          maximum: 1000
        include_metrics:
          type: boolean
          description: 是否在响应中包含每条边的原始 `metrics` 数据。默认 `false`。
          default: false
        unresolved_mode:
          type: string
          enum:
            - summary
            - full
          description: >-
            未解析边的投影方式。`full`（默认）会将其同时纳入 `edges` 和
            `unresolved_endpoints`；`summary` 会从 `edges` 中省略，仅在
            `unresolved_endpoints` 中返回有界样本。
          default: full
    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
    ServiceMapTopologyResponse:
      type: object
      description: 以锚点主机为中心发现的出向依赖拓扑图。
      required:
        - network_scope_id
        - anchor_host_id
        - observed_at_ms
        - freshness
        - coverage
        - truncated
        - nodes
        - edges
        - unresolved_endpoints
        - resolution_counts
        - unresolved_projection
      properties:
        network_scope_id:
          type: string
          description: 本次拓扑解析所属的网络域。
        anchor_host_id:
          type: string
          description: 回显请求中的锚点主机 ID。
        anchor_entity_id:
          type: string
          description: 回显请求中的锚点实体 ID（如提供）。
        observed_at_ms:
          type: integer
          format: int64
          description: 底层数据被 Agent 观测到的 Unix 时间戳（毫秒），取已加载主机中的最新值。
        freshness:
          $ref: '#/components/schemas/ServiceMapFreshness'
          description: 拓扑数据的新鲜程度。
        coverage:
          $ref: '#/components/schemas/ServiceMapTopologyCoverage'
          description: 已加载主机的整体覆盖与增强状态。
        truncated:
          type: boolean
          description: 若因任一上限（`max_nodes`、`max_edges` 或内部查询预算）导致遍历被截断则为 true。
        truncation_reasons:
          type: array
          description: 当 `truncated=true` 时，遍历被截断的机器可读原因。
          items:
            type: string
        nodes:
          type: array
          description: 遍历中发现的节点。
          items:
            $ref: '#/components/schemas/ServiceMapNode'
        edges:
          type: array
          description: 遍历中发现的边。当 `unresolved_mode=summary` 时不包含未解析边。
          items:
            $ref: '#/components/schemas/ServiceMapEdge'
        unresolved_endpoints:
          type: array
          description: 目的端点未能解析的边的样本或全集，取决于 `unresolved_projection`。
          items:
            $ref: '#/components/schemas/ServiceMapUnresolvedEndpoint'
        resolution_counts:
          $ref: '#/components/schemas/ServiceMapResolutionCounts'
          description: 按解析结果分类的边数量统计。
        unresolved_projection:
          $ref: '#/components/schemas/ServiceMapUnresolvedProjection'
          description: 未解析边如何被投影进本次响应。
    ServiceMapAnchor:
      type: object
      description: 标识本次查询锚定的主机（以及可选的具体进程/实体）。
      required:
        - host_id
      properties:
        host_id:
          type: string
          description: 稳定的服务拓扑主机标识符，例如 `host_0123...`。该主机必须已被服务拓扑感知。
          pattern: ^host_[a-z0-9_-]+$
          maxLength: 128
        entity_id:
          type: string
          description: 可选，主机内具体进程/实体的 ID，用于锚定到该实体。省略则锚定到整台主机。
    ServiceMapFreshness:
      type: object
      description: 描述底层拓扑数据的新鲜程度。
      required:
        - status
        - newest_received_at_ms
        - oldest_received_at_ms
        - max_age_ms
      properties:
        status:
          type: string
          enum:
            - fresh
            - stale
            - unknown
          description: >-
            新鲜度分类。`fresh` = 最近一次快照在 2× 上报间隔内收到；`stale` = 超过 2×
            上报间隔未收到新快照；`unknown` = 无快照数据，无法判定。
        newest_received_at_ms:
          type: integer
          format: int64
          description: 覆盖主机中最近一次收到拓扑数据的 Unix 时间戳（毫秒）。
        oldest_received_at_ms:
          type: integer
          format: int64
          description: 覆盖主机中最早一次收到拓扑数据的 Unix 时间戳（毫秒）。
        max_age_ms:
          type: integer
          format: int64
          description: 覆盖范围内最旧拓扑数据相对当前时间的年龄（毫秒）。
    ServiceMapTopologyCoverage:
      type: object
      description: 本次查询所加载的全部主机拓扑数据的整体覆盖与增强状态。
      required:
        - direction
        - hosts_loaded
        - degraded_hosts
        - truncated_hosts
        - network_inventory_status
        - kubernetes_enrichment_status
        - listener_address_family_status
      properties:
        direction:
          type: string
          enum:
            - outbound
          description: 始终为 `outbound`；服务拓扑当前仅建模出向关系。
        hosts_loaded:
          type: integer
          format: int64
          description: 为回答本次查询所加载的不同主机拓扑数量。
        degraded_hosts:
          type: integer
          format: int64
          description: 已加载的主机拓扑中，在采集时处于降级状态的数量。
        truncated_hosts:
          type: integer
          format: int64
          description: 已加载的主机拓扑中，在采集时被截断的数量。
        capture_modes:
          type: array
          description: 已加载主机中出现的不同采集模式（如 `ebpf`）。
          items:
            type: string
        network_inventory_status:
          type: string
          enum:
            - unknown
            - complete
            - partial
            - unavailable
          description: |-
            已加载主机的网络清单增强覆盖聚合状态（取所有主机中最差的一档）。

            | 值 | 含义 |
            |---|---|
            | `complete` | 所有主机请求的网络命名空间全部扫描成功且无错误。 |
            | `partial` | 至少一台主机部分命名空间未扫描成功，或扫描存在错误。 |
            | `unavailable` | 至少一台主机的命名空间全部未扫描成功。 |
            | `unknown` | 未加载任何主机，或某主机上报了无法识别的状态。 |
        kubernetes_enrichment_status:
          type: string
          enum:
            - unknown
            - complete
            - partial
            - unavailable
          description: |-
            已加载主机的 Kubernetes 增强覆盖聚合状态（取所有主机中最差的一档）。

            | 值 | 含义 |
            |---|---|
            | `complete` | 所有主机的实体均有完整的 Pod 绑定元数据。 |
            | `partial` | 至少一台主机存在绑定但部分 Pod 元数据缺失，或有绑定被丢弃。 |
            | `unavailable` | 至少一台主机没有任何 Pod 绑定。 |
            | `unknown` | 未加载任何主机，或某主机上报了无法识别的状态。 |
        listener_address_family_status:
          type: string
          enum:
            - unknown
            - complete
            - partial
            - unavailable
          description: |-
            已加载主机的监听地址族（IPv4/IPv6）解析覆盖聚合状态（取所有主机中最差的一档）。

            | 值 | 含义 |
            |---|---|
            | `complete` | 所有主机的 IPv6 通配监听器，其 IPv6-only 属性均已确认。 |
            | `partial` | 至少一台主机只有部分 IPv6 通配监听器的 IPv6-only 属性已确认。 |
            | `unavailable` | 至少一台主机的 IPv6 通配监听器 IPv6-only 属性全部未知。 |
            | `unknown` | 未加载任何主机，或某主机上报了无法识别的状态。 |
        ipv6_wildcard_listener_count:
          type: integer
          format: int64
          description: 观测到的 IPv6 通配（未指定地址）监听数量。
        ipv6_only_known_listener_count:
          type: integer
          format: int64
          description: IPV6_V6ONLY 设置已知的 IPv6 通配监听数量。
        ipv6_only_unknown_listener_count:
          type: integer
          format: int64
          description: IPV6_V6ONLY 设置无法确定的 IPv6 通配监听数量。
        reasons:
          type: array
          description: 解释已加载主机中降级或截断状态的机器可读原因码。
          items:
            type: string
    ServiceMapNode:
      type: object
      description: 在某台主机上发现的进程、容器或工作负载。
      required:
        - host_id
        - id
        - kind
        - display_name
      properties:
        host_id:
          type: string
          description: 观测到该节点的主机。
        id:
          type: string
          description: 节点的实体 ID，在其主机范围内唯一。
        kind:
          type: string
          description: 节点类型，例如 `process`、`container`。
        display_name:
          type: string
          description: 人类可读的展示名称。
        systemd_unit:
          type: string
          description: 当节点为 systemd 管理的进程时的 unit 名称。
        executable_name:
          type: string
          description: 可执行文件名称。
        container_name:
          type: string
          description: 当节点运行在容器中时的容器名称。
        image_repository:
          type: string
          description: 容器镜像仓库。
        image_version:
          type: string
          description: 容器镜像标签/版本。
        namespace:
          type: string
          description: Kubernetes 命名空间（如已知）。
        workload_name:
          type: string
          description: Kubernetes 工作负载名称（如已知）。
        instance_count:
          type: integer
          description: 当节点代表一个工作负载副本集时，折叠进该节点的实例数量。
        identity:
          description: 与节点类型相关的不透明身份数据，结构取决于 `kind`。
        sample_instances:
          description: 折叠进该节点的底层实例样本（如适用），结构不透明。
        first_seen:
          type: string
          format: date-time
          description: 首次观测到该节点的时间。
        last_seen:
          type: string
          format: date-time
          description: 最近一次观测到该节点的时间。
    ServiceMapEdge:
      type: object
      description: 从源节点到目的端点的一条已观测出向网络关系。
      required:
        - host_id
        - id
        - source_entity_id
        - source_netns_id
        - destination
        - evidence
        - depth
        - endpoint_resolution
      properties:
        host_id:
          type: string
          description: 该边源节点所在的主机。
        id:
          type: string
          description: 边 ID，在其主机范围内唯一。
        source_entity_id:
          type: string
          description: 源节点的实体 ID。
        source_netns_id:
          type: string
          description: 发起该连接的网络命名空间 ID。
        destination:
          $ref: '#/components/schemas/ServiceMapEndpoint'
          description: 该连接的目的端点。
        evidence:
          type: string
          description: 该边的观测方式，例如 `connect`。
        first_seen:
          type: string
          format: date-time
          description: 首次观测到该边的时间。
        last_seen:
          type: string
          format: date-time
          description: 最近一次观测到该边的时间。
        metrics:
          description: 仅当请求 `include_metrics=true` 时才会出现的、每条边的不透明指标数据。
        depth:
          type: integer
          description: 发现该边时相对锚点的遍历深度。
        endpoint_resolution:
          $ref: '#/components/schemas/ServiceMapEndpointResolution'
          description: 目的端点到候选目标节点的解析结果。
    ServiceMapUnresolvedEndpoint:
      type: object
      description: 目的端点未能被置信解析到某个节点的出向边。
      required:
        - host_id
        - edge_id
        - source_entity_id
        - source_netns_id
        - destination
        - reason
      properties:
        host_id:
          type: string
          description: 该边源节点所在的主机。
        edge_id:
          type: string
          description: 边 ID，在其主机范围内唯一。
        source_entity_id:
          type: string
          description: 源节点的实体 ID。
        source_netns_id:
          type: string
          description: 发起该连接的网络命名空间 ID。
        destination:
          $ref: '#/components/schemas/ServiceMapEndpoint'
          description: 该连接的目的端点。
        reason:
          type: string
          description: 该端点未能解析的机器可读原因。
    ServiceMapResolutionCounts:
      type: object
      description: 按解析结果分类的边数量统计。
      required:
        - resolved
        - ambiguous
        - unresolved
      properties:
        resolved:
          type: integer
          description: 解析到唯一置信候选的边数量。
        ambiguous:
          type: integer
          description: 解析到多个或低置信候选的边数量。
        unresolved:
          type: integer
          description: 未能解析出候选的边数量。
    ServiceMapUnresolvedProjection:
      type: object
      description: 描述未解析边如何按 `unresolved_mode` 投影进响应中的汇总信息。
      required:
        - mode
        - total
        - returned
        - omitted
        - by_reason
      properties:
        mode:
          type: string
          enum:
            - summary
            - full
          description: >-
            本次应用的 `unresolved_mode`。`full` = 未解析的目的端完整列入
            `unresolved_endpoints`，且对应的边保留在 `edges` 中（默认）；`summary` = 未解析的边不进入
            `edges`，`unresolved_endpoints` 仅保留最多 20 条样例，配合 `by_reason` 计数概览。
        total:
          type: integer
          description: 找到的未解析边总数，不论实际返回了多少。
        returned:
          type: integer
          description: 已包含在 `unresolved_endpoints` 中的未解析边数量。
        omitted:
          type: integer
          description: 已找到但未返回的未解析边数量（`total - returned`）。
        by_reason:
          type: array
          description: 按原因码对 `total` 未解析边数量的细分。
          items:
            $ref: '#/components/schemas/ServiceMapUnresolvedReasonCount'
    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
    ServiceMapEndpoint:
      type: object
      description: 一个网络传输端点。
      required:
        - ip
        - port
        - protocol
      properties:
        ip:
          type: string
          description: 目标 IP 地址。
        port:
          type: integer
          description: 目标端口。
        protocol:
          type: string
          enum:
            - tcp
            - udp
          description: 传输协议，`tcp` 或 `udp`。
    ServiceMapEndpointResolution:
      type: object
      description: 将某条边的目的端点解析为一个或多个候选节点的结果。
      required:
        - status
        - endpoint
        - candidates
      properties:
        status:
          type: string
          enum:
            - resolved
            - ambiguous
            - unresolved
          description: >-
            解析结果。`resolved` 表示唯一且置信的候选；`ambiguous` 表示存在多个或低置信候选；`unresolved`
            表示未找到候选。
        reason:
          type: string
          description: >-
            当 `status` 非 `resolved` 时的机器可读原因码，例如
            `no_current_listener`、`multiple_current_listeners`、`query_budget_exceeded`。
        endpoint:
          $ref: '#/components/schemas/ServiceMapEndpoint'
          description: 被解析的目的端点。
        candidates:
          type: array
          description: 为该端点找到的候选节点，按置信度排序。
          items:
            $ref: '#/components/schemas/ServiceMapResolutionCandidate'
        candidates_truncated:
          type: boolean
          description: 若候选列表因内部查询预算被截断则为 true。
    ServiceMapUnresolvedReasonCount:
      type: object
      description: 共享同一原因的未解析边数量统计。
      required:
        - reason
        - count
      properties:
        reason:
          type: string
          description: 机器可读的未解析原因码。
        count:
          type: integer
          description: 该原因对应的未解析边数量。
    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
    ServiceMapResolutionCandidate:
      type: object
      description: 某条边目的端点可能解析到的一个候选节点。
      required:
        - host_id
        - entity_id
        - netns_id
        - listener_id
        - listener_ip
        - effective_ip
        - protocol
        - port
        - match_kind
        - confidence
        - graph_sequence
        - observed_at_ms
      properties:
        host_id:
          type: string
          description: 候选监听所在主机 ID。
        entity_id:
          type: string
          description: 候选监听对应的实体/进程 ID。
        netns_id:
          type: string
          description: 候选监听所在的网络命名空间 ID。
        listener_id:
          type: string
          description: 匹配到的监听标识符。
        listener_ip:
          type: string
          description: 监听绑定的 IP 地址（可能为通配地址）。
        effective_ip:
          type: string
          description: 本次实际用于匹配该候选的目标 IP。
        protocol:
          type: string
          enum:
            - tcp
            - udp
          description: 传输协议，`tcp` 或 `udp`。
        port:
          type: integer
          description: 目标端口。
        match_kind:
          type: string
          description: >-
            监听与目的端点的匹配方式，例如
            `exact`、`wildcard`、`wildcard_dual_stack`、`wildcard_address_family_unknown`。
        confidence:
          type: number
          description: 匹配置信度，范围 `[0, 1]`；当返回多个候选时上限为 0.6。
        node_kind:
          type: string
          description: 候选所属节点的类型（如已知）。
        node_display_name:
          type: string
          description: 候选所属节点的展示名称（如已知）。
        graph_sequence:
          type: integer
          format: uint64
          description: 观测到该候选时所在拓扑生成的序列号。
        observed_at_ms:
          type: integer
          format: int64
          description: 该候选所在拓扑生成被 Agent 观测到的 Unix 时间戳（毫秒）。
    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.
    ServiceUnavailable:
      description: 当前部署未开启或无法访问 ServiceMap 子系统。反馈问题时请附带 request_id。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            serviceMapDisabled:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: ServiceUnavailable
                  message: servicemap store is not initialized
  securitySchemes:
    AppKeyAuth:
      type: apiKey
      in: query
      name: app_key
      description: >-
        在 Flashduty 控制台 账户 → APP Key 中签发的 app_key。调用任何公开 API
        时都必须携带。它等同于所属账户的身份凭证，请妥善保管。

````