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

# Atualizar agendamento

> Atualiza um agendamento existente.

<div id="permissions">
  ## Permissões
</div>

Requer um usuário de serviço com a permissão `ManageOrgSchedules` no nível da organização.

<div id="notes">
  ## Notas
</div>

Todos os campos são opcionais. Somente os campos fornecidos no corpo da requisição serão atualizados. Para desativar um agendamento, defina `enabled` como `false`.

Definir `playbook_id` como `null` removerá a associação com o playbook.

Você pode alterar o `schedule_type` entre `recurring` e `one_time`. Ao mudar para `one_time`, forneça `scheduled_at` com uma data e hora futuras no formato ISO 8601. Ao mudar para `recurring`, forneça `frequency` com uma expressão cron válida.

<div id="execution-identity">
  ## Identidade de execução
</div>

O parâmetro `run_as_user_id` controla com qual identidade de usuário o agendamento é executado. Quando um agendamento é acionado, as sessões são criadas com esse usuário — ele recebe notificações e a sessão aparece em seu histórico.

* **Definir um usuário**: Forneça um ID de usuário válido para alterar a identidade de execução. Isso requer:
  1. O usuário de serviço deve ter a permissão `ImpersonateOrgSessions`
  2. O usuário de destino deve ser membro da organização
  3. O usuário de destino deve ter a permissão `UseDevinSessions`
* **Limpar (definir como `null`)**: Faz o agendamento voltar a ser executado como o usuário bot padrão
* **Omitir o campo**: Mantém a identidade de execução atual inalterada


## OpenAPI

````yaml pt-BR/v3-openapi.json PATCH /v3/organizations/{org_id}/schedules/{schedule_id}
openapi: 3.1.0
info:
  description: API Devin v3 com autenticação de usuário de serviço e RBAC
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3/organizations/{org_id}/schedules/{schedule_id}:
    patch:
      tags:
        - schedules
      summary: Atualizar agendamento
      description: Atualiza um agendamento existente.
      operationId: >-
        handle_update_schedule_v3_organizations__org_id__schedules__schedule_id__patch
      parameters:
        - description: 'ID do agendamento (prefixo: sched-)'
          in: path
          name: schedule_id
          required: true
          schema:
            example: sched-abc123def456
            title: Schedule Id
            type: string
        - description: 'ID da organização (prefixo: 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: Resposta bem-sucedida
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Erro de validação
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: >-
            Plataforma de VM para sessões iniciadas por esta programação (por
            exemplo, 'windows'). Quando omitido, a plataforma permanece
            inalterada. O valor deve corresponder a uma plataforma configurada
            para a organização (sem diferenciar maiúsculas de minúsculas);
            valores desconhecidos são rejeitados com um 400 que lista os rótulos
            de plataforma disponíveis.
          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: >-
            Define o ID de usuário com o qual esta programação será executada.
            Requer a permissão ImpersonateOrgSessions. Definir como null reverte
            para o usuário bot padrão. Omitir o campo mantém a identidade atual
            inalterada.
          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: 'Credencial de usuário de serviço (prefixo: cog_)'
      scheme: bearer
      type: http

````