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

# 批量获取值班表

> 根据 ID 列表批量返回值班表信息。

## 限制说明

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


## OpenAPI

````yaml /api-reference/on-call.openapi.zh.json post /schedule/infos
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: 自定义字段、富化规则及数据映射（映射规则、映射数据、映射 API）管理。
  - name: On-call/分析看板
    description: ''
  - name: On-call/状态页
    description: ''
  - name: On-call/变更管理
    description: ''
paths:
  /schedule/infos:
    post:
      tags:
        - On-call/值班排班
      summary: 批量获取值班表
      description: 根据 ID 列表批量返回值班表信息。
      operationId: scheduleInfos
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduleIDsRequest'
            example:
              schedule_ids:
                - 2001
                - 2002
                - 2003
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/ScheduleSelfResponse'
              example:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                data:
                  items:
                    - id: 5789640530410
                      name: test-000001
                      account_id: 2451002751131
                      group_id: 4291079133131
                      disabled: 0
                      create_at: 1766110836
                      create_by: 2476123212131
                      update_at: 1775205795
                      update_by: 2476123212131
                      layers: null
                      schedule_layers: null
                      final_schedule:
                        layer_name: ''
                        name: ''
                        mode: 0
                        schedules: null
                      notify:
                        advance_in_time: 300
                        fixed_time: null
                        by:
                          follow_preference: false
                          personal_channels:
                            - email
                        webhooks:
                          - type: feishu_app
                            settings:
                              token: ''
                              alias: ''
                              data_source_id: 5427276014131
                              chat_ids:
                                - oc_60a6dc4c6e4e5cbc4934ef08aa7ff76d
                              verify_token: ''
                              sign_secret: ''
                      schedule_id: 5789640530410
                      schedule_name: test-000001
                      team_id: 4291079133131
                      description: abc
                      layer_schedules: null
                      status: 0
                      cur_oncall: null
                      next_oncall: null
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    ScheduleIDsRequest:
      type: object
      description: 批量查询值班表使用的请求体。
      required:
        - schedule_ids
      properties:
        schedule_ids:
          type: array
          items:
            type: integer
            format: int64
          description: 值班表 ID 列表。
    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
    ScheduleSelfResponse:
      type: object
      description: /schedule/self 与 /schedule/infos 的响应，仅返回 items。
      required:
        - items
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleItem'
          description: 当前用户被分配到的值班表（或请求指定的 ID 对应的值班表）。
    ScheduleItem:
      type: object
      description: /schedule/info、/schedule/preview、/schedule/list 返回的完整值班表详情。
      required:
        - id
        - name
        - account_id
        - group_id
        - disabled
        - create_at
        - create_by
        - update_at
        - update_by
        - layers
        - schedule_layers
        - final_schedule
        - notify
        - schedule_id
        - schedule_name
        - team_id
        - description
        - layer_schedules
        - status
        - cur_oncall
        - next_oncall
      properties:
        id:
          type:
            - integer
            - 'null'
          format: int64
          description: 值班表 ID。/schedule/preview 返回时为 null。
        name:
          type:
            - string
            - 'null'
          description: 旧版值班表名称字段（与 schedule_name 同义）。/schedule/preview 返回时为 null。
        account_id:
          type: integer
          format: int64
          description: 账户 ID。
        group_id:
          type:
            - integer
            - 'null'
          format: int64
          description: 旧版团队/组 ID。/schedule/preview 返回时为 null。
        disabled:
          type:
            - integer
            - 'null'
          description: 禁用标记（0 = 启用，1 = 禁用），已废弃。/schedule/preview 返回时为 null。
        create_at:
          type: integer
          format: int64
          description: 创建时间（Unix 秒）。
        create_by:
          type: integer
          format: int64
          description: 创建人 ID。
        update_at:
          type: integer
          format: int64
          description: 更新时间（Unix 秒）。
        update_by:
          type: integer
          format: int64
          description: 更新人 ID。
        layers:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleLayer'
          description: 值班表的轮转分层。
        field:
          type: string
          description: 旧版字段更新接口使用的字段名。
        schedule_layers:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleCalculatedLayer'
          description: 按窗口计算出的分层值班结果。
        final_schedule:
          $ref: '#/components/schemas/ScheduleCalculatedLayer'
          description: 所有分层合并后的最终值班结果。
        start:
          type: integer
          format: int64
          description: 窗口开始时间（Unix 秒）。
        end:
          type: integer
          format: int64
          description: 窗口结束时间（Unix 秒）。
        notify:
          $ref: '#/components/schemas/ScheduleNotify'
        schedule_id:
          type: integer
          format: int64
          description: 值班表 ID。
        schedule_name:
          type:
            - string
            - 'null'
          description: 值班表显示名称。/schedule/preview 返回时为 null。
        team_id:
          type:
            - integer
            - 'null'
          format: int64
          description: 所属团队 ID。/schedule/preview 返回时为 null。
        description:
          type:
            - string
            - 'null'
          description: 值班表描述。/schedule/preview 返回时为 null。
        layer_schedules:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleCalculatedLayer'
          description: 与 schedule_layers 等价，用于旧版兼容。
        status:
          type:
            - integer
            - 'null'
          description: 旧版状态字段，已废弃。/schedule/preview 返回时为 null。
        cur_oncall:
          $ref: '#/components/schemas/ScheduleOncallGroup'
          description: 当前正在值班的组，无人值班时为 null。
        next_oncall:
          $ref: '#/components/schemas/ScheduleOncallGroup'
          description: 下一次值班的组，未知时为 null。
    ErrorResponse:
      type: object
      description: 错误响应结构。`error` 必填，`data` 不存在。
      properties:
        request_id:
          type: string
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        error:
          $ref: '#/components/schemas/DutyError'
      required:
        - request_id
        - error
    ScheduleLayer:
      type: object
      description: 值班表中的单个分层。
      required:
        - account_id
        - name
        - schedule_id
        - hidden
        - mode
        - weight
        - groups
        - rotation_duration
        - handoff_time
        - enable_time
        - expire_time
        - restrict_mode
        - restrict_start
        - restrict_end
        - restrict_periods
        - day_mask
        - create_at
        - create_by
        - update_at
        - update_by
        - fair_rotation
        - rotation_unit
        - rotation_value
        - mask_continuous_enabled
      properties:
        account_id:
          type: integer
          format: int64
          description: 账户 ID。
        name:
          type: string
          description: 分层内部名称。
        schedule_id:
          type: integer
          format: int64
          description: 所属值班表 ID。
        hidden:
          type: integer
          description: 是否在页面上隐藏（0 = 否，1 = 是）。
        mode:
          type: integer
          description: 分层模式：0 = 普通轮转，1 = 覆盖。
          enum:
            - 0
            - 1
        weight:
          type: integer
          description: 分层权重，用于排序。
        groups:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleGroup'
          description: 参与轮转的值班组。
        rotation_duration:
          type: integer
          format: int64
          description: 轮转周期（秒）。
        handoff_time:
          type: integer
          format: int64
          description: 值班交接时间（秒）。
        enable_time:
          type: integer
          format: int64
          description: 分层生效时间（Unix 秒）。
        expire_time:
          type: integer
          format: int64
          description: 分层失效时间（Unix 秒，0 表示永不过期）。
        restrict_mode:
          type: integer
          description: 限制模式：0 = 不限制，1 = day，2 = week。
          enum:
            - 0
            - 1
            - 2
        restrict_start:
          type: integer
          format: int64
          description: 旧版限制区间开始偏移（秒）。
        restrict_end:
          type: integer
          format: int64
          description: 旧版限制区间结束偏移（秒）。
        restrict_periods:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleRestrictPeriod'
          description: 每个值班周期内的限制区间集合。
        day_mask:
          $ref: '#/components/schemas/ScheduleDayMask'
          description: 星期掩码。
        create_at:
          type: integer
          format: int64
          description: 创建时间（Unix 秒）。
        create_by:
          type: integer
          format: int64
          description: 创建人 ID。
        update_at:
          type: integer
          format: int64
          description: 更新时间（Unix 秒）。
        update_by:
          type: integer
          format: int64
          description: 更新人 ID。
        layer_name:
          type: string
          description: 分层显示名称。
        fair_rotation:
          type: boolean
          description: 是否启用公平轮转。
        layer_start:
          type: integer
          format: int64
          description: 分层开始时间（Unix 秒）。
        layer_end:
          type:
            - integer
            - 'null'
          format: int64
          description: 分层结束时间（Unix 秒）。null 表示无结束时间。
        rotation_unit:
          type: string
          description: 轮转单位。
          enum:
            - hour
            - day
            - week
            - month
        rotation_value:
          type: integer
          format: int64
          description: 轮转数量（每周期的 rotation_unit 个数）。
        mask_continuous_enabled:
          type: boolean
          description: 是否启用连续掩码。
    ScheduleCalculatedLayer:
      type: object
      description: 单个分层的计算结果。
      required:
        - layer_name
        - name
        - mode
        - schedules
      properties:
        layer_name:
          type: string
          description: 分层显示名称。
        name:
          type: string
          description: 分层内部名称。
        mode:
          type: integer
          description: 分层模式：0 = 普通轮转，1 = 覆盖。
        schedules:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleCalculatedSchedule'
          description: 计算出的值班时段。
    ScheduleNotify:
      type: object
      description: 值班表的通知配置。
      required:
        - fixed_time
        - by
        - webhooks
      properties:
        advance_in_time:
          type: integer
          format: int64
          description: 提前通知时间（秒）。
        fixed_time:
          $ref: '#/components/schemas/ScheduleFixedTimeNotifyInfo'
        by:
          $ref: '#/components/schemas/ScheduleNotifyBy'
        im:
          type: object
          additionalProperties:
            type: string
          description: 旧版 IM 类型到 token 的映射。
        webhooks:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleImNotify'
          description: IM Webhook 通知通道。
    ScheduleOncallGroup:
      type: object
      description: 当前或下一次值班组快照。
      required:
        - start
        - end
        - group
        - update_at
        - weight
        - index
      properties:
        start:
          type: integer
          format: int64
          description: 时段开始时间（Unix 秒）。
        end:
          type: integer
          format: int64
          description: 时段结束时间（Unix 秒）。
        group:
          $ref: '#/components/schemas/ScheduleGroup'
        update_at:
          type: integer
          format: int64
          description: 更新时间（Unix 秒）。
        weight:
          type: integer
          description: 来源分层权重。
        index:
          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
    ScheduleGroup:
      type: object
      description: 值班分层内的值班组。
      required:
        - group_name
        - name
        - members
        - start
        - end
      properties:
        group_name:
          type: string
          description: 值班组显示名称。
        name:
          type: string
          description: 值班组内部名称。
        members:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleMember'
          description: 值班组成员。
        start:
          type: integer
          format: int64
          description: 值班组开始时间（Unix 秒）。
        end:
          type: integer
          format: int64
          description: 值班组结束时间（Unix 秒）。
    ScheduleRestrictPeriod:
      type: object
      description: 单个值班周期内的限制区间。
      required:
        - restrict_start
        - restrict_end
      properties:
        restrict_start:
          type: integer
          format: int64
          description: 限制区间开始偏移。
        restrict_end:
          type: integer
          format: int64
          description: 限制区间结束偏移。
    ScheduleDayMask:
      type: object
      description: 按星期几生效的掩码配置。
      properties:
        repeat:
          type: array
          items:
            type: integer
          description: 生效的星期几（0 = 周日）。
    ScheduleCalculatedSchedule:
      type: object
      description: 分层内计算出的值班时段。
      required:
        - start
        - end
        - group
        - index
      properties:
        start:
          type: integer
          format: int64
          description: 时段开始时间（Unix 秒）。
        end:
          type: integer
          format: int64
          description: 时段结束时间（Unix 秒）。
        group:
          $ref: '#/components/schemas/ScheduleGroup'
        index:
          type: integer
          description: 轮转内索引。
    ScheduleFixedTimeNotifyInfo:
      type: object
      description: 固定时间通知配置。
      required:
        - cycle
        - start
      properties:
        cycle:
          type: string
          description: 通知周期。
        start:
          type: string
          description: 周期内的通知开始时间。
    ScheduleNotifyBy:
      type: object
      description: 接收人的通知偏好。
      required:
        - follow_preference
        - personal_channels
      properties:
        follow_preference:
          type: boolean
          description: 是否跟随个人通知偏好。
        personal_channels:
          type: array
          items:
            type: string
          description: 个人通知通道列表。
    ScheduleImNotify:
      type: object
      description: IM Webhook 通知条目。
      required:
        - type
        - settings
      properties:
        type:
          type: string
          description: IM 提供方类型（如 feishu_app、dingtalk_app、wecom_app、teams_app、slack_app）。
        settings:
          $ref: '#/components/schemas/ScheduleImNotifySettings'
    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
    ScheduleMember:
      type: object
      description: 值班组内成员条目。
      required:
        - role_id
        - person_ids
      properties:
        role_id:
          type: integer
          format: int64
          description: 值班角色 ID。
        person_ids:
          type: array
          items:
            type: integer
            format: int64
          description: 该角色下的用户 ID 列表。
    ScheduleImNotifySettings:
      type: object
      description: IM Webhook 通知通道配置。
      required:
        - token
        - alias
        - data_source_id
        - chat_ids
        - verify_token
        - sign_secret
      properties:
        token:
          type: string
          description: Webhook token。
        alias:
          type: string
          description: 通道别名。
        data_source_id:
          type: integer
          format: int64
          description: 数据源 ID。
        chat_ids:
          type: array
          items:
            type: string
          description: 会话 ID 列表。
        verify_token:
          type: string
          description: 验签 token。
        sign_secret:
          type: string
          description: 签名密钥。
  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
        时都必须携带。它等同于所属账户的身份凭证，请妥善保管。

````