TratowAPI
API aberta · Clientes

Mesclar clientes

post/api/open/v1/clients/merge

Em resumo

  • POST /api/open/v1/clients/merge
  • Precisa de chave read_write.
  • Obrigatórios: keepId, removeId.
  • Sucesso: 200.
  • Authorizationstringheaderobrigatório

    Chave de API no formato Bearer ttw_live_<prefixo>_<segredo>, criada em Integrações → Chaves de API. Este endpoint precisa de chave read_write.

Corpo

application/json
  • keepIdstring<uuid>obrigatório

    Id de keep (UUID).

  • removeIdstring<uuid>obrigatório

    Id de remove (UUID).

Resposta 200

application/json
  • clientobjectobrigatório

    Cliente.

    Mostrar 23 atributos
    • idstring<uuid>obrigatório

      Identificador único (UUID).

    • namestringobrigatório

      Nome.

    • phoneMobilestringobrigatório

      Celular com DDD (só dígitos; aceita +55). Único entre os clientes ativos.

    • phoneOtherstringpode ser nuloobrigatório

      Outro telefone com DDD.

    • phoneOtherTypeenum<string>pode ser nuloobrigatório

      Valores aceitos:mobilewhatsapphomeworkmessageother

    • emailstringpode ser nuloobrigatório

      E-mail.

    • emailAltstringpode ser nuloobrigatóriopadrão: null

      E-mail alternativo.

    • birthDatestringpode ser nuloobrigatório

      Data de nascimento (AAAA-MM-DD). Sem ano conhecido, use 1900.

    • notesstringpode ser nuloobrigatório

      Observações livres.

    • hasAccountbooleanobrigatóriopadrão: false

      Indica se conta.

    • createdAtstring<date-time>obrigatório

      Data e hora em que foi criado (ISO 8601, UTC).

    • cpfstringpode ser nuloobrigatóriopadrão: null

      CPF (11 dígitos, sem pontuação).

    • cnpjstringpode ser nuloobrigatóriopadrão: null

      CNPJ (14 dígitos, sem pontuação).

    • genderenum<string>pode ser nuloobrigatório

      Gênero.

      Valores aceitos:femalemaleother

    • addressobjectobrigatóriopadrão: {"zipCode":null,"street":null,"number":null,"complement":null,"district":null,"city":null,"state":null}

      Endereço.

      Mostrar 7 atributos
      • zipCodestringpode ser nuloobrigatório

        CEP (8 dígitos).

      • streetstringpode ser nuloobrigatório

        Logradouro.

      • numberstringpode ser nuloobrigatório

        Número.

      • complementstringpode ser nuloobrigatório

        Complemento.

      • districtstringpode ser nuloobrigatório

        Bairro.

      • citystringpode ser nuloobrigatório

        Cidade.

      • statestringpode ser nuloobrigatório

        UF (2 letras).

    • instagramstringpode ser nuloobrigatóriopadrão: null

      Usuário ou URL do Instagram.

    • acquisitionChannelIdstring<uuid>pode ser nuloobrigatório

      Id de captação canal (UUID).

    • communicationobjectobrigatóriopadrão: {"reminders":true,"marketing":false,"emailReminders":true,"emailMarketing":false}
      Mostrar 4 atributos
      • remindersbooleanobrigatório
      • marketingbooleanobrigatório
      • emailRemindersbooleanobrigatório
      • emailMarketingbooleanobrigatório
    • activebooleanobrigatóriopadrão: true

      Ativo (`true`) ou inativo (`false`). Inativos somem das buscas e da agenda.

    • anonymizedAtstring<date-time>pode ser nuloobrigatório

      Data e hora em que foi anonymized (ISO 8601, UTC).

    • tagsobject[]obrigatóriopadrão: []

      Etiquetas.

      Mostrar 3 atributos
      • idstring<uuid>obrigatório

        Identificador único (UUID).

      • namestringobrigatório

        Nome.

      • colorstringobrigatório

        Cor em hexadecimal (#RRGGBB).

    • contactsHiddenbooleanobrigatóriopadrão: false
    • photoUrlstringpode ser nuloobrigatóriopadrão: null

      URL assinada da foto (expira; não guarde).

  • movedobjectobrigatório
    Mostrar 4 atributos
    • appointmentsintegerobrigatório

      Agendamentos.

      -9007199254740991 a 9007199254740991

    • notesintegerobrigatório

      Observações livres.

      -9007199254740991 a 9007199254740991

    • formResponsesintegerobrigatório

      -9007199254740991 a 9007199254740991

    • tagsintegerobrigatório

      Etiquetas.

      -9007199254740991 a 9007199254740991

curl --request POST \  --url 'https://qa-tratow.ips.app.br/api/open/v1/clients/merge' \  --header 'Authorization: Bearer <chave>' \  --header 'Content-Type: application/json' \  --data '{    "keepId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "removeId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d"  }'
Resposta
{  "client": {    "id": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "name": "Maria Lima",    "phoneMobile": "11987654321",    "phoneOther": "1133334444",    "phoneOtherType": "mobile",    "email": "texto",    "emailAlt": null,    "birthDate": "2026-11-03",    "notes": "Prefere atendimento pela manhã.",    "hasAccount": false,    "createdAt": "2026-11-03T17:30:00.000Z",    "cpf": null,    "cnpj": null,    "gender": "female",    "address": {      "zipCode": null,      "street": null,      "number": null,      "complement": null,      "district": null,      "city": null,      "state": null    },    "instagram": null,    "acquisitionChannelId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "communication": {      "reminders": true,      "marketing": false,      "emailReminders": true,      "emailMarketing": false    },    "active": true,    "anonymizedAt": "2026-11-03T17:30:00.000Z",    "tags": [],    "contactsHidden": false,    "photoUrl": null  },  "moved": {    "appointments": 1,    "notes": 1,    "formResponses": 1,    "tags": 1  }}

Os valores são ilustrativos.