HubSpot associations API returns empty contact objects

I’m working with the @hubspot/api-client package version 8.1.0 in Node.js and running into issues when trying to get contacts linked to deals.

Here’s my test code:

const opportunities = await DataService.getOpportunitiesByPhase('Contract Signed', 500, 50, item => true);
const contactsData = {};

for (let opportunity of opportunities) {
    console.log(`Working on opportunity ${opportunity.id}`);
    const linkedContacts = await DataService.hubspotClient.crm.deals.associationsApi.getAll(opportunity.id, 'contact');
    contactsData[opportunity.id] = linkedContacts.results;
}

await fs.writeFile('./output.json', JSON.stringify(contactsData, null, 2));

The getOpportunitiesByPhase function works perfectly and returns deals correctly. I can see each deal ID being processed in the console.

However, the associationsApi.getAll call behaves strangely. Instead of getting actual contact data, I receive empty objects with no properties at all. The response contains the right number of items but they’re completely empty. Here’s what the output looks like:

"4521789123": [],
"4521654987": [
  {}
],
"4521432156": [
  {},
  {}
],
"4521876543": [],

I expected to get contact IDs and other properties, but the objects are totally blank. I also tried using ‘contacts’ instead of ‘contact’ but got identical results. What could be causing this behavior?

yep, that sounds right. the associations api just gives you references, not full contact data. those empty objs are like placeholders. u gotta pull the contact details separately using those ids to actually see the info.