Contacts API Batch Upsert return 409 instead of 207
When making an API request to https://api.hubapi.com/crm/v3/objects/contacts/batch/upsert, if a contact with the same email already exists, the response returns a 409 Conflict for the entire request, instead of attempting to upsert the other entries and returning a 207 status code indicating specific errors for problematic inputs.
However, the documentation states that a 207 status code is a possible response and even suggests the inclusion of "objectWriteTraceId" for tracing the request. Reference: HubSpot API Documentation .
Is this behavior an error, or is there something I'm misunderstanding?
Contacts API Batch Upsert return 409 instead of 207
Any news? I'm running in the same issue. Sometime upsert gives me 409, sometimes it works as expected. The endpoint should never return 409 accroding to the doc!
{
"status": "error",
"message": "A contact with the email 'test@test.com' already exists. Existing ID: 64732954744",
"correlationId": "5a79dc4e-1979-4455-8871-60f8e78b30b1",
"category": "CONFLICT"
}
The entire request is rejected with a 409 Conflict status because one of the emails, test@test.com, is already associated with a different contact (ID: 64732954744). Although the second contact (rodrigo@test.com) does not exist and could be successfully created, the batch request fails as a whole due to the conflict with the duplicate email.
Contacts API Batch Upsert return 409 instead of 207
Looks like I get the same error when one contact already exists:
That said, I double checked my CRM and I noticed that a different contact has the '67890' value in the unique identifier field. If I change the value I am trying to add, it successfully runs with the same email address:
Could you check that no other objects in your CRM have the custom_person_id set to "723073"? Is your goal to set the custom person ID on the test@test.com record?
Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth. Learn More
Contacts API Batch Upsert return 409 instead of 207
Hello! Thank you for your response. However, that doesn’t apply to my case. I am working with a different custom_person_id. The issue is that the email is already associated with another contact. The main problem, though, is that I'm receiving a 409 status code, and none of the contacts are being updated or created. According to the documentation, I should be receiving a 207 response with both a success array and an errors array. This behavior can also be observed in your test. All objects in the request are rejected when a 409 is returned.
I tend to agree with @VMendonça -- given the API docs suggest a 207 multi-status response is possible for this endpoint, I would expect to receive this response in the case outlined by @VMendonça.
All the best,
Zach
--
Zach Klein HubSpot Integrations & App Developer Meanjin / Brisbane, Australia