Upserts a single contact: the endpoint looks for an existing contact, updates it when one is found, and creates it otherwise. A contact array holding more than one resource is rejected.
The lookup runs in this order:
- Contact id, only when the request is sent with
lookupByAcId=trueandcontact.idis set. An id that resolves to nothing does not fail the request; the lookup carries on with the checks below. contact.whatsapp_id, when WhatsApp contacts are enabled for the account. If no contact has the WhatsApp id andcontact.emailwas sent too, the email is tried as a fallback so a duplicate contact is not created for an email that already exists.contact.email, when nocontact.whatsapp_idwas sent. An email that matches nothing never falls back to the phone number.contact.phone, only when no email was sent at all. A phone number that more than one contact has is rejected withPhone must be unique when there is no email.
Creating a contact needs the pg_subscriber_add permission and updating one needs pg_subscriber_edit, so the permission a request needs depends on whether the lookup found a contact. Contacts without an email address require phone-only contacts to be enabled for the account and contact.allowNullEmail to be set, and WhatsApp payloads require WhatsApp contacts to be enabled.
Organization-Related Nodes Have Been DeprecatedContact-Organization relationships are now managed through Account-Contact end points
/sync "upserts" Contact dataThe Contact record to be updated is identified by the
If the
{
"contact": {
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"phone": "7223224241",
"fieldValues": [
{
"field": "1",
"value": "The Value for First Field"
},
{
"field": "6",
"value": "2008-01-20"
}
],
"tags": [
"customer",
"newsletter"
]
}
}{
"fieldValues": [
{
"contact": "113",
"field": "1",
"value": "The Value for First Field",
"cdate": "2020-08-01T10:54:59-05:00",
"udate": "2020-08-01T14:13:34-05:00",
"links": {
"owner": "https://:account.api-us1.com/api/3/fieldValues/11797/owner",
"field": "https://:account.api-us1.com/api/3/fieldValues/11797/field"
},
"id": "11797",
"owner": "115"
},
{
"contact": "113",
"field": "6",
"value": "2008-01-20",
"cdate": "2020-08-01T10:54:59-05:00",
"udate": "2020-08-01T14:13:34-05:00",
"links": {
"owner": "https://:account.api-us1.com/api/3/fieldValues/11798/owner",
"field": "https://:account.api-us1.com/api/3/fieldValues/11798/field"
},
"id": "11798",
"owner": "115"
}
],
"contact": {
"cdate": "2018-09-28T17:27:21-05:00",
"email": "[email protected]",
"phone": "7223224241",
"firstName": "John",
"lastName": "Doe",
"orgid": "0",
"segmentio_id": "",
"bounced_hard": "0",
"bounced_soft": "0",
"bounced_date": "0000-00-00",
"ip": "0",
"ua": "",
"hash": "",
"socialdata_lastcheck": "0000-00-00 00:00:00",
"email_local": "",
"email_domain": "",
"sentcnt": "0",
"rating_tstamp": "0000-00-00",
"gravatar": "0",
"deleted": "0",
"anonymized": "0",
"udate": "2018-09-28T17:30:52-05:00",
"deleted_at": "0000-00-00 00:00:00",
"created_utc_timestamp": "2018-09-28 17:27:21",
"updated_utc_timestamp": "2018-09-28 17:27:21",
"links": {
"bounceLogs": "https://:account.api-us1.com/api/3/contacts/115/bounceLogs",
"contactAutomations": "https://:account.api-us1.com/api/3/contacts/115/contactAutomations",
"contactData": "https://:account.api-us1.com/api/3/contacts/115/contactData",
"contactGoals": "https://:account.api-us1.com/api/3/contacts/115/contactGoals",
"contactLists": "https://:account.api-us1.com/api/3/contacts/115/contactLists",
"contactLogs": "https://:account.api-us1.com/api/3/contacts/115/contactLogs",
"contactTags": "https://:account.api-us1.com/api/3/contacts/115/contactTags",
"contactDeals": "https://:account.api-us1.com/api/3/contacts/115/contactDeals",
"deals": "https://:account.api-us1.com/api/3/contacts/115/deals",
"fieldValues": "https://:account.api-us1.com/api/3/contacts/115/fieldValues",
"geoIps": "https://:account.api-us1.com/api/3/contacts/115/geoIps",
"notes": "https://:account.api-us1.com/api/3/contacts/115/notes",
"organization": "https://:account.api-us1.com/api/3/contacts/115/organization",
"plusAppend": "https://:account.api-us1.com/api/3/contacts/115/plusAppend",
"trackingLogs": "https://:account.api-us1.com/api/3/contacts/115/trackingLogs",
"scoreValues": "https://:account.api-us1.com/api/3/contacts/115/scoreValues"
},
"id": "115",
"organization": null
}
}