Get Contact API how to get contact recently modified only yesterday?

forms
contacts

#1

I am using https://developers.hubspot.com/docs/methods/contacts/get_recently_updated_contacts API
with this i am receiving data of today and yesterday last modified data.
but i want only yesterday modified day in response. so how can i make it?


#3

Hi @kishan,

The Get recently updated and created contacts endpoint cannot filter results in this way.

The endpoint returns all recently created or modified contacts in order, so you must then set up a filter on your back end for contacts whose addedAt timestamp lies between the range you want.

HubSpot uses UNIX-formatted timestamps in milliseconds, so you will have to calculate "yesterday" in the same format.

In JavaScript, Date.now() returns the current epoch time in milliseconds. Since there are 86400000 in a day, you could use Date.now() - 86400000 to calculate the timestamp 24 hours before the current time.


#4

Thank you so much :slight_smile:


#5

Happy to help, @kishan!