Get all contacts search by company not returning ALL contacts

Doing a search for contacts based on their `associatedcompanyid` is not returning ALL of the contacts. In the CRM there are 3 contacts on the company but only 2 are being returned via the API. Checking the missing contact I can see their `associatedcompanyid` is different - all 3 contacts are associated with multiple companies - is this expected? Is there a property that has all of the contacts associated company IDs?

My example request is:

curl --location --request POST 'https://api.hubapi.com/crm/v3/objects/contact/search?hapikey=API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
 "filterGroups": [
 {
 "filters": [
 {
 "operator": "EQ",
 "propertyName": "associatedcompanyid",
 "value": "6101168988"
 }
 ]
 }
 ],
 "properties": [
 "email",
 ],
 "limit": 30
}'

@SJohnson53 , if you are looking to get all contacts associated with a company, I would suggest employing the associations endpoint

Thanks - this worked - I got the associations then batch read the contacts - cheers!

Hi @SJohnson53 ,
Kinldy use the below code:
curl --location --request POST ‘https://api.hubapi.com/crm/v3/objects/contact/search?hapikey=API_KEY’ \
--header ‘Content-Type: application/json’ \
--data-raw ‘{
“filterGroups”: [
{
“filters”: [
{
“operator”: “EQ”,
“propertyName”: “associations.company”,
“value”: “<companyID>”
}
]
}
],
“properties”: [
“email”,
],
“limit”: 30
}’

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.