# Sort is not working

**URL:** <https://community.hubspot.com/t/sort-is-not-working/98914>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [January 29, 2024, 6:38pm UTC](https://community.hubspot.com/t/sort-is-not-working/98914 "2024-01-29T18:38:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JDeak](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JDeak](https://community.hubspot.com/u/JDeak)\
**Post date:** [January 29, 2024, 6:38pm UTC](https://community.hubspot.com/t/sort-is-not-working/98914/1 "2024-01-29T18:38:39Z")

</div>

Hi Im trying to sort values DESC, however everythin i tried for all fileds is not working. API is still returning oldest data. My code:

url = “[https://api.hubapi.com/conversations/v3/conversations/threads](https://api.hubapi.com/conversations/v3/conversations/threads)”  
headers = {  
‘accept’: “application/json”,  
‘authorization’: f’Bearer {api\_key}’  
}  
params = {‘threadStatus’: ‘OPEN’, “limit”:“500”, “sorts”: [  
{  
“propertyName”: “createdAt”,  
“direction”: “DESCENDING”  
}  
]}

response = requests.request(“GET”, url, headers=headers, params = params)

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [January 31, 2024, 9:14pm UTC](https://community.hubspot.com/t/sort-is-not-working/98914/2 "2024-01-31T21:14:06Z")

</div>

Hey, @JDeak When I look at the [**documentation**](https://developers.hubspot.com/docs/api/conversations/conversations#:~:text=value%20true.-,sort,to%20also%20be%20set.%20Results%20are%20always%20returned%20in%20ascending%20order.,-after) for using the sort param for this endpoint, it indicates that the endpoint only allows for sorting by `id` (default) or `latestMessageTimestamp`, and results are returned in ascending order only.  
“sort

String

Set the sort order of the response. Valid options include **id** , which is the default, and **latestMessageTimestamp** , which requires the latestMessageTimestampAfter field to also be set. Results are **always** returned in ascending order.”

In this case, sorting by `createdAt` in descending order isn’t supported.

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![JDeak](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JDeak](https://community.hubspot.com/u/JDeak)\
**Post date:** [February 1, 2024, 2:23pm UTC](https://community.hubspot.com/t/sort-is-not-working/98914/3 "2024-02-01T14:23:14Z")

</div>

Hi Jaycee. even if i try sort with -id, its not working. ist only working, as asc…

 ![JDeak_0-1706612463429.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/2X/b/bc47deeea58487ad2c518916854aa771ef63471a.jpeg)
