APIs & Integrations


Pull emails/contacts sent per company

Which API do I need to look into that will allow me to pull the number of emails we sent to a company (aggregate of all employees) over a specific time frame?  


i.e. We sent 356 emails to your company this month.

1 Reply 1
HubSpot Employee
HubSpot Employee

Pull emails/contacts sent per company

Hi @israelj,


I hope all is well with you 😄


While there currently isn't an easy way to pull the total number of emails sent to a particular company over a specific time frame, I do have something in mind which require using more than one endpoint here:

  • You'll first need to loop through the Get all marketing emails statistics API; from the result you can gather the list/contact used on that particular marketing email
    • If you're sending to one or multiple recipients without using list, you can look into the vids_included property to retrieve the contacts this marketing email was sent to
    • If you're using one or more list to sent the marketing email, you can look into the mailingListsIncluded property to retrieve the contact list used on this marketing email
  • Once you've the list of contacts > You can use this endpoint Get associations for CRM object to get the company that is being associated to the contact (Using a definition ID of 1 - Association definitions)
    • You can set a counter and increase the counter for each time the company record vid appears in the results

Hope this helps!