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

# Atualização de tarefa

> Atualiza uma tarefa existente via integração externa. Em tarefas recorrentes, `recurrence_scope` define se a alteração afeta apenas a ocorrência atual, futuras, abertas ou toda a série.




## OpenAPI

````yaml /openapi.json put /integrations/external/tasks/{id}
openapi: 3.0.3
info:
  title: >-
    Integração Externa - Leads, Oportunidades, Tarefas, Arquivos, Propostas,
    Chats, Satisfação e Campos Personalizados
  version: 1.0.0
  description: >
    Documentação oficial da API externa da Wegly para campos personalizados,
    leads, oportunidades, tarefas, arquivos, propostas, chats e satisfação
    (`/integrations/external/custom-fields`, `/integrations/external/files`,
    `/integrations/external/leads`, `/integrations/external/deals`,
    `/integrations/external/tasks`, `/integrations/external/proposals`,
    `/integrations/external/chats` e `/integrations/external/satisfaction`).
    Todas as descrições estão em português e refletem as regras aplicadas pelo
    serviço.
servers:
  - url: https://api.wegly.com.br
    description: Ambiente de produção Wegly
security:
  - bearerAuth: []
tags:
  - name: Campos Personalizados
    description: >-
      Consulta dos campos personalizados disponíveis para uso nas integrações
      externas.
  - name: Arquivos
    description: >-
      Upload de arquivos públicos de integração vinculados diretamente a leads
      ou oportunidades.
  - name: Leads
    description: >-
      Operações de listagem, criação, consulta e atualização de leads via
      integração externa.
  - name: Oportunidades
    description: Operações de criação de oportunidades (deals) via integração externa.
  - name: Tarefas
    description: >-
      Operações de listagem, criação, consulta, atualização e remoção de tarefas
      vinculadas a leads, oportunidades, entregas, pessoas ou organizações.
  - name: Satisfação
    description: >-
      Geração de links públicos para formulários de satisfação via integração
      externa.
  - name: Propostas
    description: >-
      Operações de listagem, criação, consulta, atualização e remoção de
      propostas via integração externa.
  - name: Chats
    description: >-
      Operações principais de listagem, criação, consulta e resumo de não lidas
      de chats via integração externa.
paths:
  /integrations/external/tasks/{id}:
    put:
      tags:
        - Tarefas
      summary: Atualização de tarefa
      description: >
        Atualiza uma tarefa existente via integração externa. Em tarefas
        recorrentes, `recurrence_scope` define se a alteração afeta apenas a
        ocorrência atual, futuras, abertas ou toda a série.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: UUID da tarefa.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateExternalTask'
            examples:
              remarcar:
                summary: Remarcar tarefa
                value:
                  title: Reunião de kick-off atualizada
                  start_date: '2026-03-06T14:00:00.000Z'
                  end_date: '2026-03-06T15:00:00.000Z'
                  has_time: true
                  recurrence_scope: only_this
              concluir:
                summary: Concluir tarefa
                value:
                  is_completed: true
                  completed_at: '2026-03-06T15:00:00.000Z'
      responses:
        '200':
          description: Tarefa atualizada com sucesso.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalTask'
        '400':
          description: >-
            Payload inválido, conflito de dados, escopo de recorrência inválido
            ou regra de agenda não atendida.
        '401':
          description: Token de integração ausente ou inválido.
        '403':
          description: >-
            Permissão `crm/task.update` ausente ou domínio de origem não
            autorizado na chave.
        '404':
          description: Tarefa, tipo, etapa, responsável ou vínculo não encontrado.
