# hs\_lastmodifieddate search via API not work

**URL:** <https://community.hubspot.com/t/hs-lastmodifieddate-search-via-api-not-work/63709>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [August 25, 2022, 9:19am UTC](https://community.hubspot.com/t/hs-lastmodifieddate-search-via-api-not-work/63709 "2022-08-25T09:19:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TDwebdev](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tdwebdev/32/78032_2.png) [@TDwebdev](https://community.hubspot.com/u/TDwebdev)\
**Post date:** [August 25, 2022, 9:19am UTC](https://community.hubspot.com/t/hs-lastmodifieddate-search-via-api-not-work/63709/1 "2022-08-25T09:19:02Z")

</div>

Hello,

I want to get the latest modified companies of the current day.

My code:

//php get current date:

$date = time() \* 1000;

```
$url = "https://api.hubapi.com/crm/v3/objects/companies/search?hapikey=" . $api\_key;

    // Check if deal is equal to deal stage

    $json\_data = '

    {

        "limit": 100,

        "filters": \[

            "propertyName": "hs\_lastmodifieddate",

            "operator": "GTE",

            "value": "'.$date.'"

            ],

            "properties": \["name","exact\_id\_new", "betaalconditie", "g\_l\_account", "land", "state", "zip", "kvk\_nr", "city", "country", "btw", "addres"]

    }

```

The date is the exact format what HubSpot want, but i still get a error

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 25, 2022, 10:56am UTC](https://community.hubspot.com/t/hs-lastmodifieddate-search-via-api-not-work/63709/2 "2022-08-25T10:56:56Z")

</div>

Hey @TDwebdev,

What error are you getting back from HubSpot? Are you getting a 200 but without results? something similar to the below:

```lia-code-sample
{
 "total": 0,
 "results": []
}

```

I think the issue here is to do with your filter, you’re getting the current time and looking at any companies that have been modified on or after that timestamp. I think a better route might be to use the BETWEEN operator and look for companies modified in a certain range i.e 24 hours. See below as an example:

```lia-code-sample
POST /crm/v3/objects/companies/search 
Host: api.hubapi.com
Authorization: Bearer {{ access_token }}

{
 "properties": ["domain"],
 "filters": [
 {
 "propertyName": "hs_lastmodifieddate",
 "operator": "BETWEEN",
 "highValue": 1661295600000, // Wed Aug 24 2022 00:00:00
 "value":1661122800000 // Tue Aug 23 2022 00:00:00
 }
 ]
 }

```

Also, I’d suggest authenticating using an access token (you’d need to create a [private app](https://developers.hubspot.com/docs/api/private-apps)). [API keys are being sunset](https://developers.hubspot.com/changelog/upcoming-api-key-sunset) and will no longer work November 30th 2022.
