Update a Contact
PATCH /v1/contacts/{contact_id}
| Property | Value |
|---|---|
| Operation | update_contact |
| Group | Contacts |
| Scope | contacts:write |
| Route class | control |
| Idempotency | No Idempotency-Key |
| Audit | Audited contacts.contact.update (mutation) |
| Released in | 1.61.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Changes an active Contact at the revision If-Match names (1.61.0), checked as a create is; the answer carries no profile. A merged or deleted Contact is 409 contact_not_active.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the contacts:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X PATCH "$VOCAL_API/v1/contacts/ctc_..." \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H 'If-Match: "1"' \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(`${process.env.VOCAL_API}/v1/contacts/ctc_...`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'If-Match': '"1"',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
console.log(response.status, await response.text());import os
import requests
response = requests.patch(
f"{os.environ['VOCAL_API']}/v1/contacts/ctc_...",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"If-Match": '"1"',
},
json={},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
contact_id | path | ContactId | yes | The id of a Contact: ctc_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
if-match | header | string | yes | The revision the change was made against, quoted as the ETag returns it, or * to overwrite. |
Request body
Content type application/json, required: ContactUpdateRequest.
| Field | Type | Required | Description |
|---|---|---|---|
attributes | ContactAttributes | no | Replaces every attribute. |
display_name | string or null | no | |
external_ids | array of ExternalIdInput | no | Replaces every external id. |
identities | array of ContactIdentityInput | no | Replaces every identity. |
language | LanguageTag or null | no | |
timezone | IanaZone or null | no |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | Contact | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | contact_not_active, contact_match_conflict |
412 | application/json | ErrorEnvelope | revision_mismatch |
422 | application/json | ErrorEnvelope | validation_failed, capability_not_available |
428 | application/json | ErrorEnvelope | precondition_required |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is Contact.
| Field | Type | Required | Description |
|---|---|---|---|
consent | ContactConsentSummary | yes | |
created_at | Timestamp | yes | |
delete_after | Timestamp or null | yes | When a deleted Contact is purged; null otherwise. |
environment | Environment | yes | |
id | ContactId | yes | |
last_activity_at | Timestamp or null | yes | The last Call, message or API write, from which contact_inactivity_days counts. |
merged_into_id | ContactId or null | yes | The survivor of a merged one. |
object | "contact" | yes | |
profile | ContactProfile or null | yes | The content; null unless the read names include=profile. |
revision | integer | yes | |
source | ContactSource | yes | |
status | ContactStatus | yes | |
updated_at | Timestamp | yes |