# Batch Association Create Method Is Not Working in API V3 (Returns Empty Array in Results)

**URL:** <https://community.hubspot.com/t/batch-association-create-method-is-not-working-in-api-v3-returns-empty-array-in-results/57542>\
**Category:** APIs & Integrations\
**Tags:** companies, contacts\
**Created:** [May 23, 2022, 5:39pm UTC](https://community.hubspot.com/t/batch-association-create-method-is-not-working-in-api-v3-returns-empty-array-in-results/57542 "2022-05-23T17:39:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CMetaliya](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@CMetaliya](https://community.hubspot.com/u/CMetaliya)\
**Post date:** [May 23, 2022, 5:39pm UTC](https://community.hubspot.com/t/batch-association-create-method-is-not-working-in-api-v3-returns-empty-array-in-results/57542/1 "2022-05-23T17:39:51Z")

</div>

I’m working on a nodejs application and integrating hubspot in it.

While creating association between multiple contacts to a single company, it returns an empty array as result.

I’m referring to these documentation.

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Fcrm-associations-v3%2Fguide)**

Here’s my code.

 ![Capture.PNG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/1/2/12d5c32b9c0bdfccf49709ce2cb556cb8bc342fe.png)

Here’s the response that I’m getting on call.

 ![Capture.PNG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/0/40d3d99ee934d01ffe0cc891a5a9d2f7a82d306e.png)

As you can see, my results array is empty. I’m not being able to figure out what’s wrong here? I’m sending same object as mentioned in documentation then why is it not being able to create association?

I also checked in hubspot GUI, and there’s no association present between any of the contacts to any companies.

Any help would be highly appreciated. Thanks.

---

<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 23, 2022, 11:33pm UTC](https://community.hubspot.com/t/batch-association-create-method-is-not-working-in-api-v3-returns-empty-array-in-results/57542/2 "2022-05-23T23:33:50Z")

</div>

Hi, @CMetaliya Thanks for the great question. And thanks for the screenshots 🙌 It’s always super helpful for our community when they are provided.

Hey, @himanshurauthan @rlopez @miljkovicmisa do you have any insight or next steps for @CMetaliya?

Thank you very much! – Jaycee

---

<div class="post-metadata">

**Author:** ![lindahl](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/lindahl/32/220871_2.png) [@lindahl](https://community.hubspot.com/u/lindahl)\
**Post date:** [May 24, 2022, 2:02am UTC](https://community.hubspot.com/t/batch-association-create-method-is-not-working-in-api-v3-returns-empty-array-in-results/57542/3 "2022-05-24T02:02:06Z")

</div>

@CMetaliya Can you please try using **singular** instead of **plural?**

```lia-code-sample
const fromObjectType = "contact";
const toObjectType = "company";

```

I’ve tried following and seems like it’s working

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/5/5/550489db0417b9c73d4800fd382b4af479946e6a.png)

---

<div class="post-metadata">

**Author:** ![CMetaliya](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@CMetaliya](https://community.hubspot.com/u/CMetaliya)\
**Post date:** [May 24, 2022, 7:31am UTC](https://community.hubspot.com/t/batch-association-create-method-is-not-working-in-api-v3-returns-empty-array-in-results/57542/4 "2022-05-24T07:31:25Z")

</div>

Now getting this error after passing fromObjectType and toObjectType as you suggested.

Apart from changing Companies to company and Contacts to contact, I’ve not changed anything.

 ![Capture.PNG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/5/d51b265a91e9eda8a2ec65da402e50d8b1c218b6.png)

---

<div class="post-metadata">

**Author:** ![LMeert](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/lmeert/32/103847_2.png) [@LMeert](https://community.hubspot.com/u/LMeert)\
**Post date:** [May 24, 2022, 8:49pm UTC](https://community.hubspot.com/t/batch-association-create-method-is-not-working-in-api-v3-returns-empty-array-in-results/57542/5 "2022-05-24T20:49:46Z")

</div>

Hi @CMetaliya,  
Just had a look at the thread, and you were right to use contact **s** and compan **ies,** using plural as fromObjectType and toObjectType. That is why in the first place you were at least receiving a response from the endpoint (and in the second instance you’re just receiving an error code from the server because the API call is incorrect).  
Now, I’m no NodeJS expert, but I’m having a look at the [documentation](https://developers.hubspot.com/docs/api/crm/associations/v3) and it looks like you have a syntax problem, you have the “inputs” between quotes whereas you should drop them :

 ![LMeert_0-1653425258268.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/e/9e46690e63fdeb59c817333e912fe4bace8ff878.png)

Can you please try to stick with that syntax and see if that solves your problem ?  
Don’t hesitate to mark this as a solution to help others facing the same issue !  
Best,

Ludwig

---

<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 24, 2022, 8:55pm UTC](https://community.hubspot.com/t/batch-association-create-method-is-not-working-in-api-v3-returns-empty-array-in-results/57542/6 "2022-05-24T20:55:09Z")

</div>

Nice work, @LMeert. Thanks for taking the time to respond 🙌

Best – Jaycee

---

<div class="post-metadata">

**Author:** ![LMeert](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/lmeert/32/103847_2.png) [@LMeert](https://community.hubspot.com/u/LMeert)\
**Post date:** [May 24, 2022, 8:58pm UTC](https://community.hubspot.com/t/batch-association-create-method-is-not-working-in-api-v3-returns-empty-array-in-results/57542/7 "2022-05-24T20:58:05Z")

</div>

Hey [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074),  
Thanks, I got a request to have a look at this in my DMs but was in meetings all day 😵  
But glad I could help in the end !
