curl --request GET \
--url https://api.affinity.co/v2/companies/{companyId}/relationships \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.affinity.co/v2/companies/{companyId}/relationships"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.affinity.co/v2/companies/{companyId}/relationships', 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/companies/{companyId}/relationships",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.affinity.co/v2/companies/{companyId}/relationships"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.affinity.co/v2/companies/{companyId}/relationships")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/companies/{companyId}/relationships")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"person1": {
"id": 1,
"firstName": "Jane",
"lastName": "Smith",
"primaryEmailAddress": "jane.smith@northpointvc.com"
},
"person2": {
"id": 10,
"firstName": "John",
"lastName": "Doe",
"primaryEmailAddress": "john.doe@acme.co"
},
"interactionScore": 0.92,
"linkedIn": null
},
{
"person1": {
"id": 2,
"firstName": "Priya",
"lastName": "Patel",
"primaryEmailAddress": "priya.patel@northpointvc.com"
},
"person2": {
"id": 11,
"firstName": "Alex",
"lastName": "Kim",
"primaryEmailAddress": "alex.kim@acme.co"
},
"interactionScore": 0.68,
"linkedIn": {
"connectedOn": "2022-06-15"
}
},
{
"person1": {
"id": 3,
"firstName": "Sam",
"lastName": null,
"primaryEmailAddress": "sam@northpointvc.com"
},
"person2": {
"id": 12,
"firstName": "Robin",
"lastName": "Hill",
"primaryEmailAddress": null
},
"interactionScore": 0.35,
"linkedIn": null
}
],
"pagination": {
"prevUrl": null,
"nextUrl": "https://api.affinity.co/v2/companies/100/relationships?cursor=ICAgICAgIGFmdGVyOjo6Mw"
}
}{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Get Relationships for a Company
Returns the relationships for a given company, including the interaction score that measures the strength of each relationship based on communication patterns such as emails, meetings, and other interactions.
Each relationship includes two persons (person1 and person2) who have a connection related to this company.
Interaction score
The interactionScore is a value between 0.0 and 1.0 that reflects how frequently the
two persons interact across email, calendar events, and chat messages. The more interactions,
the higher the score. Recent interactions are weighted slightly higher than older ones. As
rough guidance, scores at or above 0.7 typically indicate two persons that communicate
regularly, scores between 0.4 and 0.7 indicate occasional communication, and scores below
0.4 indicate only sporadic communication.
LinkedIn connections
The collection also includes relationships based on a LinkedIn connection between an internal
team member and a person related to this company. Whenever a LinkedIn connection exists between
the two persons in a relationship, linkedIn is populated with the date the connection was made.
linkedIn is null when no LinkedIn connection between the two persons is known by Affinity.
Note that LinkedIn-based relationships which do not have any interaction data will have an
interactionScore of 0.
Filters
You can filter relationships using the filter query parameter. The filter parameter is a string that you can specify conditions based on the following properties.
| Property Name | Type | Description | Allowed Operators | Examples |
|---|---|---|---|---|
interactionScore | double | Strength of the relationship, between 0.0 and 1.0. Higher means stronger. | >, <, >=, <= | interactionScore>=0.5 |
Sorting
You can sort relationships using the orderBy query parameter. interactionScore is the only
sortable property.
curl --request GET \
--url https://api.affinity.co/v2/companies/{companyId}/relationships \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.affinity.co/v2/companies/{companyId}/relationships"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.affinity.co/v2/companies/{companyId}/relationships', 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/companies/{companyId}/relationships",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.affinity.co/v2/companies/{companyId}/relationships"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.affinity.co/v2/companies/{companyId}/relationships")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/companies/{companyId}/relationships")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"person1": {
"id": 1,
"firstName": "Jane",
"lastName": "Smith",
"primaryEmailAddress": "jane.smith@northpointvc.com"
},
"person2": {
"id": 10,
"firstName": "John",
"lastName": "Doe",
"primaryEmailAddress": "john.doe@acme.co"
},
"interactionScore": 0.92,
"linkedIn": null
},
{
"person1": {
"id": 2,
"firstName": "Priya",
"lastName": "Patel",
"primaryEmailAddress": "priya.patel@northpointvc.com"
},
"person2": {
"id": 11,
"firstName": "Alex",
"lastName": "Kim",
"primaryEmailAddress": "alex.kim@acme.co"
},
"interactionScore": 0.68,
"linkedIn": {
"connectedOn": "2022-06-15"
}
},
{
"person1": {
"id": 3,
"firstName": "Sam",
"lastName": null,
"primaryEmailAddress": "sam@northpointvc.com"
},
"person2": {
"id": 12,
"firstName": "Robin",
"lastName": "Hill",
"primaryEmailAddress": null
},
"interactionScore": 0.35,
"linkedIn": null
}
],
"pagination": {
"prevUrl": null,
"nextUrl": "https://api.affinity.co/v2/companies/100/relationships?cursor=ICAgICAgIGFmdGVyOjo6Mw"
}
}{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Authorizations
Query Parameters
Was this page helpful?