Update contact during import

PSzatan
Member

In short, I am in the process of creating / testing an application that aims to create Contacts in HubSpot CRM, using the HubSpot API, for orders from our internal billing systems.

According to your documentation:

"...

When added via imports, form submissions, or API, if a contact already exists in your account with the same email address, the new contact information will be added to the existing contact record. For example, if you import a list of contacts that includes admin@hubspot.com, and an existing contact in your HubSpot account already has the email address admin@hubspot.com, the imported information will be added to that contact record.

... "

I expect if I use these 2 endpoints

- POST / crm / v3 / objects / contacts

- POST / crm / v3 / objects / contacts / batch / create

if the created contact has an email address existing in CRM, the existing contact in HubSpot CRM will be updated. This is what happens if I use the import function on your portal (for example importing a csv file with contacts). When I am using the HubSpot API directly, I get the following error message:

HTTP 409

{

  "status": "error",

  "message": "Contact already exists. Existing ID: 1451",

  "correlationId": "0564bb77-bdcc-4fbb-b51a-de21c109f3c4",

  "category": "CONFLICT"

}.

Can I ask you for help in solving this puzzle?

0 Upvotes
2 Replies 2
TiphaineCuisset
Community Manager

Hi @PSzatan 

 

Thank you for reaching out.

 

I want to tag some of our experts on this - @lynton @miljkovicmisa do you know what could be happening here? 

 

Thank you!

Best

Tiphaine


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


0 Upvotes
miljkovicmisa
Top Contributor | Gold Partner

Hello @PSzatan , hi @TiphaineCuisset ,
this happens because you are using the "POST" method on this endpoint which is not used for updating contacts, in order to update a contact you should use the "PATCH" method on this endpoint. So when you create your contacts you should add a condition that checks the response code and if it is 409 then do another call with the "PATCH" method.

Documentation that shows the 409 error for the conflict, you can find it in this link down in the "Response details" section.

Also one advice I see a lot of people are having issues with the inconcistancy of the API versions, always look in the legacy docs, they seem to be much better documented and chances are you'll find what you need there.

If my answer was helpful please mark it as a solution.