> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# スケジュールを更新

> 既存のスケジュールを更新します。

<div id="permissions">
  ## 権限
</div>

組織レベルで `ManageOrgSchedules` 権限を持つサービスユーザーが必要です。

<div id="notes">
  ## 注意事項
</div>

すべてのフィールドは任意入力です。リクエストボディで指定したフィールドのみが更新されます。スケジュールを無効化するには、`enabled` を `false` に設定します。

`playbook_id` を `null` に設定すると、関連付けられているプレイブックが解除されます。

`schedule_type` は `recurring` と `one_time` の間で変更できます。`one_time` に変更する場合は、将来の日時を表す ISO 8601 形式の値を `scheduled_at` に指定してください。`recurring` に変更する場合は、有効な cron 式を `frequency` に指定してください。

<div id="execution-identity">
  ## 実行アイデンティティ
</div>

`run_as_user_id` パラメータは、スケジュールをどのユーザーのアイデンティティとして実行するかを制御します。スケジュールがトリガーされると、そのユーザーのセッションとして作成され、そのユーザーに通知が送信され、そのセッションが当該ユーザーの履歴に表示されます。

* **ユーザーを設定する**: 実行アイデンティティを変更するには、有効なユーザー ID を指定します。これには以下が必要です:
  1. サービスユーザーが `ImpersonateOrgSessions` 権限を持っていること
  2. 対象ユーザーがその組織のメンバーであること
  3. 対象ユーザーが `UseDevinSessions` 権限を持っていること
* **クリア (`null` に設定) **: スケジュールはデフォルトのボットユーザーとして実行される状態に戻ります
* **フィールドを省略する**: 現在の実行アイデンティティは変更されません


## OpenAPI

````yaml ja/v3-openapi.json PATCH /v3/organizations/{org_id}/schedules/{schedule_id}
openapi: 3.1.0
info:
  description: サービスユーザー認証とRBACに対応したDevin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3/organizations/{org_id}/schedules/{schedule_id}:
    patch:
      tags:
        - schedules
      summary: スケジュールを更新
      description: 既存のスケジュールを更新します。
      operationId: >-
        handle_update_schedule_v3_organizations__org_id__schedules__schedule_id__patch
      parameters:
        - description: 'スケジュール ID（接頭辞: sched-）'
          in: path
          name: schedule_id
          required: true
          schema:
            example: sched-abc123def456
            title: Schedule Id
            type: string
        - description: '組織 ID（プレフィックス: org-）'
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduleUpdateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduleResponse'
          description: 成功レスポンス
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: バリデーションエラー
components:
  schemas:
    ScheduleUpdateRequest:
      properties:
        agent:
          anyOf:
            - enum:
                - devin
                - data_analyst
              type: string
            - type: 'null'
          title: Agent
        bypass_approval:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Bypass Approval
        enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Enabled
        frequency:
          anyOf:
            - type: string
            - type: 'null'
          title: Frequency
        interval_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Interval Count
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        notify_on:
          anyOf:
            - enum:
                - always
                - failure
                - never
              type: string
            - type: 'null'
          title: Notify On
        platform:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            このスケジュールで生成されるセッションのVMプラットフォーム（例:
            'windows'）。省略した場合、プラットフォームは変更されません。値は組織に設定されているプラットフォームと一致している必要があります（大文字・小文字は区別されません）。不明な値は、利用可能なプラットフォームラベルを一覧表示する400エラーで拒否されます。
          title: Platform
        playbook_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Playbook Id
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
        run_as_user_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            このスケジュールをどのユーザーIDとして実行するかを設定します。ImpersonateOrgSessions権限が必要です。nullに設定すると、デフォルトのボットユーザーに戻ります。フィールドを省略した場合、現在のIDは変更されません。
          title: Run As User Id
        schedule_type:
          anyOf:
            - enum:
                - recurring
                - one_time
              type: string
            - type: 'null'
          title: Schedule Type
        scheduled_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Scheduled At
        slack_channel_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Slack Channel Id
        slack_team_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Slack Team Id
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
        target_devin_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Target Devin Id
      title: ScheduleUpdateRequest
      type: object
    ScheduleResponse:
      properties:
        agent:
          enum:
            - devin
            - data_analyst
          title: Agent
          type: string
        bypass_approval:
          default: false
          title: Bypass Approval
          type: boolean
        consecutive_failures:
          title: Consecutive Failures
          type: integer
        created_at:
          format: date-time
          title: Created At
          type: string
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        enabled:
          title: Enabled
          type: boolean
        frequency:
          anyOf:
            - type: string
            - type: 'null'
          title: Frequency
        interval_count:
          default: 1
          title: Interval Count
          type: integer
        last_edited_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Edited By
        last_error_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Error At
        last_error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Error Message
        last_executed_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Executed At
        name:
          title: Name
          type: string
        notify_on:
          enum:
            - always
            - failure
            - never
          title: Notify On
          type: string
        org_id:
          title: Org Id
          type: string
        platform:
          anyOf:
            - type: string
            - type: 'null'
          title: Platform
        playbook:
          anyOf:
            - $ref: '#/components/schemas/PlaybookInfo'
            - type: 'null'
        prompt:
          title: Prompt
          type: string
        schedule_type:
          default: recurring
          enum:
            - recurring
            - one_time
          title: Schedule Type
          type: string
        scheduled_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Scheduled At
        scheduled_session_id:
          title: Scheduled Session Id
          type: string
        slack_channel_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Slack Channel Id
        slack_team_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Slack Team Id
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
        target_devin_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Target Devin Id
        updated_at:
          format: date-time
          title: Updated At
          type: string
      required:
        - scheduled_session_id
        - org_id
        - created_by
        - name
        - prompt
        - playbook
        - frequency
        - enabled
        - last_executed_at
        - created_at
        - updated_at
        - last_error_at
        - last_error_message
        - consecutive_failures
        - notify_on
        - agent
      title: ScheduleResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    PlaybookInfo:
      properties:
        playbook_id:
          title: Playbook Id
          type: string
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
      required:
        - playbook_id
        - title
      title: PlaybookInfo
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    bearerAuth:
      description: 'サービスユーザーの credential（プレフィックス: cog_）'
      scheme: bearer
      type: http

````