Sync a contact's data

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:

  1. Contact id, only when the request is sent with lookupByAcId=true and contact.id is set. An id that resolves to nothing does not fail the request; the lookup carries on with the checks below.
  2. contact.whatsapp_id, when WhatsApp contacts are enabled for the account. If no contact has the WhatsApp id and contact.email was sent too, the email is tried as a fallback so a duplicate contact is not created for an email that already exists.
  3. contact.email, when no contact.whatsapp_id was sent. An email that matches nothing never falls back to the phone number.
  4. contact.phone, only when no email was sent at all. A phone number that more than one contact has is rejected with Phone 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 Deprecated

Contact-Organization relationships are now managed through Account-Contact end points

📘

/sync "upserts" Contact data

The Contact record to be updated is identified by the email you provide in the JSON body. If that email address matches an existing Contact's address, that Contact's record will be updated with the JSON body provided.

If the email does not match any existing Contact's email address, a new Contact will be created with the provided JSON data.

{
  "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
    }
}
Query Params
boolean

Look the contact up by contact.id before the WhatsApp id, email and phone checks. Defaults to false, and the id is ignored unless this is set.

Body Params
contact
object
boolean

Accepted for compatibility with v1 contact_sync's use_defaults, and defaults to true on this endpoint. Required custom fields no longer exist, so the value does not change what the request writes.

string

Optional label for the system the write came from. It is not validated against a fixed list. A non-empty value is carried into the service key of the contact webhook payload when the payload does not already carry one, which is how an integration recognises, and skips, the updates it made itself.

Responses

Language
Credentials
Header
URL
LoadingLoading…
Response
Choose an example:
application/json