APIs & Integrations

VMendonça
Member

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?

0 Upvotes
12 Replies 12
rs-michele
Member

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!

0 Upvotes
EMårtensson
Participant

Contacts API Batch Upsert return 409 instead of 207

I am also facing this issue! 🙂

0 Upvotes
kennedyp
Community Manager
Community Manager

Contacts API Batch Upsert return 409 instead of 207

Thanks for your post @VMendonça

 

Could you provide an example request and response body for one of these calls? Be sure to omit the email value used and your auth code for privacy!

 

I'd be happy to check the request to verify if this is expected behavior. 

 

Best, 
Kennedy 


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

0 Upvotes
VMendonça
Member

Contacts API Batch Upsert return 409 instead of 207

Sure! Here it is:

 

Request:

POST https://api.hubapi.com/crm/v3/objects/contacts/batch/upsert

 

{
    "inputs": [
        {
            "objectWriteTraceId": "723073",
            "properties": {
                "firstname": "Milene",
                "email": "test@test.com"
            },
            "id": "723073",
            "idProperty": "custom_person_id"
        },
        {
            "objectWriteTraceId": "727526",
            "properties": {
                "firstname": "Rodrigo",
                "email": "rodrigo@test.com"
            },
            "id": "727526",
            "idProperty": "custom_person_id"
        }
    ]
}

 

Response: 409 Conflict

 

{
    "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.

0 Upvotes
kennedyp
Community Manager
Community Manager

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 Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

0 Upvotes
VMendonça
Member

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.

0 Upvotes
kennedyp
Community Manager
Community Manager

Contacts API Batch Upsert return 409 instead of 207

@VMendonça do you mind sharing the part of the documentation you are referencing? I want to be sure we are on the same page! 😊

 

 

I'd also like to invite some of our experts for their insight! Hey @SteveHTM, @zach_threadint, @Bortami, @ChrisoKlepke do y'all know if we are doing anything wrong here? 

 

Best, 
Kennedy


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

0 Upvotes
zach_threadint
Guide

Contacts API Batch Upsert return 409 instead of 207

Hi @kennedyp 👋

 

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



Say g'day


If my post helped answer your query, please consider marking it as a solution.


VMendonça
Member

Contacts API Batch Upsert return 409 instead of 207

Here it is

VMendona_0-1729639302276.png

 

0 Upvotes
kennedyp
Community Manager
Community Manager

Contacts API Batch Upsert return 409 instead of 207

I appreciate your patience. I shared this with the team that owns this endpoint. I don't have an update at this time, but if I do I'll add it here. 

 

Best, 
Kennedy


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

0 Upvotes
kennedyp
Community Manager
Community Manager

Contacts API Batch Upsert return 409 instead of 207

Thanks for the confirmation, y'all! I am checking in with the team that manages this API to verify 😁


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

EMårtensson
Participant

Contacts API Batch Upsert return 409 instead of 207

Hi, is there any update to share? 🙂 We are also being hindered by this

0 Upvotes