# Node API: Create Custom Objects with Associations is not saving Associations

**URL:** <https://community.hubspot.com/t/node-api-create-custom-objects-with-associations-is-not-saving-associations/82073>\
**Category:** APIs & Integrations\
**Tags:** developer-tools\
**Created:** [May 25, 2023, 11:41pm UTC](https://community.hubspot.com/t/node-api-create-custom-objects-with-associations-is-not-saving-associations/82073 "2023-05-25T23:41:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SMacias](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@SMacias](https://community.hubspot.com/u/SMacias)\
**Post date:** [May 25, 2023, 11:41pm UTC](https://community.hubspot.com/t/node-api-create-custom-objects-with-associations-is-not-saving-associations/82073/1 "2023-05-25T23:41:13Z")

</div>

I’m working on a script to import my company’s data into Hubspot using the Hubspot Node package.

I’ve encountered the issue of not being able to make custom same-type associations, so my solution is to make a custom object to “bridge the gap” between records of the same type. To keep things neatly organized I’m using this object to associate different-type records in the same association category as well.

The issue I’m having is:  
When creating a new record, I’m passing the object required to generate the record, including properties AND associations, but only the properties are being created - associations are lost.

I’ve taken this bit of code out of my application and tested it in a vacuum, with hard-coded values exactly how the docs describe, and still am having no luck.

 ![2023-05-25_18-33-07.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/5/5e6f97ab1d396a30bb8c492302eed5f0f63a4d5b.png)  
Test

 ![2023-05-25_18-37-01.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/a/ea99685e114d4f2a0fcaa57313c24cf70ff1ce83.png)  
Results

Is there currently a bug in the crm.objects part of the API? Any idea how to solve?

Thanks,

Skylar

---

<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:** [May 27, 2023, 3:32am UTC](https://community.hubspot.com/t/node-api-create-custom-objects-with-associations-is-not-saving-associations/82073/2 "2023-05-27T03:32:25Z")

</div>

Hey, @SMacias 👋 Thanks for your question.

Can you add your example using the code block tool, please? It’s hard for the community to troubleshoot our code from a screenshot.

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![SMacias](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@SMacias](https://community.hubspot.com/u/SMacias)\
**Post date:** [May 30, 2023, 6:29pm UTC](https://community.hubspot.com/t/node-api-create-custom-objects-with-associations-is-not-saving-associations/82073/3 "2023-05-30T18:29:08Z")

</div>

Sure, here it is:

`const hubspot = require('@hubspot/api-client')playground()async function playground(){ const config = { accessToken: 'xxx-xxx-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', numberOfApiCallRetries: 3 } var hubspotClient = new hubspot.Client(config); var objectType = "investments" var SimplePublicObjectInputForCreate = { properties: { name: 'Test Investment', entity_type: 'Company' }, associations: [{ "to": {"id": "15766174075"}, "types":[{"associationCategory":"USER_DEFINED","associationTypeId": 157}] }, { "to": {"id": "15609171770"}, "types":[{"associationCategory":"USER_DEFINED","associationTypeId": 159}] } ] } var res = await hubspotClient.crm.objects.basicApi.create(objectType, SimplePublicObjectInputForCreate); console.log(res);}`

---

<div class="post-metadata">

**Author:** ![OM19](https://avatars.discourse-cdn.com/v4/letter/o/c2a13f/32.png) [@OM19](https://community.hubspot.com/u/OM19)\
**Post date:** [July 28, 2026, 8:03am UTC](https://community.hubspot.com/t/node-api-create-custom-objects-with-associations-is-not-saving-associations/82073/4 "2026-07-28T08:03:22Z")

</div>

Has this issue been resolved?

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [July 28, 2026, 10:07am UTC](https://community.hubspot.com/t/node-api-create-custom-objects-with-associations-is-not-saving-associations/82073/6 "2026-07-28T10:07:48Z")

</div>

Hi @OM19 and welcome back, so nice to see you again! 🧡

Thanks for checking with the HubSpot Community!

Usually, the most common cause of associations being silently dropped is an **incorrect `associationTypeId`**.

I’d suggest checking the following please:

- **`associationTypeId` must be correct for your custom object.** For custom objects, these IDs are not the standard HubSpot-defined ones, you need to retrieve them via a **`GET`** to **`/crm/associations/2026-03/{fromObjectType}/{toObjectType}/labels/`**. Using a wrong ID won’t throw an error; associations are just silently ignored.

- **`associationCategory` must match the type.** Use **`USER_DEFINED`** for custom association labels, **`HUBSPOT_DEFINED`** for default ones.

- **The association type must be pre-defined** between the two object types via the schemas API before you can use it in a create request.

Here are some resources for more details:

- [Associate records - HubSpot docs](https://developers.hubspot.com/docs/api-reference/latest/crm/associations/associate-records/guide)
- [Custom object records API guide - HubSpot docs](https://developers.hubspot.com/docs/api-reference/latest/crm/objects/custom-objects/guide)
- [Configure associations - HubSpot docs](https://developers.hubspot.com/docs/api-reference/latest/crm/associations/associations-schema/guide)

I’d love to hear the insights from our Top Experts: Hi @Anton and @evaldas do you have suggestions to help @OM19, please?

Thanks so much and wishing you a brilliant day!  
Bérangère

_This post was created with the assistance of AI tools_

---

<div class="post-metadata">

**Author:** ![OM19](https://avatars.discourse-cdn.com/v4/letter/o/c2a13f/32.png) [@OM19](https://community.hubspot.com/u/OM19)\
**Post date:** [July 29, 2026, 12:33am UTC](https://community.hubspot.com/t/node-api-create-custom-objects-with-associations-is-not-saving-associations/82073/8 "2026-07-29T00:33:03Z")

</div>

This issue was raised 3 years ago, and there’s no definitive answer? If it’s a payload issue, then the API should not return an OK status, that’s misleading. I will try creating the associations separately now, but I also see there are people saying that doesn’t work either, that you have to create the association one by one.

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [July 29, 2026, 7:56am UTC](https://community.hubspot.com/t/node-api-create-custom-objects-with-associations-is-not-saving-associations/82073/9 "2026-07-29T07:56:26Z")

</div>

Hi @OM19 and thanks for your valuable feedback, I’ve passed it along internally.

Creating associations separately via POST [/crm/v3/associations/{fromObjectType}/{toObjectType}/batch/create](https://developers.hubspot.com/docs/api-reference/legacy/crm/associations/v3/associate-records#create-associations) is a great alternative, it supports batching up to multiple associations per request, not just one at a time.

But please let us know if you run into any challenges while using this endpoint, feel free to share more details here (like the method used, the body and the response, without any confidential nor sensitive data), and we’ll work with you to find the best path forward.

We appreciate you bringing this up, thank you.

Bérangère

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [July 31, 2026, 11:08am UTC](https://community.hubspot.com/t/node-api-create-custom-objects-with-associations-is-not-saving-associations/82073/11 "2026-07-31T11:08:25Z")

</div>

Automatically bumped on July 31, 2026, 11:08am UTC


