Try this using the v1 APIs. They are quite stable and still supported. The page itself quotes:
"Our APIs are in themidst of a transition. As part of our effort to improve API consistency and completeness, we launchedthe next generation of HubSpot’s APIin early 2020.However, not every endpoint or API has been updated to the latest version, and our older endpoints are still stable and supported."
Contacts API v3 Batch Update using email as Unique Id
I would really like to know when HubSpot intends to fix this. The v1 batch interface only reples with a 202 and provides no token or route which you can use in order to track the request's completion. That makes it difficult to get the ids of newly created contacts. The v3 upsert route will create the contact but will only add the email address and ignores all other contact properties passed with the POST request. It does reply with the ids of the newly created contact records. So you then have to use that information and do a separate batch update to get the remaining information into the record.
Since email was not working as a unique field, I explicitly made another unique field `emailCopy` and then tried hitting the endpoint using that field, but still got the following error message.
Contacts API v3 Batch Update using email as Unique Id
Hey, @DSmith95 and @zach_threadint👋 I submitted this to the dev doc team with an increased urgency. I'll post here as soon as I get a working example or get it confirmed that this specific endpoint won't work using email as a unique property.
Contacts API v3 Batch Update using email as Unique Id
Hey y'all. I have an update — this is confirmed not possible.
I worked with the docs team to get the documentation updated. Next, I need to track down the team that owns the endpoints tab examples and get that updated. But we have our long-awaited confirmation. I know this is not the answer we were hoping for, and I am grateful that the documentation won't send anyone else on a wild goose chase using a method that isn't possible.
I've been able to replicate the issue you've described.
While it does say within the relevant API documentation, that "You can update contacts individually or in batches. For existing contacts, email and record ID are both unique values, so you can use id or email to update contacts via API", it doesn't actually supply an example of how this can be achieved on the Batch Update Contacts operation. I know it's possible to achieve on the Update Contact (single) operation, but, unfortunately, it looks like it's not possible on the Batch Update Contacts operation.
You may have to first use the CRM Search API to find the relevant internal HubSpot Contact IDs before batch updating the Contacts.
I hope this proves useful. Please let me know if you have any follow-up questions.
All the best,
Zach
--
Zach Klein HubSpot Integrations & App Developer Meanjin / Brisbane, Australia
Contacts API v3 Batch Update using email as Unique Id
Hey, @DSmith95 thanks for flagging this. And thanks to @zach_threadint for reproducing the issue. I'm going to make an example of my own, and I'll see if I can get us a definite answer or a documentation update, if needed.