components:
  schemas:
    UpdateExternalTask:
      type: object
      description: >-
        Payload parcial de atualização. Todos os campos são opcionais;
        `recurrence_scope`, `completed_at` e `is_completed` controlam
        recorrência e conclusão.
      properties:
        crm_task_type_id:
          type: string
          format: uuid
        crm_task_stage_id:
          type: string
          format: uuid
        responsible_id:
          type: string
          format: uuid
        crm_lead_id:
          type: string
          format: uuid
          description: Vincula a tarefa a um lead.
        crm_deal_id:
          type: string
          format: uuid
          description: Vincula a tarefa a uma oportunidade.
        crm_delivery_id:
          type: string
          format: uuid
          description: Vincula a tarefa a uma entrega.
        crm_person_id:
          type: string
          format: uuid
        crm_organization_id:
          type: string
          format: uuid
        priority:
          $ref: '#/components/schemas/ExternalTaskPriority'
        title:
          type: string
          maxLength: 100
        description:
          type: string
        mentions:
          type: array
          items:
            $ref: '#/components/schemas/ExternalTaskMentionRequest'
        start_date:
          type: string
          format: date-time
          nullable: true
        end_date:
          type: string
          format: date-time
          nullable: true
        has_time:
          type: boolean
        recurrence:
          $ref: '#/components/schemas/ExternalTaskRecurrenceRequest'
        meeting_outcome:
          type: integer
          enum:
            - 1
            - 2
            - 3
            - 4
        meeting_outcome_notes:
          type: string
        is_personal:
          type: boolean
        create_meeting:
          type: boolean
        create_event:
          type: boolean
        create_online_meeting_link:
          type: boolean
        meeting_provider:
          $ref: '#/components/schemas/ExternalTaskMeetingProvider'
        meeting_participants:
          type: array
          items:
            type: string
            format: email
        reminders_minutes:
          type: array
          items:
            type: integer
            minimum: 1
        recurrence_scope:
          $ref: '#/components/schemas/ExternalTaskRecurrenceScope'
        completed_at:
          type: string
          format: date-time
        is_completed:
          type: boolean
    ExternalTask:
      type: object
      properties:
        id:
          type: string
          format: uuid
        title:
          type: string
        description:
          type: string
          nullable: true
        is_personal:
          type: boolean
        priority:
          $ref: '#/components/schemas/ExternalTaskPriority'
        start_date:
          type: string
          format: date-time
          nullable: true
        end_date:
          type: string
          format: date-time
          nullable: true
        has_time:
          type: boolean
        completed_at:
          type: string
          format: date-time
          nullable: true
        meeting_outcome:
          type: integer
          enum:
            - 1
            - 2
            - 3
            - 4
          nullable: true
        meeting_outcome_notes:
          type: string
          nullable: true
        ai_processed:
          type: boolean
        ai_status:
          type: integer
          nullable: true
        ai_error_log:
          type: string
          nullable: true
        ai_last_action:
          type: integer
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        crm_task_type_id:
          type: string
          format: uuid
        crm_task_stage_id:
          type: string
          format: uuid
        crm_lead_id:
          type: string
          format: uuid
          nullable: true
        crm_deal_id:
          type: string
          format: uuid
          nullable: true
        crm_delivery_id:
          type: string
          format: uuid
          nullable: true
        crm_person_id:
          type: string
          format: uuid
          nullable: true
        crm_organization_id:
          type: string
          format: uuid
          nullable: true
        recurrence_series_id:
          type: string
          format: uuid
          nullable: true
        recurrence_index:
          type: integer
          nullable: true
        recurrence_is_exception:
          type: boolean
        is_recurring:
          type: boolean
        recurrence:
          $ref: '#/components/schemas/ExternalTaskRecurrenceResponse'
        responsible_id:
          type: string
          format: uuid
          nullable: true
        created_by:
          type: object
          allOf:
            - $ref: '#/components/schemas/ExternalUserSummary'
          nullable: true
        completed_by:
          type: object
          allOf:
            - $ref: '#/components/schemas/ExternalUserSummary'
          nullable: true
        responsible:
          type: object
          allOf:
            - $ref: '#/components/schemas/ExternalUserSummary'
          nullable: true
        crm_task_type:
          type: object
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
            icon:
              type: string
            is_meeting:
              type: boolean
        crm_task_stage:
          type: object
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
            color:
              type: string
            is_completion:
              type: boolean
            position:
              type: integer
        crm_lead:
          type: object
          nullable: true
          properties:
            id:
              type: string
              format: uuid
            title:
              type: string
            code:
              oneOf:
                - type: string
                - type: integer
        crm_deal:
          type: object
          nullable: true
          properties:
            id:
              type: string
              format: uuid
            title:
              type: string
            code:
              oneOf:
                - type: string
                - type: integer
        crm_delivery:
          type: object
          nullable: true
          properties:
            id:
              type: string
              format: uuid
            title:
              type: string
            code:
              oneOf:
                - type: string
                - type: integer
            status:
              type: integer
        crm_person:
          type: object
          nullable: true
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
        crm_organization:
          type: object
          nullable: true
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
            legal_name:
              type: string
              nullable: true
        mentions:
          type: array
          items:
            $ref: '#/components/schemas/ExternalTaskMentionResponse'
        recordings:
          type: array
          items:
            type: object
            properties:
              recording_url:
                type: string
                nullable: true
              transcription_url:
                type: string
                nullable: true
              duration:
                type: integer
        reminders_minutes:
          type: array
          items:
            type: integer
        meeting_link:
          type: string
        meeting_participants:
          type: array
          items:
            type: string
            format: email
        meeting_provider:
          type: string
          allOf:
            - $ref: '#/components/schemas/ExternalTaskMeetingProvider'
          nullable: true
        provider:
          type: string
          allOf:
            - $ref: '#/components/schemas/ExternalTaskMeetingProvider'
          nullable: true
        sync_warning:
          type: string
    ExternalTaskPriority:
      type: integer
      enum:
        - 0
        - 1
        - 2
        - 3
      description: 'Prioridade da tarefa: 0 baixa, 1 normal, 2 alta, 3 urgente.'
    ExternalTaskMentionRequest:
      type: object
      required:
        - mentioned_id
      properties:
        mentioned_id:
          type: string
          format: uuid
        delete:
          type: boolean
          description: Usado apenas na atualização para remover a menção.
    ExternalTaskRecurrenceRequest:
      type: object
      properties:
        pattern:
          type: string
          enum:
            - every_n_days
            - weekly
        interval:
          type: integer
          minimum: 1
          default: 1
        week_days:
          type: array
          items:
            type: string
            enum:
              - sunday
              - monday
              - tuesday
              - wednesday
              - thursday
              - friday
              - saturday
        end_type:
          type: string
          enum:
            - none
            - until_date
        until_date:
          type: string
          format: date-time
    ExternalTaskMeetingProvider:
      type: string
      enum:
        - teams_integration
        - google_calendar_integration
      description: Provedor de reunião online usado pela tarefa.
    ExternalTaskRecurrenceScope:
      type: string
      enum:
        - only_this
        - this_and_future
        - open_only
        - all
      description: Escopo aplicado em edições ou remoções de tarefas recorrentes.
    ExternalTaskRecurrenceResponse:
      type: object
      nullable: true
      properties:
        id:
          type: string
          format: uuid
        pattern:
          type: string
          enum:
            - every_n_days
            - weekly
        interval:
          type: integer
        week_days:
          type: array
          items:
            type: string
            enum:
              - sunday
              - monday
              - tuesday
              - wednesday
              - thursday
              - friday
              - saturday
        end_type:
          type: string
          enum:
            - none
            - until_date
        start_date:
          type: string
          format: date-time
        end_date:
          type: string
          format: date-time
          nullable: true
        until_date:
          type: string
          format: date-time
          nullable: true
        index:
          type: integer
          nullable: true
        is_exception:
          type: boolean
    ExternalUserSummary:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        avatar:
          type: string
          nullable: true
    ExternalTaskMentionResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        mentioned:
          type: object
          allOf:
            - $ref: '#/components/schemas/ExternalUserSummary'
          nullable: true
        mentioned_by:
          type: object
          allOf:
            - $ref: '#/components/schemas/ExternalUserSummary'
          nullable: true
        created_at:
          type: string
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Utilize o token de integração no header `Authorization: Bearer {token}`.
        O domínio de origem (Origin/Referer) deve respeitar `allowed_domain`,
        quando configurado na chave.

````