Create or update a contact by email (upsert)

Create or update a single contact by email address (upsert). When a contact with the given email already exists it is updated and the response is 200; otherwise a new contact is created and the response is 201, so the status code tells you which happened. Use this whenever the request supplies email addresses that may already be in the account, including pasted or imported lists, or to update a contact without knowing its id. Unlike POST /contacts, it never fails with a duplicate-email error. How the contact is found: with the lookupByAcId query parameter and contact.id, by id first. With contact.whatsapp_id, by WhatsApp id and then by email. Otherwise by email. Without an email, which needs allowNullEmail, by phone. If no contact is found, one is created; if another request creates a contact with the same email at the same moment, this request updates that contact instead. Updating needs the edit contacts permission and creating needs the add contacts permission. Only the fields included in the request are changed; omitted fields keep their current values. The contact also takes the other fields of POST /contacts and PUT /contacts/{id}, such as tags, lists, form, ip4 and account, with the same meaning there. To create or update many contacts at once, use POST /import/bulk_import (up to 250 per request): it also creates or updates by email, can set list subscriptions and tags per contact, and reports each row's outcome through GET /import/info. Use POST /contacts only when the contact must be brand-new and an existing email should be reported as an error.

🚧

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

Set to true to find the contact by contact.id before any other lookup. If no contact has that id, the other lookups are used.

Body Params
contact
object
required

The contact to create or update.

string

Recorded as the source of the request for the webhooks the change fires.

boolean

Read but has no effect.

Responses

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