# CRM API v3 - Sort based on the modified date

**URL:** <https://community.hubspot.com/t/crm-api-v3-sort-based-on-the-modified-date/22212>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [June 29, 2020, 7:58am UTC](https://community.hubspot.com/t/crm-api-v3-sort-based-on-the-modified-date/22212 "2020-06-29T07:58:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Athul\_C](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@Athul\_C](https://community.hubspot.com/u/Athul_C)\
**Post date:** [June 29, 2020, 7:58am UTC](https://community.hubspot.com/t/crm-api-v3-sort-based-on-the-modified-date/22212/1 "2020-06-29T07:58:22Z")

</div>

Hi Hubspot team,

I was working around Hubspot API v3, and I have requirement of sorting contacts based on modified date.So is there any solution for the same.

Thanks

Atul

---

<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 29, 2020, 9:28am UTC](https://community.hubspot.com/t/crm-api-v3-sort-based-on-the-modified-date/22212/2 "2020-06-29T09:28:23Z")

</div>

Hi [@Athul\_C](https://community.hubspot.com/t5/user/viewprofilepage/user-id/136929)

When working with our v3 APIs, you can work specifically with our [CRM Search API](https://developers.hubspot.com/docs/api/crm/search) in order to Sort results by properties.

As an example, we can use the following request:

```auto
curl https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=YOUR_HUBSPOT_API_KEY \
 --request POST \
 --header "Content-Type: application/json" \
 --data '{
 "sorts": [
 {
 "propertyName": "lastmodifieddate",
 "direction": "DESCENDING"
 }
 ]
 }'

```

This would then fetch your Contacts and sort them according to the `lastmodifieddate` timestamp, in this particular case, those created most recently.

I hope this helps!

---

<div class="post-metadata">

**Author:** ![Athul\_C](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@Athul\_C](https://community.hubspot.com/u/Athul_C)\
**Post date:** [June 29, 2020, 9:55am UTC](https://community.hubspot.com/t/crm-api-v3-sort-based-on-the-modified-date/22212/3 "2020-06-29T09:55:25Z")

</div>

Hi willson,

Thank you for the quick response.This made my day.  
 ![16x16_smiley-happy.png.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/2/22d5e40d253def47f5f4ea7f0e3e70be19010689.png)

Regards

Athul

---

<div class="post-metadata">

**Author:** ![kawyns1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kawyns1/32/27089_2.png) [@kawyns1](https://community.hubspot.com/u/kawyns1)\
**Post date:** [October 9, 2020, 10:55am UTC](https://community.hubspot.com/t/crm-api-v3-sort-based-on-the-modified-date/22212/4 "2020-10-09T10:55:28Z")

</div>

Hi @Willson ,

I am try to retrieve all the tickets data from a certain date → basically filtering out the data since the lastmodifieddate. However, this is giving all my ticket records instead of just only the ones from the last modified date.

Any help / advice is appreciated, thank you.

---

<div class="post-metadata">

**Author:** ![Syncari](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/syncari/32/98942_2.png) [@Syncari](https://community.hubspot.com/u/Syncari)\
**Post date:** [January 30, 2025, 1:45am UTC](https://community.hubspot.com/t/crm-api-v3-sort-based-on-the-modified-date/22212/5 "2025-01-30T01:45:17Z")

</div>

Hello,

Does the search go off a secondary index? We see out of order records many times when we use this API, making our integrations skip large number of records when syncing from Hubspot. Are there any best practices around handling such records?

---

<div class="post-metadata">

**Author:** ![vikram-mit](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vikram-mit/32/39641_2.png) [@vikram-mit](https://community.hubspot.com/u/vikram-mit)\
**Post date:** [March 4, 2021, 3:38am UTC](https://community.hubspot.com/t/crm-api-v3-sort-based-on-the-modified-date/22212/6 "2021-03-04T03:38:52Z")

</div>

how do i do it with regular object api like [https://api.hubapi.com/crm/v3/objects/companies](https://api.hubapi.com/crm/v3/objects/companies) say i want to sort by lastmodifieddate ?

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [March 4, 2021, 5:39pm UTC](https://community.hubspot.com/t/crm-api-v3-sort-based-on-the-modified-date/22212/7 "2021-03-04T17:39:07Z")

</div>

@vikram-mit , this is only available for the search endpoint

---

<div class="post-metadata">

**Author:** ![DGodoy](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dgodoy/32/82797_2.png) [@DGodoy](https://community.hubspot.com/u/DGodoy)\
**Post date:** [August 17, 2021, 7:41pm UTC](https://community.hubspot.com/t/crm-api-v3-sort-based-on-the-modified-date/22212/8 "2021-08-17T19:41:02Z")

</div>

Hi, how can i get the results sorted using python? Thanks in advance!
