Batch update contacts using email as idProperty

Hello all,

I’m trying to get some confirmation if it’s possible to do a batch update of contacts using email as an idProperty.

I get an error back saying the property is non-unique, which is weird to me since email is the unique key for contacts, no?

I tried to create another unique property and added some test data and the same API call worked. Shouldn’t it be possible to use email?

Here’s an example payload:
{ “inputs”: [ { “idProperty”: “email”, “id”: “test.test@test.com”, “properties”: { “firstname”: “John”, “lastname”: “Doe” } } ] }

…which gives the following:

{ “status”: “error”, “message”: “Unable to perform update/upsert by non-unique 0-1 property email in portal ID xxxxxxx” … }

Endpoint: https://api.hubapi.com/crm/v3/objects/contacts/batch/update

Hey, @JohanL :waving_hand: That sounds frustrating. I see the documentation indicates this is possible. I’ll set up a really simple test and post back here.

Talk soon! — Jaycee

Running into the same issue. I keep finding posts about how it’s supposed to be possible and then nothing comes of it. In face Jaycee said she was going to test this back in January of 2024 and nothing came of it ( https://community.hubspot.com/t5/APIs-Integrations/Contacts-API-v3-Batch-Update-using-email-as-Unique-Id/td-p/904444 ). I would think HubSpot wouldn’t want folks to query all their contacts they want to update for the ID, and then hit the API again to now update said contacts. Seems like a giant waste of effort and resources. Hopefully Jaycee is able to figure out this issue.

@Jaycee_Lewis, I double this

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 next. But we have our long-awaited conformation. 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.

Thank you for your patience.

Best,

Jaycee

It’s indeed not what I hoped for but it’s good to have confirmation. Thank you for looking into it.

I can’t get this to work anyway I try either. I am trying to use the upsert feature like these folks. The point of upsert is to create or update contacts but it apparently only works if you supply a hubspot ID (not email). Please tell me Hubspot, how am I supposed to get a hubspot ID for a contact that doesn’t exist yet? :sweat_smile:

@JohanL Try this using the v1 APIs. They are quite stable and still supported. The page itself quotes:

“Our APIs are in the midst of a transition. As part of our effort to improve API consistency and completeness, we launched the next generation of HubSpot’s API in early 2020. However, not every endpoint or API has been updated to the latest version, and our older endpoints are still stable and supported.”

Use this v1 batch contacts endpoint:

https://legacydocs.hubspot.com/docs/methods/contacts/batch_create_or_update

Use the following example request body

[
 // assume existing email
 {
 "email": "test+old@hello.com",
 "properties": [
 {
 "property": "email",
 "value": "test+old@hello.com"
 },
 {
 "property": "firstname",
 "value": "User"
 },
 {
 "property": "lastname",
 "value": "Old Updated"
 }
 ]
 },
 // new email
 {
 "email": "test+new@hello.com",
 "properties": [
 {
 "property": "email",
 "value": "test+new@hello.com"
 },
 {
 "property": "firstname",
 "value": "User"
 },
 {
 "property": "lastname",
 "value": "New"
 }
 ]
 }
]

CC: @Jaycee_Lewis - I see a lot of users in the community suffering from the same issue. Maybe you can suggest them with using this.