API calls creates duplicated companies



Hi, I’ve faced a strange issue - in some cases creating a contact via API leads to creating a duplicated company in Hubspot. A simple test shows that association works correctly by company domain name, so there must be some more elaborated scenarios. Has anybody seen such problem? Is there a way to completely prohibit creating of duplicated companies via API and always associate the by domain?


Hi @andrey,

Can you post a link to an example contact that created a duplicate company, and the pre-existing company so that I can do some troubleshooting?


Hi @Derek_Gervais ,
Here are the links to two duplicated companies https://app.hubspot.com/sales/2377843/company/632482321/ and https://app.hubspot.com/sales/2377843/company/529007197/ . From history you can see that both of them were created via API, though instead of creating the contact under existing one (with the same domain) the new company was created. Unfortunately, I don’t have any history/logs to better understand what happened there.

Thanks for your help,


Hi @andrey,

It looks like both of those company records were created automatically as a result of two different contact records. Similar to how contacts are deduplicated by email, company records are deduplicated by company domain. Since their associated contacts have different email domains, they weren’t associate to the same companies. Both of those companies have unique company domain names, so in HubSpot they aren’t considered duplicates. The following Knowledge Base article has some more details on how this process works:


Hi @Derek_Gervais, could you please clarify how did you find that these companies have different domains? When I go to each of them I see name and just below it domain. It is exactly the same for both of them. Is it some different thing?


Hi @andrey,

To be completely honest with you, I dug into the companies above and their associated contacts for a long time. I wasn't able to identify any tangible differences in them. This is particularly strange considering I have an extremely vivid memory of seeing different company domains 11 days ago when I responded to you the first time. Odd stuff.

Anyway, apologies for the confusion; I'll dig into this tomorrow to try and identify what might have happened with those two companies. I'll update this thread when I have more information on the subject.


Hey @Derek_Gervais, thanks for looking into the issue! Regarding the companies - it is pretty good chance that they were having the same domains from the beginning as otherwise they wouldn't get displayed in our report. Let me know if I can somehow help with the investigation.


Hi @andrey,

Ok, thanks for your patience. After digging in further, it looks like while the associated contacts were created via API, these companies were actually created manually, and had their information filled in by HubSpot Insights. When creating contacts via the API, do you do any company association?


Hi @Derek_Gervais,
Now I'm a bit confused. I thought that the 'API' displayed in 'source' column means that company was created using some API call. Here's a screenshot of what I see in the table for these two companies:

So both cases are pretty similar and though I'm not sure that my understanding is correct, I think that first was created a contact (each company has exactly one of them) and then after some time the company is created. Why it is created at all after that time is not clear for me and I am pretty sure we don't do any API calls to create companies or associate contacts with them (though I will double check that). We might be passing company name/domain in the REST call, I will check the logs for this case if I still can find them.
Can you share the correct way to determine how the company was created?


Hi @andrey,

I understand, this seems to be where the confusion is coming from. The original source company properties are different from the original source contact properties. For companies, the original source properties reflect the source info for the contact with the earliest activity for this company, not the source info for the company record itself. These companies earliest associated contacts were both created via API, but the records themselves were created manually.