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

# Alterar contato

> Altera um contato pelo id

Envie só o que muda. `tags` substitui a lista inteira, e `custom_fields` segue as mesmas regras de [Criar ou atualizar contato](https://docs.useintegra.com.br/api-reference/endpoint/crm-upsert-contact.md#colunas-personalizadas).

Trocar o telefone para um número que já é de outro contato da organização responde `409`.


## OpenAPI

````yaml PATCH /api/v1/crm/contacts/{id}
openapi: 3.1.0
info:
  title: Integra BFI API
  version: 1.0.0
  description: >
    <img src="/public/logo_dark.webp" alt="Integra" height="36"
    style="margin-bottom:16px" />


    A API da Integra para integrações externas.


    > [!tip]

    > **Copie a documentação completa para sua IA favorita:**

    > [Abrir página de cópia](/docs/markdown) ou baixe o [llm.txt](/llm.txt)


    ---


    ## Como começar


    ### 1. Gerar sua API Key


    Acesse o painel da Integra em **Settings > API Keys** e clique em **Nova API
    Key**.


    > [!important]

    > Copie a key gerada (`ik_live_...`) imediatamente: ela **só será exibida
    uma vez**.


    ### 2. Autenticar requests


    Envie o header `Authorization` em todas as chamadas:


    ```

    Authorization: Bearer ik_live_sua_key_aqui

    ```


    ### 3. Fazer sua primeira chamada


    ```bash

    curl -H "Authorization: Bearer ik_live_xxx" \
      https://api.useintegra.com.br/api/v1/campaigns
    ```


    > [!success]

    > Se a resposta for `200 OK` com JSON, sua integração está funcionando!


    ---


    ## Rate Limiting


    | Header | Descrição |

    |--------|-----------|

    | `X-RateLimit-Limit` | Limite total (60/min) |

    | `X-RateLimit-Remaining` | Requests restantes |

    | `X-RateLimit-Reset` | Timestamp de reset (epoch) |


    > [!warning]

    > Ao exceder **60 requests/minuto** por API Key, a API retorna status `429
    Too Many Requests`.


    ---


    ## Erros comuns


    | Status | Erro | Causa |

    |--------|------|-------|

    | `401` | Invalid API key | Key inválida ou revogada |

    | `403` | Forbidden | Key sem permissão para o recurso |

    | `429` | Rate limit exceeded | Excedeu 60 req/min |

    | `500` | Internal server error | Erro interno, contate o suporte |
servers:
  - url: https://api.useintegra.com.br
    description: Production
security:
  - ApiKey: []
tags:
  - name: Campaigns
    description: Gerenciamento de campanhas de voz e WhatsApp
  - name: Calls
    description: Histórico de chamadas
  - name: CRM
    description: 'CRM Integra da organização: funis, contatos, negócios e atividades'
  - name: Automations
    description: Dispara as automações com o gatilho Chamada pela nossa API
  - name: Meetings
    description: Reuniões que os agentes marcaram na agenda da organização
  - name: Webhooks
    description: Gerenciamento de webhooks para notificações em tempo real
paths:
  /api/v1/crm/contacts/{id}:
    patch:
      tags:
        - CRM
      summary: Alterar um contato
      parameters:
        - schema:
            type: string
            description: ID do contato (UUID)
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CrmContactUpdate'
      responses:
        '200':
          description: O contato alterado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrmContact'
        '400':
          description: >-
            Campo inválido, corpo vazio, telefone fora do E.164 ou campo
            personalizado inválido
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '401':
          description: Não autenticado
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '403':
          description: A chave não tem o escopo crm:write
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '404':
          description: Não encontrado
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '409':
          description: >-
            O CRM está desligado, ou outro contato da organização já tem este
            telefone
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
      security:
        - ApiKey: []
components:
  schemas:
    CrmContactUpdate:
      type: object
      properties:
        phone:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 40
          description: >-
            Telefone em E.164, com o + e o código do país (+5511987654321).
            Espaço, parênteses, ponto e traço são aceitos e saem. Celular
            brasileiro sem o 9º dígito ganha o 9
          example: '+5511987654321'
        name:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 160
          description: Nome; null tira
        email:
          type:
            - string
            - 'null'
          maxLength: 254
          pattern: ^[^\s@]+@[^\s@]+\.[^\s@]+$
          example: ana@clinica.com.br
        company:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 160
          description: >-
            Nome da empresa: a de mesmo nome (sem diferença de maiúscula) ou uma
            nova. null tira a empresa do contato
        tags:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 40
          maxItems: 30
          description: >-
            Até 30 tags, cada uma com até 40 caracteres; a repetida sai.
            Substitui a lista inteira
          example:
            - vip
        custom_fields:
          type: object
          additionalProperties:
            anyOf:
              - type: string
                maxLength: 500
              - type: number
              - type: boolean
              - type: 'null'
              - type: 'null'
          description: >-
            Campos personalizados (os criados no painel, em CRM >
            Configurações), pela chave: texto (até 500), número, data
            (AAAA-MM-DD), uma das opções da seleção ou true/false. null tira o
            valor. As chaves que não vierem ficam como estão
          example:
            convenio: Unimed
        legal_basis:
          type:
            - string
            - 'null'
          enum:
            - consent
            - legitimate_interest
            - contract
            - legal_obligation
          description: >-
            Base legal (LGPD): consent, legitimate_interest, contract ou
            legal_obligation
        opt_out:
          type: boolean
          description: 'true: não quer ser contatado (a campanha pula); false desfaz'
      additionalProperties: false
    CrmContact:
      type: object
      properties:
        id:
          type: string
        name:
          type:
            - string
            - 'null'
        email:
          type:
            - string
            - 'null'
        phone:
          type:
            - string
            - 'null'
          description: E.164 (nulo no contato só do Instagram ou do Messenger)
        company:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
            name:
              type: string
          required:
            - id
            - name
        source:
          type: string
          enum:
            - manual
            - import
            - api
            - assistant
            - call
            - whatsapp
            - instagram
            - messenger
            - campaign
          description: >-
            De onde veio: manual, import, api, assistant, call, whatsapp,
            instagram, messenger ou campaign
        tags:
          type: array
          items:
            type: string
        custom_fields:
          type: object
          additionalProperties:
            anyOf:
              - type: string
              - type: number
              - type: boolean
        legal_basis:
          type:
            - string
            - 'null'
          enum:
            - consent
            - legitimate_interest
            - contract
            - legal_obligation
          description: Base legal (LGPD)
        opt_out:
          type: boolean
          description: Não quer ser contatado (a campanha pula)
        opt_out_at:
          type:
            - string
            - 'null'
          description: Desde quando
          example: '2026-11-02T14:00:00.000Z'
        last_interaction_at:
          type:
            - string
            - 'null'
          description: Última ligação ou conversa
          example: '2026-11-02T14:00:00.000Z'
        created_at:
          type: string
          description: Criação (UTC)
          example: '2026-11-02T14:00:00.000Z'
        updated_at:
          type: string
          description: Última mudança (UTC)
          example: '2026-11-02T14:00:00.000Z'
      required:
        - id
        - name
        - email
        - phone
        - company
        - source
        - tags
        - custom_fields
        - legal_basis
        - opt_out
        - opt_out_at
        - last_interaction_at
        - created_at
        - updated_at
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'API Key da organização (Authorization: Bearer ik_live_xxx)'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.