Customers
Merge Customer
Merges a duplicate customer into this one. Send the duplicate’s ID as loser_id.
POST
/
api
/
v1
/
contacts
/
{contact_id}
/
merge
Merge Customer
curl --request POST \
--url https://app.chatflows.io/api/v1/contacts/{contact_id}/merge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"loser_id": 2
}'import requests
url = "https://app.chatflows.io/api/v1/contacts/{contact_id}/merge"
payload = { "loser_id": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({loser_id: 2})
};
fetch('https://app.chatflows.io/api/v1/contacts/{contact_id}/merge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.chatflows.io/api/v1/contacts/{contact_id}/merge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'loser_id' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.chatflows.io/api/v1/contacts/{contact_id}/merge"
payload := strings.NewReader("{\n \"loser_id\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.chatflows.io/api/v1/contacts/{contact_id}/merge")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"loser_id\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatflows.io/api/v1/contacts/{contact_id}/merge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"loser_id\": 2\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 1,
"first_name": "Jane",
"last_name": "Doe",
"display_name": "Jane Doe",
"phone": "+919876543210",
"email": "[email protected]",
"type": "lead",
"is_active": true,
"contact_status_id": 1,
"contact_source_id": 1,
"group_ids": [
1
],
"label_ids": [
1
],
"custom_fields": {
"company": "Acme"
},
"created_at": "2026-06-27T10:00:00+00:00",
"updated_at": "2026-06-27T10:00:00+00:00"
}
}{
"message": "Missing API token.",
"error_code": "unauthenticated",
"status": 401
}{
"message": "Subscription required or expired.",
"error_code": "subscription_required",
"status": 402
}{
"message": "This token is missing the required scope: contacts:write.",
"error_code": "insufficient_scope",
"status": 403
}{
"message": "Cannot merge a contact into itself.",
"error_code": "invalid_merge",
"status": 422
}{
"message": "API request quota exhausted for this billing period.",
"error_code": "quota_exhausted",
"status": 429
}The duplicate’s conversations, tags, groups and customer field values move to this customer, and the duplicate is removed. Returns the merged customer.
Returns
422 with invalid_merge if either customer is already merged, or if both IDs are the same.Authorizations
⌘I
Merge Customer
curl --request POST \
--url https://app.chatflows.io/api/v1/contacts/{contact_id}/merge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"loser_id": 2
}'import requests
url = "https://app.chatflows.io/api/v1/contacts/{contact_id}/merge"
payload = { "loser_id": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({loser_id: 2})
};
fetch('https://app.chatflows.io/api/v1/contacts/{contact_id}/merge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.chatflows.io/api/v1/contacts/{contact_id}/merge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'loser_id' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.chatflows.io/api/v1/contacts/{contact_id}/merge"
payload := strings.NewReader("{\n \"loser_id\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.chatflows.io/api/v1/contacts/{contact_id}/merge")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"loser_id\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatflows.io/api/v1/contacts/{contact_id}/merge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"loser_id\": 2\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 1,
"first_name": "Jane",
"last_name": "Doe",
"display_name": "Jane Doe",
"phone": "+919876543210",
"email": "[email protected]",
"type": "lead",
"is_active": true,
"contact_status_id": 1,
"contact_source_id": 1,
"group_ids": [
1
],
"label_ids": [
1
],
"custom_fields": {
"company": "Acme"
},
"created_at": "2026-06-27T10:00:00+00:00",
"updated_at": "2026-06-27T10:00:00+00:00"
}
}{
"message": "Missing API token.",
"error_code": "unauthenticated",
"status": 401
}{
"message": "Subscription required or expired.",
"error_code": "subscription_required",
"status": 402
}{
"message": "This token is missing the required scope: contacts:write.",
"error_code": "insufficient_scope",
"status": 403
}{
"message": "Cannot merge a contact into itself.",
"error_code": "invalid_merge",
"status": 422
}{
"message": "API request quota exhausted for this billing period.",
"error_code": "quota_exhausted",
"status": 429
}
