APIs & Integrations

sandhiyadoss
Participant

Duplicate records in Contact with Hubspot api

SOLVE

Hi,

I created a contact and merge that contact in Hubspot.

When I tried to get contact module data by using API, I am getting two contacts with different 'vid', but the same 'canonical-vid'. But getting two records of the contact in Hubspot API. 

 

But there is only one record in Hubspot after merged contact.

 

Can you please check this?

 

0 Upvotes
1 Accepted solution
kcraft
Solution
Participant

Duplicate records in Contact with Hubspot api

SOLVE

I've had the same issue, when trying to pull all contacts I get some duplicates, and you can't just filter out any that have mismatched vid and cannonical-vid because that will remove some that aren't duplicates. I've added a check to add to my array those canonical-vids that aren't already in my array, which gives me the complete, non-duplicate list of contacts. example:

if (vids.includes(canonicalvid)) {
          Logger.log(vid+' '+canonicalvid);
  
} else {
  contacts.push([/*your hubspot data here*/]);
  vids.push(canonicalvid)
}

View solution in original post

3 Replies 3
Jaycee_Lewis
Community Manager
Community Manager

Duplicate records in Contact with Hubspot api

SOLVE

Hi, @sandhiyadoss  👋 Thanks for reaching out. Can you provide any additional details, code snippets, or screenshots to help provide our community with additional information, please?

 

In this case, having the following will be helpful for the community:

  • the specific endpoint you are using
  • an example Response 
  • how did you perform the merge — did you do the merge in-app?

Thank you! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
sandhiyadoss
Participant

Duplicate records in Contact with Hubspot api

SOLVE

Hi @Jaycee_Lewis, I used legacy API from Hubspot. I used this endpoint

(https://api.hubspot.com/contacts/v1/lists/all/contacts/all&count=100)  and we merge those contact in-app.  In API, I received two contacts with different 'vid' and 'addedAt'. But the same 'canonical-vid' and "merge-audits".

 

 

0 Upvotes
kcraft
Solution
Participant

Duplicate records in Contact with Hubspot api

SOLVE

I've had the same issue, when trying to pull all contacts I get some duplicates, and you can't just filter out any that have mismatched vid and cannonical-vid because that will remove some that aren't duplicates. I've added a check to add to my array those canonical-vids that aren't already in my array, which gives me the complete, non-duplicate list of contacts. example:

if (vids.includes(canonicalvid)) {
          Logger.log(vid+' '+canonicalvid);
  
} else {
  contacts.push([/*your hubspot data here*/]);
  vids.push(canonicalvid)
}