APIs & Integrations

swroblew
Member

Getting counts of contact lists from API?

We are looking to track the number of HubSpot CRM contacts over-time for total overall and total from specific lists. 

 

I do not see an analytics object type for 'contacts' in the analytics API: https://developers.hubspot.com/docs/methods/analytics/get-analytics-data-by-object

 

I see we can access a list size by ID with this: https://developers.hubspot.com/docs/methods/lists/get_list

 

Question:

(1) Ideally, we'd be able to pull out this data to show total contacts overall or total contacts by list ID,  historically by date for the last year:

7/1/2019 - 2203

7/2/2019 - 2245

7/3/2019 - 2301

 

Is this possible via any of the APIs? 

 

Thanks,

0 Upvotes
4 Replies 4
WendyGoh
HubSpot Employee
HubSpot Employee

Getting counts of contact lists from API?

Hi @swroblew,

 

When looking to get the total number of contacts you have in your HubSpot portal, we can look into using the default property - create date (the date that a contact entered the system)

 

In this case, you're right, we can definitely utilize the contact list APIs together with the create date property:

  • In-app, you can create an active list to use filter such as e.g. contact properties > create date is between xx and xx or create date is before xx
  • Next, you can use this endpoint: Get contact lists and the size property will indicate the total contacts in that particular list

Hope this helps to clarify!

0 Upvotes
swroblew
Member

Getting counts of contact lists from API?

Hey Wendy!

 

This makes sense to get total contacts. But if we wanted to get total number of contacts by created date from the API, is the only way to query every contact and then count them by date?

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

Getting counts of contact lists from API?

Hi @swroblew,

 

You wouldn't need to query every contact if you're using an active list to keep track:

  • Create an active list within your HubSpot portal
    • Set the list filter to be: "Created date is between xx and xx"
    • This will pull the contacts who has been created between the stated date range
  • Next, use this endpoint: Get contact lists to get the list size 
  • This way, you're only calling the API to get the list size, the API isn't querying every contact and count them by date; because the active list already contain contacts created between those date range

Hope this helps to clarify further!

0 Upvotes
swroblew
Member

Getting counts of contact lists from API?

Hey Wendy,

 

Like my example in the first post, I am looking to have the date returned, along with the count of contacts registered on that date.

 

Date - Contacts

7/1/19 - 2109

7/2/19 - 2188

7/3/19 - 2304

 

It does not seem like that is possible at this time just from the API. It sounds like the best option would be to query all contacts once, to get their registered date, create this list like above example, and then query daily at end of day and log the daily total moving forward.

0 Upvotes