CRM V3 API Contacts search issue, using Filters by lastmodifieddate

Hello,

I am trying to use the following endpoint to get contacts that have been modified since a certain date:

https://api.hubapi.com/crm/v3/objects/contacts/search

As the request body, I am sending the following:

{
 "properties": ["createdate","hs_object_id","lastmodifieddate"],
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "lastmodifieddate",
 "operator": "GT",
 "value": "1674758400000"
 }
 ]
 }
 ],
 "limit": 100,
 "after": 0,
 "sorts":[
 {
 "propertyName": "lastmodifieddate",
 "direction": "ASCENDING"
 }
 ]
}

I know that the date needs to be converted to the correct UNIX millisecond format. In my case, it’s March 3, 2023, which corresponds to the value 1674758400000. Some filtering is clearly working, as the results are different from what I get without using filtering. However, the response includes contacts that were edited a month before that. Here’s an example response:

{
 "total": 6,
 "results": [
 {
 "id": "49451",
 "properties": {
 "createdate": "2023-02-01T11:11:08.487Z",
 "hs_object_id": "49451",
 "lastmodifieddate": "2023-02-01T11:28:51.466Z"
 },
 "createdAt": "2023-02-01T11:11:08.487Z",
 "updatedAt": "2023-02-01T11:28:51.466Z",
 "archived": false
 },
 {
 "id": "351",
 "properties": {
 "createdate": "2023-01-09T23:14:06.774Z",
 "hs_object_id": "351",
 "lastmodifieddate": "2023-02-01T21:20:21.637Z"
 },
 "createdAt": "2023-01-09T23:14:06.774Z",
 "updatedAt": "2023-02-01T21:20:21.637Z",
 "archived": false
 },
 {
 "id": "251",
 "properties": {
 "createdate": "2023-01-06T17:16:46.153Z",
 "hs_object_id": "251",
 "lastmodifieddate": "2023-03-03T17:20:09.834Z"
 },
 "createdAt": "2023-01-06T17:16:46.153Z",
 "updatedAt": "2023-03-03T17:20:09.834Z",
 "archived": false
 },
 {
 "id": "26601",
 "properties": {
 "createdate": "2023-01-31T22:23:02.255Z",
 "hs_object_id": "26601",
 "lastmodifieddate": "2023-03-06T19:56:59.260Z"
 },
 "createdAt": "2023-01-31T22:23:02.255Z",
 "updatedAt": "2023-03-06T19:56:59.260Z",
 "archived": false
 },
 {
 "id": "97551",
 "properties": {
 "createdate": "2023-02-01T22:58:15.992Z",
 "hs_object_id": "97551",
 "lastmodifieddate": "2023-03-07T19:11:03.617Z"
 },
 "createdAt": "2023-02-01T22:58:15.992Z",
 "updatedAt": "2023-03-07T19:11:03.617Z",
 "archived": false
 },
 {
 "id": "151",
 "properties": {
 "createdate": "2022-11-21T20:07:36.159Z",
 "hs_object_id": "151",
 "lastmodifieddate": "2023-03-07T19:15:59.979Z"
 },
 "createdAt": "2022-11-21T20:07:36.159Z",
 "updatedAt": "2023-03-07T19:15:59.979Z",
 "archived": false
 }
 ]
}

I would appreciate any help you can provide.

@SLeszczenko

Hi.

Doesn’t “1674758400000” means “2023-01-26T18:40:00.000Z” ?

For example, how about ‘1677801600000’ ?

(‘1677801600000’ → ‘2023-03-03 00:00:00’)

new Date(1674758400000).toISOString();
// '2023-01-26T18:40:00.000Z'

new Date('2023-03-03').getTime();
// 1677801600000

Thanks.