Data API: each endpoint returns results in a defined sort order that $orderby doesn't change
How sort order works on the Data API
Each Data API endpoint returns records in a defined sort order. Because results are returned one page at a time, that order is fixed — it's what guarantees no record is skipped or returned twice as you page through results. An $orderby request won't change it, and because the call still returns successfully, a requested descending sort appears to be silently ignored rather than rejected.
| Endpoint | Sort order |
|---|---|
| users | last_updated_time, then id — ascending |
| conversations, interactions, plugin-calls, plugin-resources | created_time, then id — ascending |
Our documentation currently doesn't mention this limitation. Hence we wanted to share this caveat.
Workaround for getting the latest user record
Users is already sorted by last_updated_time — just ascending. Your most recently updated records are at the end of the result set rather than the beginning, which gives you two straightforward options:
- Page through to the last page. The final page holds your most recently updated user records, in order. No sorting needed on your end.
- Look up a specific user. Filter by that user (for example, by email address) to return their record directly. If more than one record comes back, sort the small result set on your side.
The same applies to conversations, interactions, plugin-calls, and plugin-resources using created_time — the newest records are on the last page.