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

**URL:** <https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [May 12, 2020, 11:26am UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782 "2020-05-12T11:26:04Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![OlaCarlander](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/olacarlander/32/75413_2.png) [@OlaCarlander](https://community.hubspot.com/u/OlaCarlander)\
**Post date:** [May 12, 2020, 11:26am UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/1 "2020-05-12T11:26:04Z")

</div>

Hi,

Im trying to pass a date filter using the new v3 search like so:

“filters”: [  
{  
“propertyName”: “lastmodifieddate”,  
“operator”: “GT”,  
“value”: “2020-03-19T23:15:39.161Z”  
}

It works when searching for strings, but I get 400 bad request when trying with dates. What format should date be in in the search query for V3 apis? Still unix-time?

{

“status”: “error”,

“message”: “There was a problem with the request.”,

“correlationId”: “8ebe8c45-de7d-4fed-b3e8-4e47cf3f5ee3”

}

---

<div class="post-metadata">

**Author:** ![nadendav](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nadendav/32/52876_2.png) [@nadendav](https://community.hubspot.com/u/nadendav)\
**Post date:** [May 12, 2020, 12:22pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/2 "2020-05-12T12:22:29Z")

</div>

I have to imagine it is still Unix time. I’ve been trying the same thing but can’t seem to get the syntax of the call right. I’m using Postman for my R&D. All the parameters from a standard GET v3 Contacts call go into the Body of the call formatted as JSON, right? That is how you get the “filters” in there, right? Got an example?

---

<div class="post-metadata">

**Author:** ![OlaCarlander](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/olacarlander/32/75413_2.png) [@OlaCarlander](https://community.hubspot.com/u/OlaCarlander)\
**Post date:** [May 12, 2020, 12:56pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/3 "2020-05-12T12:56:30Z")

</div>

Trying in postman here too. And yeap, json body, looking like this:

{  
“filterGroups”: [  
{  
“filters”: [  
{  
“propertyName”: “lastmodifieddate”,  
“operator”: “GT”,  
“value”: “2020-03-19T23:15:39.161Z”  
}  
]  
}  
],  
“sorts”: [“”],  
“properties”: [  
“associatedcompanyid”,  
“company”,  
“createdate”,  
“email”,  
“firstname”,  
“hs\_calculated\_phone\_number”,  
“hs\_object\_id”,  
“hubspot\_owner\_id”,  
“hubspot\_team\_id”,  
“lastmodifieddate”,  
“lastname”,  
“mobilephone”,  
“phone”  
],  
“limit”: 10,  
“after”: 0  
}

It works fine to search for lastname for example, but can’t figure out any good time formats that seem to work. Tried Unix time as well but that didn’t do it.

---

<div class="post-metadata">

**Author:** ![OlaCarlander](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/olacarlander/32/75413_2.png) [@OlaCarlander](https://community.hubspot.com/u/OlaCarlander)\
**Post date:** [May 12, 2020, 1:11pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/4 "2020-05-12T13:11:40Z")

</div>

Actually it did work now with Unix time as you said 🙂 , I just forgot to add the milliseconds.

So to answer my own question, yes it is Unixtime, but don’t forget the last milliseconds

---

<div class="post-metadata">

**Author:** ![nadendav](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nadendav/32/52876_2.png) [@nadendav](https://community.hubspot.com/u/nadendav)\
**Post date:** [May 12, 2020, 1:16pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/5 "2020-05-12T13:16:57Z")

</div>

Thank You!

---

<div class="post-metadata">

**Author:** ![Willson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/willson/32/84663_2.png) [@Willson](https://community.hubspot.com/u/Willson)\
**Post date:** [May 12, 2020, 1:16pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/6 "2020-05-12T13:16:38Z")

</div>

Hey @OlaCarlander,

When testing this on my end using Postman, I am able to successfully query my contacts using the following:

```auto
{
"filterGroups": [
{
"filters": [
{
"propertyName": "lastmodifieddate",
"operator": "GT",
"value": "1589238000000"
}
]
}
]
}

```

Note that the value for lastmodifieddate is a UNIX timestamp in milliseconds. This returns the following:

```auto
{
 "id": "xxxx",
 "properties": {
 "createdate": "2020-05-12T13:15:22.779Z",
 "hs_is_unworked": "true",
 "lastmodifieddate": "2020-05-12T13:15:22.985Z"
 },
 "createdAt": "2020-05-12T13:15:22.779Z",
 "updatedAt": "2020-05-12T13:15:22.985Z",
 "archived": false
}

```

I hope this helps!

---

<div class="post-metadata">

**Author:** ![nadendav](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nadendav/32/52876_2.png) [@nadendav](https://community.hubspot.com/u/nadendav)\
**Post date:** [May 13, 2020, 8:31pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/7 "2020-05-13T20:31:22Z")

</div>

Hi Matthew, in Postman my URL is

[https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=](https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=)

my body is

{  
“filterGroups”: [  
{  
“filters”: [  
{  
“propertyName”: “lastmodifieddate”,  
“operator”: “GT”,  
“value”: “1589238000000”  
}  
]  
}  
],  
“properties”: [  
“admission\_decision”,“application\_start\_date”,“application\_status”,“application\_submit\_date”,“city,country”,“email”,“firstname”,“gender”,“hs\_object\_id”,“inquiry\_date”,“lastname”,“military\_status”,“mobilephone”,“origin\_category”,“origin\_summary”,“program\_of\_interest”,“prospect\_date”,“slate\_events\_all”,“slate\_most\_recent\_event”,“slate\_most\_recent\_event\_date”,“slate\_ref\_id”,“source\_label”,“stage”,“state”,“when\_do\_you\_plan\_to\_enroll\_”  
],  
“limit”: 11,  
“after”: 1  
}

and my response is

\<html\>

\<head\>

```
\<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

\<title>Error 405 Method Not Allowed\</title>

```

\</head\>

\<body\>

```
\<h2>HTTP ERROR 405\</h2>

\<p>Problem accessing /crm/v3/objects/contacts/search. Reason:

    \<pre> Method Not Allowed\</pre>

\</p>

```

\</body\>

\</html\>

---

<div class="post-metadata">

**Author:** ![nadendav](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nadendav/32/52876_2.png) [@nadendav](https://community.hubspot.com/u/nadendav)\
**Post date:** [May 13, 2020, 8:42pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/8 "2020-05-13T20:42:21Z")

</div>

D’oh! Have to use POST in this scenario…

---

<div class="post-metadata">

**Author:** ![nadendav](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nadendav/32/52876_2.png) [@nadendav](https://community.hubspot.com/u/nadendav)\
**Post date:** [June 16, 2020, 7:25pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/9 "2020-06-16T19:25:36Z")

</div>

I’d like to set up a repeatable API call using a Filter on a Date property with a relative value. For example Today(now) - 1 Day. Is there syntax for that or will I have to calculate the relative Unix date value prior to each API call?

[https://api.hubapi.com/crm/v3/objects/contacts/search](https://api.hubapi.com/crm/v3/objects/contacts/search)? is the Endpoint

---

<div class="post-metadata">

**Author:** ![Willson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/willson/32/84663_2.png) [@Willson](https://community.hubspot.com/u/Willson)\
**Post date:** [June 17, 2020, 9:16am UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/10 "2020-06-17T09:16:21Z")

</div>

Hey @nadendav

This would be something you’d have to code out on your own server after making the initial API call else, you would indeed need to work with the relative Unix timestamp prior to the call.

Thanks!

---

<div class="post-metadata">

**Author:** ![BStump](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bstump/32/74736_2.png) [@BStump](https://community.hubspot.com/u/BStump)\
**Post date:** [January 20, 2021, 12:02am UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/11 "2021-01-20T00:02:47Z")

</div>

the following is not working for me. any advice?

```lia-code-sample
{
 "filterGroups":[
 {
 "filters":[
 {
 "propertyName": "hs_lastmodifieddate",
 "operator": "GT",
 "value": "2021-01-18T15:55:34.185Z"
 }
 ]
 }
 ]
 }

```

this returns

```lia-code-sample
{
 "status": "error",
 "message": "There was a problem with the request.",
 "correlationId": "5b371826-d7fc-4c0b-b6df-29ad6a861c3d"
}

```

---

<div class="post-metadata">

**Author:** ![nadendav](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nadendav/32/52876_2.png) [@nadendav](https://community.hubspot.com/u/nadendav)\
**Post date:** [January 20, 2021, 1:19pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/12 "2021-01-20T13:19:11Z")

</div>

Hello BStump, the value you provide for a Date Filter must be expressed in Unix Epoch time format. If you read through this entire thread you will see an example.

---

<div class="post-metadata">

**Author:** ![Vitaly\_Gubkin](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vitaly_gubkin/32/75439_2.png) [@Vitaly\_Gubkin](https://community.hubspot.com/u/Vitaly_Gubkin)\
**Post date:** [July 20, 2020, 7:21pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/13 "2020-07-20T19:21:08Z")

</div>

Why does this request create a new contact?

---

<div class="post-metadata">

**Author:** ![nadendav](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nadendav/32/52876_2.png) [@nadendav](https://community.hubspot.com/u/nadendav)\
**Post date:** [July 20, 2020, 7:30pm UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/14 "2020-07-20T19:30:10Z")

</div>

Hi Vitaly, do you mean why is the POST method needed? Post is required in order to send the message Body with the “filterGroups” and “properties” syntax.

---

<div class="post-metadata">

**Author:** ![Vitaly\_Gubkin](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vitaly_gubkin/32/75439_2.png) [@Vitaly\_Gubkin](https://community.hubspot.com/u/Vitaly_Gubkin)\
**Post date:** [July 21, 2020, 11:21am UTC](https://community.hubspot.com/t/https-api-hubapi-com-crm-v3-objects-contacts-search-date-filter/20782/15 "2020-07-21T11:21:44Z")

</div>

The issue has been resolved. Thank.
