Initiate Company Merge
curl --request POST \
--url https://api.affinity.co/v2/company-merges \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"primaryCompanyId": 12345,
"duplicateCompanyId": 67890
}
'import requests
url = "https://api.affinity.co/v2/company-merges"
payload = {
"primaryCompanyId": 12345,
"duplicateCompanyId": 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({primaryCompanyId: 12345, duplicateCompanyId: 67890})
};
fetch('https://api.affinity.co/v2/company-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/company-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([
'primaryCompanyId' => 12345,
'duplicateCompanyId' => 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/company-merges"
payload := strings.NewReader("{\n \"primaryCompanyId\": 12345,\n \"duplicateCompanyId\": 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/company-merges")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"primaryCompanyId\": 12345,\n \"duplicateCompanyId\": 67890\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/company-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 \"primaryCompanyId\": 12345,\n \"duplicateCompanyId\": 67890\n}"
response = http.request(request)
puts response.read_body{
"taskUrl": "https://api.affinity.co/v2/tasks/company-merges/123e4567-e89b-12d3-a456-426614174000"
}{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Company Merges
Initiate Company Merge
Initiate a company merge to combine a duplicate company profile into a primary company profile.
This is an asynchronous process that will merge all data from the duplicate company into the primary company. Once the merge is initiated, you can track its progress using the returned task URL.
Requires the “Manage duplicates” permission and organization admin role.
POST
/
v2
/
company-merges
Initiate Company Merge
curl --request POST \
--url https://api.affinity.co/v2/company-merges \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"primaryCompanyId": 12345,
"duplicateCompanyId": 67890
}
'import requests
url = "https://api.affinity.co/v2/company-merges"
payload = {
"primaryCompanyId": 12345,
"duplicateCompanyId": 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({primaryCompanyId: 12345, duplicateCompanyId: 67890})
};
fetch('https://api.affinity.co/v2/company-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/company-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([
'primaryCompanyId' => 12345,
'duplicateCompanyId' => 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/company-merges"
payload := strings.NewReader("{\n \"primaryCompanyId\": 12345,\n \"duplicateCompanyId\": 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/company-merges")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"primaryCompanyId\": 12345,\n \"duplicateCompanyId\": 67890\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/company-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 \"primaryCompanyId\": 12345,\n \"duplicateCompanyId\": 67890\n}"
response = http.request(request)
puts response.read_body{
"taskUrl": "https://api.affinity.co/v2/tasks/company-merges/123e4567-e89b-12d3-a456-426614174000"
}{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Authorizations
Body
application/json
Request body for initiating a company merge
Was this page helpful?