curl --request POST \
--url https://api.affinity.co/v2/calls \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"startTime": "2023-01-01T00:00:00Z",
"attendees": [
{
"person": {
"id": 1
}
},
{
"person": {
"id": 2
}
}
]
}
'import requests
url = "https://api.affinity.co/v2/calls"
payload = {
"startTime": "2023-01-01T00:00:00Z",
"attendees": [{ "person": { "id": 1 } }, { "person": { "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({
startTime: '2023-01-01T00:00:00Z',
attendees: [{person: {id: 1}}, {person: {id: 2}}]
})
};
fetch('https://api.affinity.co/v2/calls', 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/calls",
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([
'startTime' => '2023-01-01T00:00:00Z',
'attendees' => [
[
'person' => [
'id' => 1
]
],
[
'person' => [
'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://api.affinity.co/v2/calls"
payload := strings.NewReader("{\n \"startTime\": \"2023-01-01T00:00:00Z\",\n \"attendees\": [\n {\n \"person\": {\n \"id\": 1\n }\n },\n {\n \"person\": {\n \"id\": 2\n }\n }\n ]\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/calls")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"startTime\": \"2023-01-01T00:00:00Z\",\n \"attendees\": [\n {\n \"person\": {\n \"id\": 1\n }\n },\n {\n \"person\": {\n \"id\": 2\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/calls")
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 \"startTime\": \"2023-01-01T00:00:00Z\",\n \"attendees\": [\n {\n \"person\": {\n \"id\": 1\n }\n },\n {\n \"person\": {\n \"id\": 2\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"loggingType": "manual",
"title": "Example title",
"startTime": "2023-01-01T00:00:00Z",
"endTime": "2023-01-01T00:00:00Z",
"allDay": false,
"creator": {
"emailAddress": "john.smith@contoso.com",
"person": {
"id": 1,
"firstName": "Jane",
"lastName": "Doe",
"primaryEmailAddress": "jane.smith@northpointvc.com",
"type": "internal"
}
},
"createdAt": "2023-01-01T00:00:00Z",
"updatedAt": "2023-01-01T00:00:00Z",
"attendeesPreview": {
"data": [
{
"emailAddress": "john.smith@contoso.com",
"person": {
"id": 1,
"firstName": "Jane",
"lastName": "Doe",
"primaryEmailAddress": "jane.smith@northpointvc.com",
"type": "internal"
}
}
],
"totalCount": 200
}
}{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Create a Call
| ⚠️ This endpoint is currently in BETA |
|---|
Creates a new Call logged as a manual interaction. The calling user is recorded as the call’s creator; this cannot be set explicitly.
attendees must name at least one internal and one external Person, and must not name the same
Person twice.
An attendee id that does not exist, or that belongs to another organization, returns 400. A list with only internal Persons, or with no external Person, also returns 400. An attendee that the caller cannot access, such as a hidden Person, returns 404.
The call is shared with the organization’s default sharing settings.
The endpoint returns 404 when the feature is not enabled for the organization.
A create that repeats the startTime and the attendees of an existing manually logged call or
meeting returns 400, and the error message names the existing interaction’s id.
To attach a note to the created call, make a separate call to POST /v2/notes with type set
to interaction and interaction.id set to the new call’s id.
curl --request POST \
--url https://api.affinity.co/v2/calls \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"startTime": "2023-01-01T00:00:00Z",
"attendees": [
{
"person": {
"id": 1
}
},
{
"person": {
"id": 2
}
}
]
}
'import requests
url = "https://api.affinity.co/v2/calls"
payload = {
"startTime": "2023-01-01T00:00:00Z",
"attendees": [{ "person": { "id": 1 } }, { "person": { "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({
startTime: '2023-01-01T00:00:00Z',
attendees: [{person: {id: 1}}, {person: {id: 2}}]
})
};
fetch('https://api.affinity.co/v2/calls', 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/calls",
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([
'startTime' => '2023-01-01T00:00:00Z',
'attendees' => [
[
'person' => [
'id' => 1
]
],
[
'person' => [
'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://api.affinity.co/v2/calls"
payload := strings.NewReader("{\n \"startTime\": \"2023-01-01T00:00:00Z\",\n \"attendees\": [\n {\n \"person\": {\n \"id\": 1\n }\n },\n {\n \"person\": {\n \"id\": 2\n }\n }\n ]\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/calls")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"startTime\": \"2023-01-01T00:00:00Z\",\n \"attendees\": [\n {\n \"person\": {\n \"id\": 1\n }\n },\n {\n \"person\": {\n \"id\": 2\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/calls")
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 \"startTime\": \"2023-01-01T00:00:00Z\",\n \"attendees\": [\n {\n \"person\": {\n \"id\": 1\n }\n },\n {\n \"person\": {\n \"id\": 2\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"loggingType": "manual",
"title": "Example title",
"startTime": "2023-01-01T00:00:00Z",
"endTime": "2023-01-01T00:00:00Z",
"allDay": false,
"creator": {
"emailAddress": "john.smith@contoso.com",
"person": {
"id": 1,
"firstName": "Jane",
"lastName": "Doe",
"primaryEmailAddress": "jane.smith@northpointvc.com",
"type": "internal"
}
},
"createdAt": "2023-01-01T00:00:00Z",
"updatedAt": "2023-01-01T00:00:00Z",
"attendeesPreview": {
"data": [
{
"emailAddress": "john.smith@contoso.com",
"person": {
"id": 1,
"firstName": "Jane",
"lastName": "Doe",
"primaryEmailAddress": "jane.smith@northpointvc.com",
"type": "internal"
}
}
],
"totalCount": 200
}
}{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Authorizations
Body
Request body for creating a Call.
Response
Created
Was this page helpful?