# Contacts Statistics Between Two Dates

**URL:** <https://community.hubspot.com/t/contacts-statistics-between-two-dates/89339>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [September 11, 2023, 9:29am UTC](https://community.hubspot.com/t/contacts-statistics-between-two-dates/89339 "2023-09-11T09:29:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Knight-Digital](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Knight-Digital](https://community.hubspot.com/u/Knight-Digital)\
**Post date:** [September 11, 2023, 9:29am UTC](https://community.hubspot.com/t/contacts-statistics-between-two-dates/89339/1 "2023-09-11T09:29:10Z")

</div>

I am trying to achieve a count of contacts created between two dates, similar to the Contacts Statistics API but with a date range input. No contact data is needed, just the number of contacts created.

Is there an API suitable please? Some API’s seem adequate, although anything with more than just statistical data is limited to 100 contacts which will obviously be an issue.

Contacts Statistics Info from the legacy docs:-

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Flegacy%2Fcrm-contacts-v1%2Fget-contacts-v1-lists-all-contacts-all)**

---

<div class="post-metadata">

**Author:** ![zach\_threadint](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zach_threadint/32/46318_2.png) [@zach\_threadint](https://community.hubspot.com/u/zach_threadint)\
**Post date:** [September 13, 2023, 3:36am UTC](https://community.hubspot.com/t/contacts-statistics-between-two-dates/89339/2 "2023-09-13T03:36:53Z")

</div>

Hi @Knight-Digital 👋

You’ll likely want to use the [CRM Search API](https://developers.hubspot.com/docs/api/crm/search). Your request might look something like this:

- **POST** [https://api.hubapi.com/crm/v3/objects/CONTACT/search](https://api.hubapi.com/crm/v3/objects/CONTACT/search)
- **Headers** :
  - Content-Type: application/json
  - Authorization: Bearer _{{your\_access\_token}}_

- **Request Body (JSON)**:

```lia-code-sample
{
 "limit": 0,
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "createdate",
 "operator": "GTE",
 "value": "2022-07-01"
 },
 {
 "propertyName": "createdate",
 "operator": "LTE",
 "value": "2023-09-13"
 }
 ]
 }
 ]
}

```

Where your time window “start date” is the first filter

(“GTE” is greater than or equal to)

and your “end date” is the second filter

(“LTE” is less than or equal to)

. As per your described case, specifying _“limit”: 0_ makes it so that no Contact data is returned, while still giving you a count of the Contacts that fit the criteria. An example response will look like:

```lia-code-sample
{
 "total": 9,
 "results": [],
 "paging": {
 "next": {
 "after": "0"
 }
 }
}

```

Where the number of Contacts that meet my search criteria is 9.

I hope this proves useful. Please let me know if you have any follow-up questions.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [September 13, 2023, 4:09pm UTC](https://community.hubspot.com/t/contacts-statistics-between-two-dates/89339/3 "2023-09-13T16:09:03Z")

</div>

Hey, [@zach\_threadint](https://community.hubspot.com/t5/user/viewprofilepage/user-id/324811) 👋 I was thinking about the Search API too. And using the BETWEEN filter.

My gut feeling is this user only needs “count of contacts created” within a specific range, not the contact details.  
I can think of at least one hacky workaround, but it’s not programmatic. And it may not be scaleable, depending on their expected polling frequency and volume.

- Create an Active List
- Set two filters – ID is known + create date is between X and Y
- Make a request to the Lists API which will return a count

I’d love to hear how others would approach this.

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![zach\_threadint](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zach_threadint/32/46318_2.png) [@zach\_threadint](https://community.hubspot.com/u/zach_threadint)\
**Post date:** [September 13, 2023, 11:01pm UTC](https://community.hubspot.com/t/contacts-statistics-between-two-dates/89339/4 "2023-09-13T23:01:10Z")

</div>

Hi [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074) 👋

Yes absolutely, the BETWEEN operator on the CRM Search API call would work too. And interesting idea on using the Lists API, that could also work 👍

As previously mentioned, setting “limit” to “0” on a CRM Search API request results in no Contact records being returned. In this case, it only returns the “total” number of records that fit the search criteria.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [September 14, 2023, 2:49pm UTC](https://community.hubspot.com/t/contacts-statistics-between-two-dates/89339/5 "2023-09-14T14:49:51Z")

</div>

Hey, [@zach\_threadint](https://community.hubspot.com/t5/user/viewprofilepage/user-id/324811)! You are 100% correct. And I didn’t slow down and fully read your answer. That’s 100% on me.

Thanks for the solution, I’ll definitely keep it in my back pocket.

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![Knight-Digital](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Knight-Digital](https://community.hubspot.com/u/Knight-Digital)\
**Post date:** [September 14, 2023, 12:24pm UTC](https://community.hubspot.com/t/contacts-statistics-between-two-dates/89339/6 "2023-09-14T12:24:56Z")

</div>

Thank you Zach, this worked perfectly for my initial requirements. Although there are some sites/locations which contacts are categorised into, I am waiting for a reply to find out how this is handled - I wonder if there is another filter or similar method that could be set on any field? I notice that it appears that the contacts filters are limited to ‘firstname,lastname,email,lastmodifieddate,hs\_object\_id, createdate’

---

<div class="post-metadata">

**Author:** ![zach\_threadint](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zach_threadint/32/46318_2.png) [@zach\_threadint](https://community.hubspot.com/u/zach_threadint)\
**Post date:** [September 14, 2023, 10:30pm UTC](https://community.hubspot.com/t/contacts-statistics-between-two-dates/89339/7 "2023-09-14T22:30:52Z")

</div>

Hi @Knight-Digital 👋

The CRM Search API allows you to filter on

(practically)

any property of the specified object-type. As per the [documentation](https://developers.hubspot.com/docs/api/crm/search), you can combine filters/filter groups to achieve “AND” and/or “OR” logic using multiple search criteria.

If you have any follow-up questions, please let me know.

---

<div class="post-metadata">

**Author:** ![RVeldon](https://avatars.discourse-cdn.com/v4/letter/r/fbc32d/32.png) [@RVeldon](https://community.hubspot.com/u/RVeldon)\
**Post date:** [November 9, 2023, 8:55am UTC](https://community.hubspot.com/t/contacts-statistics-between-two-dates/89339/8 "2023-11-09T08:55:17Z")

</div>

Hi there,

I have seen alot of coding suggestions for this problem however i have just discovered an intergration called Tick Tock Today create by Happily that might be able to solve this problem!

(I have been searching for a non coding solution to this problem as having a similar issue!)

Hope it helps!
