Retrieving Companies, Contacts and Emails in API

Hello @GFrewin
To get the email addresses of contacts associated with a company using the HubSpot API, you need to use an additional endpoint to fetch the contact properties. Here’s an example URL that will return a list of companies with their associated contacts and their email addresses:

https://api.hubapi.com/crm/v3/objects/companies?includeAssociations=true&associations=contacts&properties=name&properties=lifecyclestage&properties=associatedcompanyid&properties=email&limit=100

I’ve added the following parameters:

  • includeAssociations=true tells the API to include associations in the response
  • associations=contacts tells the API to include contacts associated with the companies in the response
  • properties=associatedcompanyid tells the API to include the company ID on each contact record
  • properties=email tells the API to include the email property on each contact record

Note that we’ve also added a limit parameter to limit the number of results to 100. You can adjust this parameter to get more or fewer results per page.
When you make this API call, you should receive a JSON response containing an array of companies with their associated contacts and their email addresses. You can then parse the response to extract the data you need.
Thanks & Regards
Himanshu Rauthan