# Create Associations When Calling /crm/v3/objects/contacts/batch/upsert

**URL:** <https://community.hubspot.com/t/create-associations-when-calling-crm-v3-objects-contacts-batch-upsert/117371>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [September 30, 2024, 7:53pm UTC](https://community.hubspot.com/t/create-associations-when-calling-crm-v3-objects-contacts-batch-upsert/117371 "2024-09-30T19:53:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anya23](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@Anya23](https://community.hubspot.com/u/Anya23)\
**Post date:** [September 30, 2024, 7:53pm UTC](https://community.hubspot.com/t/create-associations-when-calling-crm-v3-objects-contacts-batch-upsert/117371/1 "2024-09-30T19:53:25Z")

</div>

Are you not also able to create associations when upserting? Seems deficient. I tried adding an associations object, but it appears it was ignored.

When calling the v3 or v4 associations endpoint, can you reference the objects by their unique identifier instead of HubSpot ID? I tried adding idProperty, but it still doesn’t recognize the unique id.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [October 1, 2024, 3:58pm UTC](https://community.hubspot.com/t/create-associations-when-calling-crm-v3-objects-contacts-batch-upsert/117371/2 "2024-10-01T15:58:44Z")

</div>

Hey, @Anya23 👋 Thanks for your questions. For Q1, I have another thread with folks having issues using unique IDs and the Upsert endpoint. Can you share a simple request, response, and error message, please? For Q2, the [**documentation**](https://developers.hubspot.com/docs/api/crm/associations) doesn’t offer unique ID as an option for adding or requesting associations.

Thanks for the additional info. — Jaycee

---

<div class="post-metadata">

**Author:** ![dannio](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dannio/32/95715_2.png) [@dannio](https://community.hubspot.com/u/dannio)\
**Post date:** [January 8, 2025, 9:46am UTC](https://community.hubspot.com/t/create-associations-when-calling-crm-v3-objects-contacts-batch-upsert/117371/3 "2025-01-08T09:46:34Z")

</div>

[@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074) I was able to referene a unique property when upserting a custom object, but as with @Anya23 here, the associations seems to be ignored.

The associations are available on the update/create batch requests but seems to have been missed off on this endpoint.

---

<div class="post-metadata">

**Author:** ![athompson\_gs](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@athompson\_gs](https://community.hubspot.com/u/athompson_gs)\
**Post date:** [March 13, 2025, 6:59pm UTC](https://community.hubspot.com/t/create-associations-when-calling-crm-v3-objects-contacts-batch-upsert/117371/4 "2025-03-13T18:59:05Z")

</div>

I am seeing the same issue. The upsert will update/create the contact, but no associations are made. In my case I am trying to associate a contact to a custom object. Here is an example body:

```lia-code-sample
{inputs: [
 {
 "idProperty": "email",
 "id": "melissa@gmail.com",
 "properties": { "email": "melissa@gmail.com" },
 "associations": [
 {
 "types": [
 { "associationCategory": "USER_DEFINED", "associationTypeId": 57 }
 ],
 "to": { "id": "12345" }
 }
 ]
 },
 {
 "idProperty": "email",
 "id": "corey@gmail.com",
 "properties": { "email": "corey@gmail.com" },
 "associations": [
 {
 "types": [
 { "associationCategory": "USER_DEFINED", "associationTypeId": 57 }
 ],
 "to": { "id": "12345" }
 }
 ]
 }
]}

```

---

<div class="post-metadata">

**Author:** ![cwng](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@cwng](https://community.hubspot.com/u/cwng)\
**Post date:** [March 19, 2025, 12:22am UTC](https://community.hubspot.com/t/create-associations-when-calling-crm-v3-objects-contacts-batch-upsert/117371/5 "2025-03-19T00:22:57Z")

</div>

Did you get an answer on this? when i call batch update, the association is also ignored. this is problematic because if i upsert a new contact, hubspot by default will create a company with the domain, which could be not the company’s actual domain. if i don’t let hubspot create a company automatically, if someone were to create a contact in the UI, it will not have a company. love your experience.

---

<div class="post-metadata">

**Author:** ![athompson\_gs](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@athompson\_gs](https://community.hubspot.com/u/athompson_gs)\
**Post date:** [March 20, 2025, 8:40pm UTC](https://community.hubspot.com/t/create-associations-when-calling-crm-v3-objects-contacts-batch-upsert/117371/6 "2025-03-20T20:40:02Z")

</div>

When using the batch upsert endpoint for contacts, there appears to be a discrepancy between the documented functionality and actual implementation regarding associations. The issue is likely that associations require both objects to exist before the association can be created. While the upsert endpoint creates/updates the contact, the association creation appears to be failing silently.

Here are a few approaches you could try:

Split your operation into two API calls:

First, use the batch upsert endpoint to create/update contacts

Then, use the associations endpoint to create the relationships once you have the contact IDs

Consider using the CRM Associations API specifically:

POST /crm/v4/associations/{fromObjectType}/{fromObjectId}/{toObjectType}/{toObjectId}/{associationTypeId}

Check if you’re using the correct association type ID for your custom object. For custom objects, you may need to use a specific association type ID that matches your schema.

---

<div class="post-metadata">

**Author:** ![cwng](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@cwng](https://community.hubspot.com/u/cwng)\
**Post date:** [March 20, 2025, 9:35pm UTC](https://community.hubspot.com/t/create-associations-when-calling-crm-v3-objects-contacts-batch-upsert/117371/7 "2025-03-20T21:35:34Z")

</div>

Thank you. Indeed. The downside of separating into two steps, is that you then need to disable the automatic creation of companies based on domain, because some contacts have a different email than the company, e.g. contacts could have a regional email, e.g. [example.co.uk](http://example.co.uk)\<\> while the main domain is [example.com](http://example.com)\<\>. If we first created [example.com](http://example.com)\<\>, and then later upsert [bob@example.co.uk](mailto:bob@example.co.uk), specifying the association to [example.com](http://example.com), I was hoping, as the documentation says, that [example.co.uk](http://example.co.uk)\<\> company would not be created. If upsert doesn’t work with association, then we have to disable automatic creation of companies based on domain. And then worry about creation of contacts that don’t have a company and then create a company via a script.
