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

# Update schedule

> Update an existing on-call schedule. Provide schedule_id to identify the schedule.

## Restrictions

| Aspect      | Value                                                         |
| ----------- | ------------------------------------------------------------- |
| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |
| Permissions | **Schedules Manage** (`on-call`)                              |


## OpenAPI

````yaml /api-reference/on-call.openapi.en.json post /schedule/update
openapi: 3.1.0
info:
  title: Flashduty Open API
  description: >-
    Public HTTP API for the Flashduty incident management platform — incidents,
    notification templates, channels, schedules, monitors, RUM, and platform
    administration. Every operation is authenticated with an `app_key` query
    parameter issued from the Flashduty console under Account → APP Keys.
    Responses follow a uniform envelope: `{ request_id, data }` on success, `{
    request_id, error }` on failure.
  version: 1.0.0
servers:
  - url: https://api.flashcat.cloud
    description: Flashduty Open API
security:
  - AppKeyAuth: []
tags:
  - name: On-call/Incidents
    description: ''
  - name: On-call/Channels
    description: ''
  - name: On-call/Alerts
    description: >-
      Search, inspect, and act on alerts. Manage card views and alert processing
      pipelines.
  - name: On-call/Integrations
    description: ''
  - name: On-call/IM integrations
    description: IM integration queries, such as which integrations have war room enabled.
  - name: On-call/Schedules
    description: ''
  - name: On-call/Calendars
    description: ''
  - name: On-call/Notification templates
    description: ''
  - name: On-call/Alert enrichment
    description: Custom fields, enrichment rules, and data mapping (schema, data, API).
  - name: On-call/Analytics
    description: ''
  - name: On-call/Status pages
    description: ''
  - name: On-call/Changes
    description: ''
