Delete secondary/additional emails via API

Long story short, a sales agent merged multiple(more than is realistic to delete manually) contacts with other contacts. This set all those merged contacts as secondard emails on the surviving object.

I can find these emails via

/crm/v3/objects/contacts/search

payload = { "limit": limit, "properties": ["email", "hs_additional_emails"]}

However the issue is, that I cannot Patch the hs_additional_emails field, as its “calculated” and “read-only”. Chat support dont acknowledge the secondary property as a property.
Anyone been able to remove the secondary emails from a contact via API? or know of a mechanism to bulk remove them?

Hey @LCollom :waving_hand: The endpoints for interacting with Secondary Email addresses live here, on the v1 page:

The limitation you’ll hit is there is not a batch endpoint for Secondary Emails. But, the v1 endpoints are stable and supported.

Best,

Jaycee

Hi @LCollom

here is one approach -
use this curl, this will give you all the emails that have been with the contact. From the response body you can filter out the secondary emails.

curl --request GET \
 --url 'https://api.hubapi.com/crm/v3/objects/contacts/contactId?propertiesWithHistory=email&archived=false' \
 --header 'authorization: Bearer YOUR ACCESS TOKEN'

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!