APIs & Integrations

mahaDev
Mitglied

Remove email while update contact using REST API

lösung

Hi Team ,

 

        I tried to removed email from Contact .When i passed ""  or null to email field , API throw 400 Bad Request .

 

 

Request:  https://api.hubapi.com/contacts/v1/contact/vid/201/profile
{ "properties": [ { "property": "phone", "value": "+16094886338" }, { "property": "email", "value": null } ] }
RESPONSE

{ "validationResults": [ { "isValid": false, "message": "Email address is invalid", "error": "INVALID_EMAIL", "name": "email" } ], "status": "error", "message": "Property values were not valid", "correlationId": "9bedb9d1-8034-470a-9786-098f07ba7427", "requestId": "134ebefc2850176729aed55912a219c9" }

 

 

0 Upvotes
1 Akzeptierte Lösung
himanshurauthan
Lösung
Vordenker/-in | Elite Partner
Vordenker/-in | Elite Partner

Remove email while update contact using REST API

lösung

Hello @mahaDev 

 

Since email address  is a unique key for a CRM to work on contacts so it will not take up any such record which do not have email address.
As in your case you are trying to edit the contact ( remove email address from the record ) and passing "" or NULL. HubSpot API will assume it as a new value for email property and will apply validation for the same. Since "" or NULL is an invalid format for email address field, hence returning 400 for the same.

In short, no way to remove an email from the contact unless or untill you attach a new email address with the same record.

 

Thanks

Digital Marketing & Inbound Expert In Growth Hacking Technology

Lösung in ursprünglichem Beitrag anzeigen

3 Antworten
jeanRoger
Mitglied

Remove email while update contact using REST API

lösung

is there a way to exclude email validation? I have user that mistype their emails something like aaa@gmail.comn, I would like to keep that way and not alter it when creating the contact on hubspot  cc @himanshurauthan 

0 Upvotes
AbdelMOULIDA
Mitwirkender/Mitwirkende

Remove email while update contact using REST API

lösung

Hello @jeanRoger ,

 

Were you finally able to exclude email validation?

If so how please? I have the same problem, https://community.hubspot.com/t5/APIs-Integrations/Getting-the-error-invalidEmails/m-p/503907#M47351

 

Regards

0 Upvotes
himanshurauthan
Lösung
Vordenker/-in | Elite Partner
Vordenker/-in | Elite Partner

Remove email while update contact using REST API

lösung

Hello @mahaDev 

 

Since email address  is a unique key for a CRM to work on contacts so it will not take up any such record which do not have email address.
As in your case you are trying to edit the contact ( remove email address from the record ) and passing "" or NULL. HubSpot API will assume it as a new value for email property and will apply validation for the same. Since "" or NULL is an invalid format for email address field, hence returning 400 for the same.

In short, no way to remove an email from the contact unless or untill you attach a new email address with the same record.

 

Thanks

Digital Marketing & Inbound Expert In Growth Hacking Technology