Update a contact
curl --request PATCH \
--url http://localhost:8080/contacts/{contact_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contact": {
"email": "[email protected]",
"phone": "<string>",
"name": "<string>",
"custom_data": {},
"http_action_overrides": {
"query_params": {},
"path_params": {},
"body_params": {},
"headers": {}
},
"external_id": "<string>",
"primary_external_id": "<string>"
}
}
'import requests
url = "http://localhost:8080/contacts/{contact_id}"
payload = { "contact": {
"email": "[email protected]",
"phone": "<string>",
"name": "<string>",
"custom_data": {},
"http_action_overrides": {
"query_params": {},
"path_params": {},
"body_params": {},
"headers": {}
},
"external_id": "<string>",
"primary_external_id": "<string>"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contact: {
email: '[email protected]',
phone: '<string>',
name: '<string>',
custom_data: {},
http_action_overrides: {query_params: {}, path_params: {}, body_params: {}, headers: {}},
external_id: '<string>',
primary_external_id: '<string>'
}
})
};
fetch('http://localhost:8080/contacts/{contact_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/contacts/{contact_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'contact' => [
'email' => '[email protected]',
'phone' => '<string>',
'name' => '<string>',
'custom_data' => [
],
'http_action_overrides' => [
'query_params' => [
],
'path_params' => [
],
'body_params' => [
],
'headers' => [
]
],
'external_id' => '<string>',
'primary_external_id' => '<string>'
]
]),
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 := "http://localhost:8080/contacts/{contact_id}"
payload := strings.NewReader("{\n \"contact\": {\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"name\": \"<string>\",\n \"custom_data\": {},\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n },\n \"external_id\": \"<string>\",\n \"primary_external_id\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://localhost:8080/contacts/{contact_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contact\": {\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"name\": \"<string>\",\n \"custom_data\": {},\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n },\n \"external_id\": \"<string>\",\n \"primary_external_id\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/contacts/{contact_id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact\": {\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"name\": \"<string>\",\n \"custom_data\": {},\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n },\n \"external_id\": \"<string>\",\n \"primary_external_id\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Contacts
Update a contact
Update a contact. Use when your application needs to create, look up, or maintain the contact records that the AI agents converse with.
PATCH
/
contacts
/
{contact_id}
Update a contact
curl --request PATCH \
--url http://localhost:8080/contacts/{contact_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contact": {
"email": "[email protected]",
"phone": "<string>",
"name": "<string>",
"custom_data": {},
"http_action_overrides": {
"query_params": {},
"path_params": {},
"body_params": {},
"headers": {}
},
"external_id": "<string>",
"primary_external_id": "<string>"
}
}
'import requests
url = "http://localhost:8080/contacts/{contact_id}"
payload = { "contact": {
"email": "[email protected]",
"phone": "<string>",
"name": "<string>",
"custom_data": {},
"http_action_overrides": {
"query_params": {},
"path_params": {},
"body_params": {},
"headers": {}
},
"external_id": "<string>",
"primary_external_id": "<string>"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contact: {
email: '[email protected]',
phone: '<string>',
name: '<string>',
custom_data: {},
http_action_overrides: {query_params: {}, path_params: {}, body_params: {}, headers: {}},
external_id: '<string>',
primary_external_id: '<string>'
}
})
};
fetch('http://localhost:8080/contacts/{contact_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/contacts/{contact_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'contact' => [
'email' => '[email protected]',
'phone' => '<string>',
'name' => '<string>',
'custom_data' => [
],
'http_action_overrides' => [
'query_params' => [
],
'path_params' => [
],
'body_params' => [
],
'headers' => [
]
],
'external_id' => '<string>',
'primary_external_id' => '<string>'
]
]),
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 := "http://localhost:8080/contacts/{contact_id}"
payload := strings.NewReader("{\n \"contact\": {\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"name\": \"<string>\",\n \"custom_data\": {},\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n },\n \"external_id\": \"<string>\",\n \"primary_external_id\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://localhost:8080/contacts/{contact_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contact\": {\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"name\": \"<string>\",\n \"custom_data\": {},\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n },\n \"external_id\": \"<string>\",\n \"primary_external_id\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/contacts/{contact_id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact\": {\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"name\": \"<string>\",\n \"custom_data\": {},\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n },\n \"external_id\": \"<string>\",\n \"primary_external_id\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Only the fields you send change; omitted fields keep their values.
External IDs
external_id: send a string to set or replace the contact’s ID in your system, ornullto clear it. Once a contact has anexternal_id, it is matched by that ID alone: channels that identify people by email or phone, such as inbound email, no longer match it and create their own contacts instead.primary_external_id: send a string to link the contact to a main account, ornullto unlink it. The main contact does not need to exist yet. See Link accounts to a main contact.
Errors
409: the update would give the contact anexternal_idanother contact in your organization already has. Email only has to be unique among contacts without anexternal_id, so for a contact that has none after the update (including one whoseexternal_idyou clear) it also returns409when another such contact has the same email. Nothing is saved.400: the contact’sprimary_external_idwould equal its ownexternal_id, counting values already saved. Nothing is saved.
Was this page helpful?