← Contacts

Upsert Contact

Create a new contact or update an existing one. The match is based on email and/or phone, following the "Allow Duplicate Contact" setting configured at the location level.

POST/contacts/upsert
Scope
contacts.write
Auth Method
Bearer Token
Token Type
Sub-Account / Company

Header Parameters

ParameterTypeDescription
AuthorizationrequiredstringBearer {access_token}
VersionrequiredstringAPI Version
Possible values: 2021-07-28
Content-Typerequiredstringapplication/json

Body Parameters

ParameterTypeDescription
firstNamestringFirst name.
lastNamestringLast name.
namestringFull name.
emailstringEmail address. Used for matching existing contacts.
phonestringPhone number (E.164). Used for matching existing contacts.
locationIdrequiredstringSub-account ID.
address1stringStreet address.
citystringCity.
statestringState or province.
postalCodestringZIP or postal code.
countrystringCountry code (ISO 3166-1 alpha-2).
websitestringWebsite URL.
timezonestringIANA timezone.
dndbooleanGlobal Do Not Disturb flag.
dndSettingsobjectPer-channel DND settings.
tagsstring[]Tags to assign.
customFieldsobject[]Custom field values.
sourcestringLead source.
companyNamestringCompany name.
dateOfBirthstringBirth date.
assignedTostringUser ID to assign.
Example RequestcURL
curl -X POST \
  'https://services.leadconnectorhq.com/contacts/upsert' \
  -H 'Authorization: Bearer {access_token}' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "phone": "+15559876543",
    "locationId": "ve9EPM428h8vShlRW1KT",
    "tags": ["upserted"],
    "source": "api"
  }'

Response — 200 OK

The response includes a new boolean indicating whether the contact was created (true) or updated (false).

Example ResponseJSON
{
  "new": false,
  "contact": {
    "id": "ocQHyuzHvuMOe5N5jjXF",
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "phone": "+15559876543",
    "locationId": "ve9EPM428h8vShlRW1KT",
    "tags": ["upserted"],
    "source": "api",
    "dateUpdated": "2024-06-16T15:00:00.000Z"
  }
}

Duplicate Contact Logic

The Upsert API follows the "Allow Duplicate Contact" setting at the Location level. If configured to check both Email and Phone, the API matches on the first field in the configured priority sequence.

If two separate contacts exist — one matching the email and another matching the phone — the API updates the contact matching the higher-priority field and ignores the second to prevent duplication.