Remove email while update contact using REST API

SOLVE
Highlighted
New Contributor

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" }

 

 

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Highlighted
Solution
Regular Advisor | Gold Partner

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

View solution in original post

Reply
0 Upvotes
1 Reply 1
Highlighted
Solution
Regular Advisor | Gold Partner

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

View solution in original post

Reply
0 Upvotes