Merge

[POST] .../v1/client/merge

Merges CRM clients and sends the ClientMerged webhook with source_client_id and target_client_id after success. Use this destructive workflow method to consolidate duplicate CRM clients after selecting the duplicate source client and the target client that should remain active. The method moves source links in leads, deals, tickets and tasks to the target client, writes merge history with the operator and comment, soft-deletes the source client, writes action log records for target and source, recalculates target client sentiment, sends the ClientMerged webhook and returns row_affected with target and source ids. The request body is required; source_client_id and target_client_id must be positive, must be different and both clients must exist and not be deleted. The caller must have CRM client merge permission; missing body, invalid ids, equal source and target, denied access, missing source or target client, database errors, transaction failures, sentiment recalculation errors and action-log errors are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
comment String Optional Merge operation comment.
source_client_id Int64 Required Source client ID for the duplicate client.
target_client_id Int64 Required Target client ID.

Request Example

{
  "source_client_id": 126,
  "target_client_id": 125,
  "comment": "Merged duplicate clients after import"
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Update Update operation result.

Response Example

{
  "ok": true,
  "result": {
    "row_affected": 1,
    "ids": [
      125,
      126
    ]
  }
}