Please find the list of acceptable values for the country field here<br/><br/>The Upsert API will adhere to the configuration defined under the “Allow Duplicate Contact” setting at the Account level. If the setting is configured to check both Email and Phone, the API will attempt to identify an existing contact based on the priority sequence specified in the setting, and will create or update the contact accordingly.<br/><br/>If two separate contacts already exist—one with the same email and another with the same phone—and an upsert request includes both the email and phone, the API will update the contact that matches the first field in the configured sequence, and ignore the second field to prevent duplication.
POST https://services.leadconnectorhq.com/contacts/upsertAuthorization
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer token generated from the Leadway portal. See Authentication. | |
Version | string | Yes | 2021-07-28 | API version. |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
firstName | string | No | Rosan | |
lastName | string | No | Deo | |
name | string | No | Rosan Deo | |
email | string | No | rosan@deos.com | |
locationId | string | Yes | ve9EPM428h8vShlRW1KT | |
gender | string | No | male | |
phone | string | No | +1 888-888-8888 | |
address1 | string | No | 3535 1st St N | |
city | string | No | Dolomite | |
state | string | No | AL | |
postalCode | string | No | 35061 | |
website | string | No | https://www.tesla.com | |
timezone | string | No | America/Chihuahua | |
dnd | boolean | No | True |
dndSettings(object)Call(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
Email(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
SMS(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
WhatsApp(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
GMB(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
FB(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
inboundDndSettings(object)all(object)status(string, required): Possible values: 'active', 'inactive'message(string)
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
tags | string[] | No | This field will overwrite all current tags associated with the contact. To update a tags, it is recommended to use the Add Tag or Remove Tag API instead. | |
customFields | object[] | No | ||
source | string | No | public api | |
dateOfBirth | object | No | 1990-09-25 | The birth date of the contact. Supported formats: YYYY/MM/DD, MM/DD/YYYY, YYYY-MM-DD, MM-DD-YYYY, YYYY.MM.DD, MM.DD.YYYY, YYYY_MM_DD, MM_DD_YYYY |
country | string | No | US | |
companyName | string | No | DGS VolMAX | |
assignedTo | string | No | y0BeYjuRIlDwsDcOHOJo | User's Id |
createNewIfDuplicateAllowed | boolean | No | False | Controls whether to create a new contact or update an existing duplicate. Scenario 1: If this value is true and the account allows duplicate contacts, a new contact will be created immediately without checking for duplicates. Scenario 2: If this value is true but the account does not allow duplicate contacts, this field is ignored and the normal upsert behavior applies: the API will search for an existing duplicate contact, update it if found, or create a new contact if not found. Scenario 3: If this value is false or not provided, the normal upsert behavior applies regardless of the account's duplicate contact setting. |
Responses
200 - Successful response
new(boolean): Example:Truecontact(object)id(string): Example:seD4PfOuKoVMLkEZqohJname(string): Example:rubika deolocationId(string): Example:ve9EPM428h8vShlRW1KTfirstName(string): Example:rubikalastName(string): Example:Deoemail(string): Example:rubika@deos.comemailLowerCase(string): Example:rubika@deos.comtimezone(string): Example:Asia/CalcuttacompanyName(string): Example:DGS VolMAXphone(string): Example:+18832327657dnd(boolean): Example:TruedndSettings(object)Call(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
Email(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
SMS(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
WhatsApp(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
GMB(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
FB(object)status(string, required): Possible values: 'active', 'inactive', 'permanent'message(string)code(string)
type(string): Example:readsource(string): Example:public apiassignedTo(string): Example:ve9EPM428h8vShlRW1KTaddress1(string): Example:3535 1st St Ncity(string): Example:ruDolomitebikastate(string): Example:ALcountry(string): Example:USpostalCode(string): Example:35061website(string): Example:https://www.tesla.comtags(string[])dateOfBirth(string): Example:Date format YYYY-MM-DDdateAdded(string): Example:2021-07-02T05:18:26.704ZdateUpdated(string): Example:2021-07-02T05:18:26.704Zattachments(string)ssn(string)keyword(string): Example:testfirstNameLowerCase(string): Example:rubikafullNameLowerCase(string): Example:rubika deolastNameLowerCase(string): Example:deolastActivity(string): Example:2021-07-16T11:39:30.564ZcustomFields(object[])id(string): Example:MgobCB14YMVKuE4Ka8p1value(string): Example:name
businessId(string): Example:641c094001436dbc2081e642attributionSource(object)url(string, required): Example:Trigger Linkcampaign(string)utmSource(string)utmMedium(string)utmContent(string)referrer(string): Example:https: //www.google.comcampaignId(string)fbclid(string)gclid(string): Example:CjOKCQjwnNyUBhCZARISAI9AYIFtNnIcWcYGIOQINz_ZoFI5SSLRRugSoPZoiEu27IZBY£1-MAIWmEaAo2VEALW_WCBmsclikid(string)dclid(string)fbc(string)fbp(string): Example:fb. 1.1674748390986.1171287961fbEventId(string): Example:Mozilla/5.0userAgent(string): Example:Mozilla/5.0ip(string): Example:58.111.106.198medium(string): Example:surveymediumId(string): Example:FglfHAn30PRwsZVyQlKp
lastAttributionSource(object)url(string, required): Example:Trigger Linkcampaign(string)utmSource(string)utmMedium(string)utmContent(string)referrer(string): Example:https: //www.google.comcampaignId(string)fbclid(string)gclid(string): Example:CjOKCQjwnNyUBhCZARISAI9AYIFtNnIcWcYGIOQINz_ZoFI5SSLRRugSoPZoiEu27IZBY£1-MAIWmEaAo2VEALW_WCBmsclikid(string)dclid(string)fbc(string)fbp(string): Example:fb. 1.1674748390986.1171287961fbEventId(string): Example:Mozilla/5.0userAgent(string): Example:Mozilla/5.0ip(string): Example:58.111.106.198medium(string): Example:surveymediumId(string): Example:FglfHAn30PRwsZVyQlKp
visitorId(string): visitorId is the Unique ID assigned to each Live chat visitor. Example:ve9EPM428h8vShlRW1KT
traceId(string)
{
"new": true,
"contact": {
"id": "seD4PfOuKoVMLkEZqohJ",
"name": "rubika deo",
"locationId": "ve9EPM428h8vShlRW1KT",
"firstName": "rubika",
"lastName": "Deo",
"email": "rubika@deos.com",
"emailLowerCase": "rubika@deos.com",
"timezone": "Asia/Calcutta",
"companyName": "DGS VolMAX",
"phone": "+18832327657",
"dnd": true,
"dndSettings": {
"Call": {
"status": "active",
"message": "string",
"code": "string"
},
"Email": {
"status": "active",
"message": "string",
"code": "string"
},
"SMS": {
"status": "active",
"message": "string",
"code": "string"
},
"WhatsApp": {
"status": "active",
"message": "string",
"code": "string"
},
"GMB": {
"status": "active",
"message": "string",
"code": "string"
// truncado: 81 lineas mas
}400 - Bad Request
{}422 - Unprocessable Entity
{}Example
curl -X POST 'https://services.leadconnectorhq.com/contacts/upsert' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"firstName": "Rosan",
"lastName": "Deo",
"name": "Rosan Deo",
"email": "rosan@deos.com",
"locationId": "ve9EPM428h8vShlRW1KT",
"gender": "male",
"phone": "+1 888-888-8888",
"address1": "3535 1st St N",
"city": "Dolomite",
"state": "AL",
"postalCode": "35061",
"website": "https://www.tesla.com",
"timezone": "America/Chihuahua",
"dnd": true,
"dndSettings": {
"Call": {
"status": "active",
"message": "string",
"code": "string"
},
"Email": {
"status": "active",
"message": "string",
"code": "string"
},
"SMS": {
"status": "active",
"message": "string",
"code": "string"
},
"WhatsApp": {
"status": "active",
"message": "string",
"code": "string"
},
"GMB": {
"status": "active",
"message": "string",
"code": "string"
},
"FB": {
"status": "active",
"message": "string",
"code": "string"
}
},
"inboundDndSettings": {
"all": {
"status": "active",
"message": "string"
}
},
"tags": [
"nisi sint commodo amet",
"consequat"
],
"customFields": [],
"source": "public api",
"dateOfBirth": "1990-09-25",
"country": "US",
"companyName": "DGS VolMAX",
"assignedTo": "y0BeYjuRIlDwsDcOHOJo",
"createNewIfDuplicateAllowed": false
}'const response = await fetch('https://services.leadconnectorhq.com/contacts/upsert', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"firstName": "Rosan", "lastName": "Deo", "name": "Rosan Deo", "email": "rosan@deos.com", "locationId": "ve9EPM428h8vShlRW1KT", "gender": "male", "phone": "+1 888-888-8888", "address1": "3535 1st St N", "city": "Dolomite", "state": "AL", "postalCode": "35061", "website": "https://www.tesla.com", "timezone": "America/Chihuahua", "dnd": true, "dndSettings": {"Call": {"status": "active", "message": "string", "code": "string"}, "Email": {"status": "active", "message": "string", "code": "string"}, "SMS": {"status": "active", "message": "string", "code": "string"}, "WhatsApp": {"status": "active", "message": "string", "code": "string"}, "GMB": {"status": "active", "message": "string", "code": "string"}, "FB": {"status": "active", "message": "string", "code": "string"}}, "inboundDndSettings": {"all": {"status": "active", "message": "string"}}, "tags": ["nisi sint commodo amet", "consequat"], "customFields": [], "source": "public api", "dateOfBirth": "1990-09-25", "country": "US", "companyName": "DGS VolMAX", "assignedTo": "y0BeYjuRIlDwsDcOHOJo", "createNewIfDuplicateAllowed": false}),
});
const data = await response.json();import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/contacts/upsert',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"firstName": "Rosan", "lastName": "Deo", "name": "Rosan Deo", "email": "rosan@deos.com", "locationId": "ve9EPM428h8vShlRW1KT", "gender": "male", "phone": "+1 888-888-8888", "address1": "3535 1st St N", "city": "Dolomite", "state": "AL", "postalCode": "35061", "website": "https://www.tesla.com", "timezone": "America/Chihuahua", "dnd": true, "dndSettings": {"Call": {"status": "active", "message": "string", "code": "string"}, "Email": {"status": "active", "message": "string", "code": "string"}, "SMS": {"status": "active", "message": "string", "code": "string"}, "WhatsApp": {"status": "active", "message": "string", "code": "string"}, "GMB": {"status": "active", "message": "string", "code": "string"}, "FB": {"status": "active", "message": "string", "code": "string"}}, "inboundDndSettings": {"all": {"status": "active", "message": "string"}}, "tags": ["nisi sint commodo amet", "consequat"], "customFields": [], "source": "public api", "dateOfBirth": "1990-09-25", "country": "US", "companyName": "DGS VolMAX", "assignedTo": "y0BeYjuRIlDwsDcOHOJo", "createNewIfDuplicateAllowed": false},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/contacts/upsert');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'firstName': 'Rosan', 'lastName': 'Deo', 'name': 'Rosan Deo', 'email': 'rosan@deos.com', 'locationId': 've9EPM428h8vShlRW1KT', 'gender': 'male', 'phone': '+1 888-888-8888', 'address1': '3535 1st St N', 'city': 'Dolomite', 'state': 'AL', 'postalCode': '35061', 'website': 'https://www.tesla.com', 'timezone': 'America/Chihuahua', 'dnd': true, 'dndSettings': {'Call': {'status': 'active', 'message': 'string', 'code': 'string'}, 'Email': {'status': 'active', 'message': 'string', 'code': 'string'}, 'SMS': {'status': 'active', 'message': 'string', 'code': 'string'}, 'WhatsApp': {'status': 'active', 'message': 'string', 'code': 'string'}, 'GMB': {'status': 'active', 'message': 'string', 'code': 'string'}, 'FB': {'status': 'active', 'message': 'string', 'code': 'string'}}, 'inboundDndSettings': {'all': {'status': 'active', 'message': 'string'}}, 'tags': ['nisi sint commodo amet', 'consequat'], 'customFields': [], 'source': 'public api', 'dateOfBirth': '1990-09-25', 'country': 'US', 'companyName': 'DGS VolMAX', 'assignedTo': 'y0BeYjuRIlDwsDcOHOJo', 'createNewIfDuplicateAllowed': false}),
]);
$data = json_decode(curl_exec($ch), true);