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

# Atualizar Lead

> Atualiza os dados de um lead específico.

## Requisição

<ParamField header="Token" type="string" required>
  Seu token de autenticação.
</ParamField>

### Path Parameters

<ParamField path="id" type="string" required>
  ID do lead a ser atualizado.
</ParamField>

### Body

Envie os campos que deseja atualizar. Todos os campos são opcionais:

<ParamField body="name" type="string">
  Nome do lead.
</ParamField>

<ParamField body="email" type="string">
  E-mail do lead.
</ParamField>

<ParamField body="phone" type="string">
  Telefone do lead.

  <Warning>
    O número deve estar no formato **`5547999999999`** (código do país + DDD + número, sem espaços, traços ou parênteses). Qualquer outro formato causará erros nos disparos via WhatsApp.
  </Warning>
</ParamField>

<ParamField body="taxId" type="string">
  CPF/CNPJ do lead.
</ParamField>

<ParamField body="source" type="string">
  Origem do lead.
</ParamField>

<ParamField body="leadOwner" type="string">
  ID do usuário responsável pelo lead.
</ParamField>

<ParamField body="profileImage" type="string">
  URL da imagem de perfil do lead.
</ParamField>

<ParamField body="zipCode" type="string">
  CEP do endereço.
</ParamField>

<ParamField body="state" type="string">
  Estado.
</ParamField>

<ParamField body="city" type="string">
  Cidade.
</ParamField>

<ParamField body="neighborhood" type="string">
  Bairro.
</ParamField>

<ParamField body="streetAddress" type="string">
  Logradouro.
</ParamField>

<ParamField body="number" type="string">
  Número do endereço.
</ParamField>

<ParamField body="complement" type="string">
  Complemento do endereço.
</ParamField>

<ParamField body="description" type="string">
  Descrição ou observações.
</ParamField>

<ParamField body="leadType" type="string">
  Tipo do lead (ex: `PF`, `PJ`).
</ParamField>

<ParamField body="leadTemperature" type="number">
  Temperatura numérica do lead.
</ParamField>

<ParamField body="metadata" type="object">
  Metadados adicionais do lead em formato JSON.
</ParamField>

<ParamField body="utms" type="object">
  Parâmetros UTM associados ao lead em formato JSON. O objeto enviado deve conter as seguintes propriedades:

  * **`utm_source`** (string): Origem do tráfego (ex: `fb`, `google`, `instagram`).
  * **`utm_medium`** (string): Meio do tráfego (ex: `paid`, `cpc`, `organic`, `story`).
  * **`utm_campaign`** (string): Identificador ou nome da campanha (ex: `120243645529690704`).
  * **`utm_term`** (string): Termo de pesquisa ou identificador de público/anúncio (ex: `120243645529720704`).
  * **`utm_content`** (string): Conteúdo do anúncio ou identificador do criativo (ex: `120247590343130704`).

  **Exemplo:**

  ```json theme={null}
  {
    "utm_source": "fb",
    "utm_medium": "paid",
    "utm_campaign": "120243645529690704",
    "utm_term": "120243645529720704",
    "utm_content": "120247590343130704"
  }
  ```
</ParamField>

<ParamField body="status" type="string">
  Status do lead.
</ParamField>

***

## Resposta

Retorna uma mensagem de sucesso confirmando a atualização.

<ResponseField name="message" type="string">
  Confirma que o lead foi atualizado com sucesso.
</ResponseField>

***

## Exemplos

<RequestExample>
  ```bash PUT /api/v1/lead/{id} theme={null}
  curl --request PUT \
    --url 'https://crm.wavups.com/api/v1/lead/clxyz1234' \
    --header 'Token: SEU_TOKEN_DE_API' \
    --header 'Content-Type: application/json' \
    --data '{
      "leadTemperature": 3,
      "status": "Qualificado",
      "phone": "5511987654321",
      "utms": {
        "utm_source": "fb",
        "utm_medium": "paid",
        "utm_campaign": "120243645529690704",
        "utm_term": "120243645529720704",
        "utm_content": "120247590343130704"
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "Lead updated"
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Lead not found"
  }
  ```

  ```json 500 theme={null}
  {
    "error": "Error to update lead"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml PUT /lead/{id}
openapi: 3.0.3
info:
  title: WavUps CRM API
  description: >-
    API pública da plataforma WavUps CRM — gerencie leads, produtos, categorias,
    atendimentos, agendamentos, conversas e pipelines de CRM.
  version: 1.0.0
servers:
  - url: https://crm.wavups.com/api/v1
    description: Servidor de produção
security:
  - Token: []
paths:
  /lead/{id}:
    put:
      tags:
        - Leads
      summary: Atualizar Lead
      description: Atualiza os dados de um lead específico.
      operationId: updateLeadById
      parameters:
        - $ref: '#/components/parameters/id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateLeadBody'
      responses:
        '200':
          description: Lead atualizado com sucesso.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessMessage'
        '404':
          $ref: '#/components/responses/Error404'
        '500':
          $ref: '#/components/responses/Error500'
components:
  parameters:
    id:
      name: id
      in: path
      required: true
      description: Identificador único do recurso.
      schema:
        type: string
  schemas:
    UpdateLeadBody:
      type: object
      properties:
        name:
          type: string
        email:
          type: string
        phone:
          type: string
          description: >-
            Telefone no formato 5547999999999 (pais + DDD + numero, sem espacos
            ou simbolos).
          example: '5547999999999'
        taxId:
          type: string
          description: CPF ou CNPJ do lead.
          example: '12345678909'
        source:
          type: string
        leadOwner:
          type: string
        profileImage:
          type: string
        zipCode:
          type: string
        state:
          type: string
        city:
          type: string
        neighborhood:
          type: string
        streetAddress:
          type: string
        number:
          type: string
        complement:
          type: string
        description:
          type: string
        leadType:
          type: string
        leadTemperature:
          type: integer
          enum:
            - 1
            - 2
            - 3
          description: 'Temperatura do lead: 1 (Frio), 2 (Morno), 3 (Quente).'
        status:
          type: string
        metadata:
          type: object
          description: Metadados adicionais do lead em formato JSON.
          nullable: true
        utms:
          type: object
          description: Parâmetros UTM associados ao lead em formato JSON.
          nullable: true
          properties:
            utm_source:
              type: string
              description: 'Origem do tráfego (ex: fb, google, instagram).'
              example: fb
            utm_medium:
              type: string
              description: 'Meio do tráfego (ex: paid, cpc, organic, story).'
              example: paid
            utm_campaign:
              type: string
              description: Identificador ou nome da campanha.
              example: '120243645529690704'
            utm_term:
              type: string
              description: Termo de pesquisa ou identificador de público/anúncio.
              example: '120243645529720704'
            utm_content:
              type: string
              description: Conteúdo do anúncio ou identificador do criativo.
              example: '120247590343130704'
    SuccessMessage:
      type: object
      properties:
        message:
          type: string
          example: Operação realizada com sucesso.
    ErrorMessage:
      type: object
      properties:
        error:
          type: string
          example: Recurso não encontrado.
  responses:
    Error404:
      description: Recurso não encontrado.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
    Error500:
      description: Erro interno no servidor.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
  securitySchemes:
    Token:
      type: apiKey
      in: header
      name: Token
      description: Token de autenticacao gerado na plataforma WavUps CRM.

````