curl --request POST \
--url https://api.affinity.co/v2/person-merges \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"primaryPersonId": 12345,
"duplicatePersonId": 67890
}
'import requests
url = "https://api.affinity.co/v2/person-merges"
payload = {
"primaryPersonId": 12345,
"duplicatePersonId": 67890
}
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({primaryPersonId: 12345, duplicatePersonId: 67890})
};
fetch('https://api.affinity.co/v2/person-merges', 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://api.affinity.co/v2/person-merges",
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([
'primaryPersonId' => 12345,
'duplicatePersonId' => 67890
]),
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://api.affinity.co/v2/person-merges"
payload := strings.NewReader("{\n \"primaryPersonId\": 12345,\n \"duplicatePersonId\": 67890\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://api.affinity.co/v2/person-merges")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"primaryPersonId\": 12345,\n \"duplicatePersonId\": 67890\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/person-merges")
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 \"primaryPersonId\": 12345,\n \"duplicatePersonId\": 67890\n}"
response = http.request(request)
puts response.read_body{
"taskUrl": "https://api.affinity.co/v2/tasks/person-merges/123e4567-e89b-12d3-a456-426614174000"
}{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Initiate Person Merge
Initiate a person merge to combine a duplicate person profile into a primary person profile.
This is an asynchronous process that will merge all data from the duplicate person into the primary person. Once the merge is initiated, you can track its progress using the returned task URL.
Requires the “Manage duplicates” permission and organization admin role.
curl --request POST \
--url https://api.affinity.co/v2/person-merges \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"primaryPersonId": 12345,
"duplicatePersonId": 67890
}
'import requests
url = "https://api.affinity.co/v2/person-merges"
payload = {
"primaryPersonId": 12345,
"duplicatePersonId": 67890
}
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({primaryPersonId: 12345, duplicatePersonId: 67890})
};
fetch('https://api.affinity.co/v2/person-merges', 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://api.affinity.co/v2/person-merges",
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([
'primaryPersonId' => 12345,
'duplicatePersonId' => 67890
]),
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://api.affinity.co/v2/person-merges"
payload := strings.NewReader("{\n \"primaryPersonId\": 12345,\n \"duplicatePersonId\": 67890\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://api.affinity.co/v2/person-merges")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"primaryPersonId\": 12345,\n \"duplicatePersonId\": 67890\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/person-merges")
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 \"primaryPersonId\": 12345,\n \"duplicatePersonId\": 67890\n}"
response = http.request(request)
puts response.read_body{
"taskUrl": "https://api.affinity.co/v2/tasks/person-merges/123e4567-e89b-12d3-a456-426614174000"
}{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Authorizations
A static Affinity API key, presented as a bearer token.
Body
Request body for initiating a person merge
The ID of the person profile that will be kept after the merge. All data from the duplicate person will be merged into this person.
1 <= x <= 900719925474099112345
The ID of the person profile that will be merged and then deleted. All data from this person will be transferred to the primary person.
1 <= x <= 900719925474099167890
Response
Accepted
Response body for initiating a person merge
URL to check the status of the merge task
"https://api.affinit.com/tasks/person-merges/123e4567-e89b-12d3-a456-426614174000"
Was this page helpful?