API Rate Limit

Hi,

I am working on a way to store how many contacts meet a certain criteria per day in some record that I can report on. More specifically, I am counting the total number of contacts with an active membership property per day. I want to then store that daily value somewhere permanant so I can report on it and see daily fluctuations. I haven’t seen a direct way to do this, so I am open to any recommendations, but I made some custom code actions to have a workaround for this. I am creating a custom object record called time_series_metrics daily to store the the total value of contacts that meet the criteria for that day. I have gotten everything working to the point where I can increment the total in the custom storage record using API calls in the Hubspot custom code actions in a daily recurring workflow that enrolls contacts if their membership is active. However, since the workflow it is in is scheduled to run daily, it bulk enrolls contacts at the same time and maxes out the API call rate limit per second. Is there any way to slow down workflow enrollment or a whole other approach to solving this problem.

Thanks

Are you saying you are trying to count the number of contacts who have a specific property value?

Yes, I want to count the number of contacts who have a specific property value and also store that value daily.

I’m pretty sure you could use the search API. Assuming you get the search filter right, there is a property returned called “total” which would be the total number of records. Seems like that total is the number you want.

Example this will tell you the total number of contacts who have an email address:

curl --location --request POST 'https://api.hubapi.com/crm/v3/objects/contacts/search' \
--header 'Authorization: Bearer xxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
 "filters": [
 {
 "propertyName": "email",
 "operator": "HAS_PROPERTY"
 }
 ]
}'

The result being:

{
 "total": 11,
 "results": [...]
}

I don’t seem to see that specific total property in the docs, would I just specify “total” in the return properties portion of the body for the POST request?

The example result is listed with each object. If you look at the contacts API you can see an example of the search endpoint and there you can see the total in the result data.

Great , this works! Thank you.

Nice workaround, @RZia

that’s actually a clever way to snapshot metrics over time. If you want to avoid hitting rate limits on bulk workflows, using the CRM Search API exactly as LeeBartelme showed is the right path. The “total” value is always part of the response metadata, so you don’t need to request it explicitly

(Search the CRM - HubSpot docs )

For storing the daily count, consider a scheduled external job that calls this search endpoint once per day and writes the total to a custom object or external database via the Custom Objects API (Accounts Dashboard | HubSpot )

That way, you skip mass enrollments and API bursts from HubSpot workflows.

In 2025, I’ve seen more teams pair this pattern with a small sync layer like Stacksync, which logs metrics to a database automatically each day without running into HubSpot’s per-second API ceilings handy for keeping historical counts aligned without throttling headaches.