Get every contact associated with a company, regardless of whether the contact is primary or not.

Hi team,

I could need to fetch all the contacts associated with a company, regardless of whether the contact is primary or not using batch association API.

https://api.hubapi.com/crm/v3/associations/Companies/Contacts/batch/read

{

"inputs": \[

    {

        "id": "...."

    },

    {

        "id": "...."

    }]

}

This API fetch only the Primary Contacts of the Company.

All the other Contacts are ignored.

Is there any way, I can get all the Contacts of Company through batch read Association API?

Hey, you need to make a call to the /crm/v3/objects/companies/{companyId}?associations=contacts then use the result to populate the ids for your batch call to contacts /crm/v3/objects/contacts/batch/read
This way you’ll be getting all the associated contacts of a company then you’ll be retrieving the info of the contacts which is associated to the company.

Thanks for the reply @ChrisMagtoto!

This might be a better solution, if we just had to deal with one Contact/Company,

It won’t be an optimized way in my case, though, as I’ll have to retrieve the Contact association for hundreds of Companies.

Is there a way that we could use Batch Association and achieve the same?

Yes. You can use the batch endpoint for the Associations but if you need to retrieve the properties of the contacts then you will still need to call the batch endpoint for the Contacts object. You’ll still make 2 calls (Associations “associations/companies/contacts/batch/read” & Contacts endpoints) in the API to retrieve the data of a batch contacts.

But that’s the issue here @ChrisMagtoto .
We don’t get the non-primary associations in the batch association endpoint. (‘associations/companies/contacts/batch/read’)

I see. Then you can use v4 for that.
/crm/v4/associations/companies/contacts/batch/read