paths:
  /schedule/update:
    post:
      tags:
        - On-call/Schedules
      summary: Update schedule
      description: >-
        Update an existing on-call schedule. Provide schedule_id to identify the
        schedule.
      operationId: scheduleUpdate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduleUpsertRequest'
            example:
              schedule_id: 2001
              schedule_name: Production On-Call (Updated)
              description: Updated primary on-call rotation
              team_id: 4291079133131
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/ScheduleEmptyObject'
              example:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                data: {}
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    ScheduleUpsertRequest:
      type: object
      description: >-
        Schedule create/update/preview request body. The server accepts the same
        shape as the schedule detail model; only the key fields are listed here.
        For update, set schedule_id. For preview, start and end are required.
      properties:
        schedule_id:
          type:
            - integer
            - 'null'
          format: int64
          description: Schedule ID. Required on update.
        schedule_name:
          type:
            - string
            - 'null'
          description: Schedule display name. Max 40 characters.
          maxLength: 40
        name:
          type:
            - string
            - 'null'
          description: Legacy schedule name field. Used when schedule_name is empty.
          maxLength: 40
        description:
          type:
            - string
            - 'null'
          description: Schedule description. Max 500 characters.
          maxLength: 500
        team_id:
          type:
            - integer
            - 'null'
          format: int64
          description: Owning team ID.
        layers:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleLayer'
          description: Rotation layers.
        notify:
          $ref: '#/components/schemas/ScheduleNotify'
        start:
          type: integer
          format: int64
          description: >-
            Preview window start (Unix seconds, 10 digits). Required for
            /schedule/preview.
        end:
          type: integer
          format: int64
          description: >-
            Preview window end (Unix seconds, 10 digits). Required for
            /schedule/preview. Max 45 days after start.
    SuccessEnvelope:
      type: object
      description: >-
        Success response envelope. On every 2xx response, `request_id`
        identifies the call (also mirrored in the `Flashcat-Request-Id` header)
        and `data` holds the endpoint-specific payload. Failure responses use a
        different shape — see `ErrorResponse`.
      properties:
        request_id:
          type: string
          description: >-
            Unique ID for this request. Mirrored in the Flashcat-Request-Id
            response header. Include it when reporting issues.
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        data:
          description: Endpoint-specific payload. See each operation's 200 response schema.
      required:
        - request_id
        - data
    ScheduleEmptyObject:
      type: object
      description: Empty response.
      properties: {}
    ScheduleLayer:
      type: object
      description: One rotation layer inside a schedule.
      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: Account ID.
        name:
          type: string
          description: Layer internal name.
        schedule_id:
          type: integer
          format: int64
          description: Parent schedule ID.
        hidden:
          type: integer
          description: Whether the layer is hidden in the UI (0 = no, 1 = yes).
        mode:
          type: integer
          description: 'Layer mode: 0 = common rotation, 1 = override.'
          enum:
            - 0
            - 1
        weight:
          type: integer
          description: Layer weight for ordering.
        groups:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleGroup'
          description: Oncall groups participating in the rotation.
        rotation_duration:
          type: integer
          format: int64
          description: Rotation duration in seconds.
        handoff_time:
          type: integer
          format: int64
          description: Handoff time inside the rotation cycle (seconds).
        enable_time:
          type: integer
          format: int64
          description: When the layer becomes effective (Unix seconds).
        expire_time:
          type: integer
          format: int64
          description: When the layer expires (Unix seconds, 0 means never).
        restrict_mode:
          type: integer
          description: 'Restriction mode: 0 = none, 1 = day, 2 = week.'
          enum:
            - 0
            - 1
            - 2
        restrict_start:
          type: integer
          format: int64
          description: Legacy start offset inside the restriction window (seconds).
        restrict_end:
          type: integer
          format: int64
          description: Legacy end offset inside the restriction window (seconds).
        restrict_periods:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleRestrictPeriod'
          description: Restriction windows inside each rotation cycle.
        day_mask:
          $ref: '#/components/schemas/ScheduleDayMask'
          description: Day-of-week mask.
        create_at:
          type: integer
          format: int64
          description: Creation timestamp (Unix seconds).
        create_by:
          type: integer
          format: int64
          description: Creator person ID.
        update_at:
          type: integer
          format: int64
          description: Last update timestamp (Unix seconds).
        update_by:
          type: integer
          format: int64
          description: Last updater person ID.
        layer_name:
          type: string
          description: User-facing layer name.
        fair_rotation:
          type: boolean
          description: Whether fair rotation is enabled.
        layer_start:
          type: integer
          format: int64
          description: Layer start timestamp (Unix seconds).
        layer_end:
          type:
            - integer
            - 'null'
          format: int64
          description: Layer end timestamp (Unix seconds). null means open-ended.
        rotation_unit:
          type: string
          description: Rotation unit.
          enum:
            - hour
            - day
            - week
            - month
        rotation_value:
          type: integer
          format: int64
          description: Rotation quantity (number of rotation_unit per cycle).
        mask_continuous_enabled:
          type: boolean
          description: Whether continuous masking is enabled.
    ScheduleNotify:
      type: object
      description: Notification configuration attached to a schedule.
      required:
        - fixed_time
        - by
        - webhooks
      properties:
        advance_in_time:
          type: integer
          format: int64
          description: Advance notification lead time (seconds).
        fixed_time:
          $ref: '#/components/schemas/ScheduleFixedTimeNotifyInfo'
        by:
          $ref: '#/components/schemas/ScheduleNotifyBy'
        im:
          type: object
          additionalProperties:
            type: string
          description: Legacy IM-type to token map.
        webhooks:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleImNotify'
          description: IM webhook notification channels.
    ErrorResponse:
      type: object
      description: Response envelope for errors. `error` is required; `data` is absent.
      properties:
        request_id:
          type: string
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        error:
          $ref: '#/components/schemas/DutyError'
      required:
        - request_id
        - error
    ScheduleGroup:
      type: object
      description: Oncall group definition within a rotation layer.
      required:
        - group_name
        - name
        - members
        - start
        - end
      properties:
        group_name:
          type: string
          description: Group display name.
        name:
          type: string
          description: Legacy group name.
        members:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleMember'
          description: Members of this group.
        start:
          type: integer
          format: int64
          description: Group start timestamp (Unix seconds).
        end:
          type: integer
          format: int64
          description: Group end timestamp (Unix seconds).
    ScheduleRestrictPeriod:
      type: object
      description: Restrict window inside a rotation cycle.
      required:
        - restrict_start
        - restrict_end
      properties:
        restrict_start:
          type: integer
          format: int64
          description: Start offset inside the rotation cycle.
        restrict_end:
          type: integer
          format: int64
          description: End offset inside the rotation cycle.
    ScheduleDayMask:
      type: object
      description: Day-of-week mask for a rotation layer.
      properties:
        repeat:
          type: array
          items:
            type: integer
          description: Weekday numbers (0 = Sunday) included in the rotation.
    ScheduleFixedTimeNotifyInfo:
      type: object
      description: Fixed-time notification config.
      required:
        - cycle
        - start
      properties:
        cycle:
          type: string
          description: Notification cycle.
        start:
          type: string
          description: Notification start time within the cycle.
    ScheduleNotifyBy:
      type: object
      description: Per-recipient notification preference.
      required:
        - follow_preference
        - personal_channels
      properties:
        follow_preference:
          type: boolean
          description: Whether to follow each responder's personal notification preference.
        personal_channels:
          type: array
          items:
            type: string
          description: Personal notification channel keys.
    ScheduleImNotify:
      type: object
      description: IM webhook notification entry.
      required:
        - type
        - settings
      properties:
        type:
          type: string
          description: >-
            IM provider type (for example feishu_app, dingtalk_app, wecom_app,
            teams_app, slack_app).
        settings:
          $ref: '#/components/schemas/ScheduleImNotifySettings'
    DutyError:
      type: object
      description: >-
        Error payload inside the response envelope. Present only on non-2xx
        responses.
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: >-
            Human-readable error message, localized by the caller's
            Accept-Language. May contain field names, IDs, or other context from
            the failing request.
          example: The specified parameter template_id is not valid.
      required:
        - code
        - message
    ScheduleMember:
      type: object
      description: Schedule group member reference.
      required:
        - role_id
        - person_ids
      properties:
        role_id:
          type: integer
          format: int64
          description: Oncall role ID.
        person_ids:
          type: array
          items:
            type: integer
            format: int64
          description: Person IDs in this slot.
    ScheduleImNotifySettings:
      type: object
      description: Settings for an IM webhook notification channel.
      required:
        - token
        - alias
        - data_source_id
        - chat_ids
        - verify_token
        - sign_secret
      properties:
        token:
          type: string
          description: Webhook token.
        alias:
          type: string
          description: Channel alias.
        data_source_id:
          type: integer
          format: int64
          description: Data source ID.
        chat_ids:
          type: array
          items:
            type: string
          description: Chat IDs.
        verify_token:
          type: string
          description: Verification token.
        sign_secret:
          type: string
          description: Signature secret.
    ErrorCode:
      type: string
      description: >-
        Flashduty error code enum. Every failed API response sets `error.code`
        to one of these stable wire strings. HTTP status is informational — the
        authoritative signal is the enum value.


        | Code | HTTP | Meaning |

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

        | `OK` | 200 | Reserved — not returned on real errors. |

        | `InvalidParameter` | 400 | A required parameter is missing or failed
        validation. |

        | `BadRequest` | 400 | Generic 400 used when no more specific code fits.
        |

        | `InvalidContentType` | 400 | The `Content-Type` header is not
        `application/json`. |

        | `ResourceNotFound` | 400 | The referenced resource does not exist.
        Note: returned as HTTP 400, not 404 (historical choice). |

        | `NoLicense` | 400 | The feature is license-gated and no active license
        was found. |

        | `ReferenceExist` | 400 | Deletion blocked — other entities still
        reference this resource. |

        | `Unauthorized` | 401 | `app_key` is missing, invalid, or expired. |

        | `BalanceNotEnough` | 402 | Billing-gated operation with insufficient
        account balance. |

        | `AccessDenied` | 403 | Authenticated but lacking the permission
        required for this operation. |

        | `RouteNotFound` | 404 | The request URL path is not a known route. |

        | `MethodNotAllowed` | 405 | The HTTP method is not allowed on this
        otherwise-known path. |

        | `UndonedOrderExist` | 409 | An outstanding billing order blocks this
        new one. Wait and retry. |

        | `RequestLocked` | 423 | Operation temporarily locked due to repeated
        failures. |

        | `EntityTooLarge` | 413 | Request body exceeds the configured max size.
        |

        | `RequestTooFrequently` | 429 | Rate limit hit — API-global,
        per-account, or per-integration. |

        | `RequestVerifyRequired` | 428 | Second-factor verification required
        but not supplied. |

        | `DangerousOperation` | 428 | High-risk operation requires MFA
        verification. |

        | `InternalError` | 500 | Unhandled server-side error. Include
        `request_id` in the bug report. |

        | `ServiceUnavailable` | 503 | A backend dependency is unavailable. Try
        again later. |
      enum:
        - OK
        - InvalidParameter
        - BadRequest
        - InvalidContentType
        - ResourceNotFound
        - NoLicense
        - ReferenceExist
        - Unauthorized
        - BalanceNotEnough
        - AccessDenied
        - RouteNotFound
        - MethodNotAllowed
        - UndonedOrderExist
        - RequestLocked
        - EntityTooLarge
        - RequestTooFrequently
        - RequestVerifyRequired
        - DangerousOperation
        - InternalError
        - ServiceUnavailable
      x-enumDescriptions:
        OK: Reserved — not returned on real errors.
        InvalidParameter: A required parameter is missing or failed validation.
        BadRequest: Generic 400 used when no more specific code fits.
        InvalidContentType: The `Content-Type` header is not `application/json`.
        ResourceNotFound: >-
          The referenced resource does not exist. Note: returned as HTTP 400,
          not 404 (historical choice).
        NoLicense: The feature is license-gated and no active license was found.
        ReferenceExist: Deletion blocked — other entities still reference this resource.
        Unauthorized: '`app_key` is missing, invalid, or expired.'
        BalanceNotEnough: Billing-gated operation with insufficient account balance.
        AccessDenied: Authenticated but lacking the permission required for this operation.
        RouteNotFound: The request URL path is not a known route.
        MethodNotAllowed: The HTTP method is not allowed on this otherwise-known path.
        UndonedOrderExist: An outstanding billing order blocks this new one. Wait and retry.
        RequestLocked: Operation temporarily locked due to repeated failures.
        EntityTooLarge: Request body exceeds the configured max size.
        RequestTooFrequently: Rate limit hit — API-global, per-account, or per-integration.
        RequestVerifyRequired: Second-factor verification required but not supplied.
        DangerousOperation: High-risk operation requires MFA verification.
        InternalError: Unhandled server-side error. Include `request_id` in the bug report.
        ServiceUnavailable: A backend dependency is unavailable. Try again later.
      example: InvalidParameter
  responses:
    BadRequest:
      description: Invalid request — usually a missing or malformed parameter.
      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: 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.
    TooManyRequests:
      description: >-
        Rate limit hit. Either the global API limit, a per-account limit, or a
        per-integration 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 under Account → APP Keys.
        Required on every public API call. Keep it secret — it grants the same
        access as the owning account.

````