# batch association PHP API

**URL:** <https://community.hubspot.com/t/batch-association-php-api/72915>\
**Category:** APIs & Integrations\
**Tags:** starter\
**Created:** [January 15, 2023, 10:47am UTC](https://community.hubspot.com/t/batch-association-php-api/72915 "2023-01-15T10:47:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GPanisi](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@GPanisi](https://community.hubspot.com/u/GPanisi)\
**Post date:** [January 15, 2023, 10:47am UTC](https://community.hubspot.com/t/batch-association-php-api/72915/1 "2023-01-15T10:47:40Z")

</div>

Hello, I’m trying to get all associations between contacts and companies by using a single call (right now I’m using several API calls, one for each contact).

This is the code I’ve tried:

`$hs_client->crm()->associations()->BatchApi()->read('contacts', 'companies', null)`

But I’m getting an exception:

`{"status":"error","message":"Invalid JSON input: a request body was expected, but none found","correlationId":"fc8d408f-17fb-4fe2-b4b4-6d05588e2f4f","category":"VALIDATION_ERROR"}`

Can anyone help?

Thank you!

---

<div class="post-metadata">

**Author:** ![Syeda\_Fatima](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/syeda_fatima/32/36951_2.png) [@Syeda\_Fatima](https://community.hubspot.com/u/Syeda_Fatima)\
**Post date:** [January 16, 2023, 9:26am UTC](https://community.hubspot.com/t/batch-association-php-api/72915/2 "2023-01-16T09:26:51Z")

</div>

Hey @GPanisi, It looks like you need to pass in the list of contact and company IDs you want to get the associations for.

You can pass in an array of objects, where each object contains the IDs you want to get the associations for.  
\<code\>[  
{  
“contacted”: “123”,contacted  
“companyId”: “456”  
},  
{  
“contactId”: “789”,  
contacted “companyId”: “012”  
}  
]  
\</code\>
