Appearance
Sorting
Sort results using the sort query parameter.
Syntax
?sort=fieldName # Ascending
?sort=-fieldName # Descending (hyphen prefix)Multi-Sort
Comma-separated sort keys are applied in order:
?sort=category,-price,nameThis sorts by category ascending, then price descending, then name ascending.
Translation Sorts
For multi-language fields, append the locale:
?sort=name.el # Sort by Greek name
?sort=-name.en # Sort by English name, descendingRelation Sorts
Some endpoints support sorting by a related entity's field using dot notation:
?sort=products.price # Sort by related product price
?sort=-products.name.en # Sort by related product English name, descendingRelation sorts require the relation to be included via the with parameter. If the relation isn't included, the sort is ignored.
Available Sorts
Each endpoint's tag description lists its supported sort keys. Not all fields are sortable.
Discovering Sorts from the OpenAPI Spec
Each resource's OpenAPI tag includes a vendor extension x-sorts that lists all sortable fields for that resource. Use this to programmatically determine which fields can be used in ?sort= without trial and error.
Example x-sorts excerpt from a tag definition:
yaml
x-sorts:
- id
- name
- price
- created_at
- updated_at
- sort_orderOnly fields listed in x-sorts are accepted. Requesting a sort on an unlisted field is silently ignored.