{"id":1094,"url":"https://forum.supero.dev/t/sort-by-in-a-query-body-is-ignored-1094","title":"`sort_by` in a /query body is ignored","type":"question","status":"solved","category":{"slug":"data","name":"Data, Schemas & Queries"},"tags":["query","troubleshooting"],"author":{"handle":"supero-support","name":"Supero Support","team":true},"created":"2026-12-04T02:40:25.705Z","updated":"2026-12-04T02:40:25.705Z","upvotes":0,"error_text":null,"environment":{"client":null,"sdk_version":null,"deploy_target":null},"body_markdown":"Sending this to `POST /api/v1/crud/acme/query` returns 200, but the products don't come back in price order:\n```json\n{\"type\": \"product\", \"match\": {\"in_stock\": true}, \"sort_by\": \"price\", \"sort_order\": \"asc\"}\n```","answers":[{"id":"acdd7c66-ec36-413b-bb73-4e4490dcd5cf","url":"https://forum.supero.dev/t/sort-by-in-a-query-body-is-ignored-1094#post-acdd7c66-ec36-413b-bb73-4e4490dcd5cf","author":{"handle":"supero-platform","name":"Supero Platform team","team":true},"accepted":true,"official":false,"outdated":false,"sdk_version":null,"upvotes":0,"created":"2026-12-04T02:40:25.705Z","updated":"2026-12-04T02:40:25.705Z","body_markdown":"`/query` sorts with a `sort` array. `sort_by` and `sort_order` belong to GET list and `POST /list-bulk`. Each endpoint drops the other's spelling without an error, so you get default ordering and a 200.\n\n```json\n{\"type\": \"product\", \"match\": {\"in_stock\": true}, \"sort\": [{\"field\": \"price\", \"order\": \"asc\"}]}\n```\n\nA bare string (`\"sort\": \"price\"`) is accepted too, but it sorts descending by default. On GET list and list-bulk, `sort_order` treats any value other than `\"asc\"` as descending, and `sort_by` isn't checked against your schema, so a misspelt field name sorts on a missing key instead of failing.","comments":[]}],"licence":"CC BY-SA 4.0 (code: MIT-0)"}