sort parameter.
Basic Sorting
Use thesort parameter with the field name:
Multiple Fields
Sort by multiple fields by comma-separating them:Available Sort Fields
Companies
nameemailstatuscreated_atupdated_at
Employees
first_namelast_namecompany_idstatuscreated_atupdated_at
Documents
typestatuscreated_atupdated_at
Sort Directions
- Ascending: Use the field name as is (
sort=name) - Descending: Prefix with
-(sort=-name)
Sorting with Relations
Sort based on related model attributes:Combining with Other Features
Sorting can be combined with filtering and pagination:Default Sorting
If no sort parameter is provided, endpoints use these defaults:- Companies:
-created_at(newest first) - Employees:
company_id,last_name - Documents:
-created_at(newest first)
Best Practices
- Use appropriate indexes for sortable fields
- Combine sorting with filtering for better results
- Consider performance impact of relation-based sorting
- Use default sorting when specific order isn’t required

