Multi-column sorting in API queries – Overridden by data model sort?

Hi everyone! :waving_hand:

I’m trying to sort items via the API using multiple columns in a single table (e.g., sort by priority ascending, then due_date descending). According to the docs, this should work by passing multiple fields to the sort[] array in the query, like:

?sort[]=priority&sort[]=-due_date

However, no matter what I try:

  • The API seems to override my sort order with whatever manual sorting is defined in the Data Model (e.g., drag-and-drop sorting).
  • Only the first field in sort[] is respected, ignoring subsequent fields.

Questions:

  1. Has anyone successfully implemented multi-column sorting via the API?
  2. Is there a conflict with manual sorting in the Data Model that forces override behavior?
  3. Are there workarounds (e.g., extensions, raw SQL) to achieve this reliably?

Repro Steps:

  • Set up a collection with manual sorting enabled.
  • Try querying with multiple sort[] params.
  • Observe results ignore the query sort.

Thanks for any insights!

Have you tried it this way?

?sort=priority,-due_date

If you’re using the SDK - you’d typically pass an array like so.

import { createDirectus, rest, readItems } from '@directus/sdk';
const directus = createDirectus('https://directus.example.com').with(rest());

const result = await directus.request(
    readItems('posts', {
        sort: ['sort', '-date_created', 'author.name'],
    })
);

And welcome to the community BTW! :waving_hand: