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

# Atualizar lead



## OpenAPI

````yaml https://api.datacrazy.io/v1/api/openapi/v1/json patch /api/v1/leads/{id}
openapi: 3.0.0
info:
  title: API CRM Datacrazy
  description: Versão 1.0 da API do CRM Datacrazy
  version: '1.0'
  contact: {}
servers:
  - url: https://api.g1.datacrazy.io
security: []
tags: []
paths:
  /api/v1/leads/{id}:
    patch:
      tags:
        - Leads
      summary: Atualizar lead
      operationId: LeadsV1Controller_update
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUpdateLeadDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadDto'
      security:
        - access-token: []
components:
  schemas:
    CreateUpdateLeadDto:
      type: object
      properties:
        name:
          type: string
          example: Guilherme Gavazzoni
          description: Array de ID de tags
        image:
          type: string
          example: >-
            https://dc-qqqq2222pb.s3.amazonaws.com/0a7ac87c-2f50-46b5-9c39-80ffec53e633/1163f5c2-62f4-443f-a84f-9c223b05ae3b
          description: Url da Imagem do lead
        phone:
          type: string
          example: +55 (47) 991331190
          description: Telefone do lead
        email:
          type: string
          example: guilherme@datacrazy.com.br
          description: Email do lead
        source:
          type: string
          example: Google ads
          description: Origem do lead
        company:
          type: string
          example: Apple
          description: Empresa do lead
        taxId:
          type: string
          example: 108.154.702-92
          description: Documento de identificação
        site:
          type: string
          example: www.meulead.com.br
          description: Site do lead
        instagram:
          type: string
          example: '@guilhermegavazzoni'
          description: Instagram do lead
        address:
          example:
            zip: 88338-130
            address: Avenida Brasil
            block: Centro
            city: Balneário Camboriú
            state: SC
            country: BR
          description: Endereço vinculado ao lead
          allOf:
            - $ref: '#/components/schemas/LeadAddressDto'
        sourceReferral:
          description: Fonte de referencia do lead
          allOf:
            - $ref: '#/components/schemas/SourceReferralDto'
        tags:
          description: Array de ID de tags
          type: array
          items:
            $ref: '#/components/schemas/JustIdDto'
        lists:
          description: Array de ID de listas
          type: array
          items:
            $ref: '#/components/schemas/JustIdDto'
        attendant:
          description: ID do atendente
          allOf:
            - $ref: '#/components/schemas/JustIdStringDto'
        notes:
          description: Notas
          allOf:
            - $ref: '#/components/schemas/JustIdStringDto'
    LeadDto:
      type: object
      properties:
        id:
          type: string
          example: 15b41959-b04d-4a99-b878-6e45fffa7633
          description: Id do lead
        createdAt:
          format: date-time
          type: string
          example: '2025-06-11T18:31:25.203Z'
          description: Data de criação do lead
        name:
          type: string
          example: Guilherme Gavazzoni
          description: Nome do lead
        image:
          type: string
          example: >-
            https://dc-qqqq2222pb.s3.amazonaws.com/0a7ac87c-2f50-46b5-9c39-80ffec53e633/1163f5c2-62f4-443f-a84f-9c223b05ae3b
          description: Url da Imagem do lead
        phone:
          type: string
          example: +55 (47) 991331190
          description: Telefone do lead
        rawPhone:
          type: string
          example: '5547991331190'
          description: Telefone do lead (apenas números)
        email:
          type: string
          example: guilherme@datacrazy.com.br
          description: Email do lead
        source:
          type: string
          example: Google ads
          description: Origem do lead
        company:
          type: string
          example: Apple
          description: Empresa do lead
        taxId:
          type: string
          example: 108.154.702-92
          description: Documento de identificação
        site:
          type: string
          example: www.meulead.com.br
          description: Site do lead
        instagram:
          type: string
          example: '@guilhermegavazzoni'
          description: Instagram do lead
        address:
          example:
            zip: 88338-130
            address: Avenida Brasil
            block: Centro
            city: Balneário Camboriú
            state: SC
            country: BR
          description: Endereço vinculado ao lead
          allOf:
            - $ref: '#/components/schemas/LeadAddressDto'
        tags:
          example:
            id: 849fefab-e697-4720-9303-e788c23790cc
            name: IA
            color: '#DC2626'
            description: Leads IA
            createdAt: '2025-06-12T17:37:17.861Z'
          description: ID das tags atreladas ao lead
          allOf:
            - $ref: '#/components/schemas/TagDto'
        lists:
          example:
            - id: 5343afav-e697-4720-9303-e788c23711dd
              name: ativos
              color: '#EB2626'
              description: lista de compradores recorrentes
              createdAt: '2025-06-12T17:37:17.861Z'
            - id: f2b3c92d-3843-406f-a3e3-672d2d7d2a27
              name: inativos
              color: '#EB2626'
              description: lista de compradores de baixa frequência
              createdAt: 2025-12-03T17:28:09:5361Z
          description: Array de listas atreladas ao lead
          type: array
          items:
            type: string
        contacts:
          example:
            - platform: EMAIL
              contactId: 853b46db8ae664237d89dd6
              lastContactStatus: null
            - platform: WHATSAPP
              contactId: '555491664460'
              lastContactStatus:
                platform: WHATSAPP
                contactId: '555491664460'
                instanceId: 681bb0510fe99d126e7c6b7b
                isPending: true
                lastReceivedMessage:
                  messageId: 684c13db8ae7797307d83cc3
                  date: '2025-06-13T12:04:48.218Z'
                  errorCode: null
                lastSendedMessage:
                  messageId: 684c13c28ae7797307d83bc4
                  date: '2025-06-13T12:04:23.511Z'
                  errorCode: null
          description: Array de contatos atrelados ao lead
          allOf:
            - $ref: '#/components/schemas/LeadContactDto'
        metrics:
          example:
            purchaseCount: 1
            lastPurchaseDate: '2025-06-04T19:34:55.535Z'
            averageTicket: 14040
            totalSpent: 21080
            openBusinessesCount: 4
            lostBusinessesCount: 1
            lostBusinessesTotalValue: 7800
            purchaseFrequency: 3
          description: Métricas referentes ao lead
          allOf:
            - $ref: '#/components/schemas/LeadMetricsDto'
        attendant:
          description: Atual atendente do lead
          example:
            userId: 86BshEbu5WY94ZOB8beUvk1y7tF2
            id: 6cc8c79c-a0c8-4293-a4a0-d7e730aff7c7
            name: Joao da Silva
            email: joao@hotmail..com
            phone: '554791331190'
            image: >-
              https://dc-qqqq2222pb.s3.amazonaws.com/d129a692-e5ab-42b3-b0e4-90ad9a12b068/b1d045df-3a26-4e54-8d3f-7df4df5e2f08
          allOf:
            - $ref: '#/components/schemas/AttendantDto'
        sourceReferral:
          description: Fonte de referencia do lead
          allOf:
            - $ref: '#/components/schemas/SourceReferralDto'
    LeadAddressDto:
      type: object
      properties:
        zip:
          type: string
          description: Código postal do lead
        address:
          type: string
          description: Endereço do lead
        block:
          type: string
          description: Bairro do lead
        city:
          type: string
          description: Cidade do lead
        state:
          type: string
          description: Estado do lead
        country:
          type: string
          description: País do lead
        number:
          type: string
          description: Número da residência do lead
    SourceReferralDto:
      type: object
      properties:
        sourceId:
          type: string
          description: ID referente fonte
          example: 2bc3d979-93a4-4e64-8903-5d9379d3de91
        sourceUrl:
          type: string
          description: Url referente fonte
          example: https://example.com/artigo-de-origem
        ctwaId:
          type: string
          description: CTWA referente (Click to WhatsApp ID)
          example: 849fefab-e697-4720-9303-e788c23790cc
    JustIdDto:
      type: object
      properties:
        id:
          type: array
          items:
            type: string
    JustIdStringDto:
      type: object
      properties:
        id:
          type: string
    TagDto:
      type: object
      properties:
        id:
          type: string
          description: ID da tag
          example: cb3e8d24-ccad-43d1-acd5-08580d9bc674
        name:
          type: string
          description: Nome da tag
          example: marketing orgânico
        color:
          type: string
          description: Cor da tag em hexadecimal
          example: '#A78BFA'
        description:
          type: string
          description: Descrição atribuída a tag
          example: Leads que vieram de campanhas internas
        createdAt:
          format: date-time
          type: string
          description: Data de cricão da tag
          example: '2025-03-25T14:12:47.738Z'
    LeadContactDto:
      type: object
      properties: {}
    LeadMetricsDto:
      type: object
      properties:
        purchaseCount:
          type: number
          description: Quantidade de compras realizadas pelo lead
        lastPurchaseDate:
          format: date-time
          type: string
          description: Data da ultima compra realizada
        averageTicket:
          type: number
          description: Ticket médio
        totalSpent:
          type: number
          description: Total gasto
        openBusinessesCount:
          type: number
          description: Quantiade de negócios em aberto
        lostBusinessesCount:
          type: number
          description: Quantidade de negócios perdidos
        lostBusinessesTotalValue:
          type: number
          description: Valor total dos negócios perdidos
        purchaseFrequency:
          type: number
          description: Frequência de compra
    AttendantDto:
      type: object
      properties:
        userId:
          type: string
          description: ID do usuário
          example: t9kn9mqPakdGG535GQK3hod8wzM2
        id:
          type: string
          description: ID do usuário como atendente (ID do atendente)
          example: 6807e48c25ece34f9f1ba7dd
        name:
          type: string
          description: Nome do atendente
          example: Joao Silva
        email:
          type: string
          description: Email do atendente
          example: joaosilva@gmail.com
        phone:
          type: string
          description: Telefone do atendente
          example: '5547991331190'
        imageURL:
          type: string
          description: Url da imagem do atendente
          example: >-
            https://dc-qqqq1111pb.s3.amazonaws.com/profiles/koQGLa8p68fNZiiSmE1tec2LHtc2_2025-05-24T00%3A27%3A23.486Z
  securitySchemes:
    access-token:
      scheme: bearer
      bearerFormat: JWT
      type: http

````