Hubspot API date format. How to use date filters in Hubspot API
TL:DR: As the title of the post implies, here is the format that Hubspot CRM Search API expects for their datetime field. It is in UNIX Epoch timestamp in milliseconds format. If it is just the date, the date at 12:00 AM (00 hours 00 mins 00 secs). Here’s an example of what 31 Aug, 2024 is: 1722297600000. Pass it as a string to the API.
Figuring out the Hubspot API date format
As I was working on a project to search and filter Hubspot Deals by a certain date, I keep getting the "There was a problem with the request." error. The documentation on the CRM API is not clear what format it expects and it took me a while to figure it out. But one of the examples did show the format for date. And that’s how it was then clear to me it is expecting the datetime format in UNIX Epoch timestamp format.
curl https://api.hubapi.com/crm/v3/objects/tasks/search \
--request POST \
--header "Content-Type: application/json" \
--header "authorization: Bearer YOUR_ACCESS_TOKEN" \
--data '{
"filterGroups":[{
"filters":[
{
"propertyName":"hs_lastmodifieddate",
"operator":"BETWEEN",
"highValue": "1642672800000",
"value":"1579514400000"
}
]
}]
}'
Using the search API filter with Workato
The project I was working on was on the Workato platform. Basically you need to just format the time datapill by using the strftime formula with '%s%3N' as the format. Here’s an example how to filter by the date one month ago.
(today - 1.months).strftime('%s%3N')
%s= converting to seconds since 1970-01-01 00:00:00 UTC in UNIX epoch%3N= Fractional seconds digits (3N = milliseconds)
Here’s an example using the formula in the property filter with the Search action.

Here’s examples in plain code
With plain ruby, you use the same strftime function with %s%3N as the format
Time.now.utc.strftime('%s%3N')
With Javascript, the getTime() function will returns the number of milliseconds for this date since the epoch.
Date.getTime();
With Go, the UnixMilli() function does exactly that too for the HubSpot api date format.
time.Now().UnixMilli()
And finally with Python, the timestamp() function * 1000 for the milliseconds.
now.timestamp() * 1000