sort_by
parameter controls the order of your search results. You can sort by any field in ascending or descending order, and combine up to three fields for multi-level sorting.
Quick start
Here’s how to sort transactions by creation date in descending order (newest first):Sort syntax
Basic sorting
Sort by a single field using the formatfield:direction
:
Sort directions
Direction | Description | Example |
---|---|---|
asc | Ascending order (A-Z, 0-9, oldest to newest) | amount:asc |
desc | Descending order (Z-A, 9-0, newest to oldest) | created_at:desc |
Multi-field sorting
Combine up to three fields separated by commas. Fields are applied in order: the first field is primary, second breaks ties, third breaks remaining ties:- Status (ascending) - groups by status first
- Created date (descending) - within each status, newest first
- Amount (descending) - for same status and date, highest amount first
Common sorting patterns
1
Sort by creation date
Show the most recent records first, useful for transaction monitoring.
2
Sort by amount
Find the largest transactions first for financial analysis.
3
Sort balances by amount
Identify accounts with the highest balances.
4
Multi-level transaction sorting
Group by status, then show newest transactions first within each status.
Best practices
- Default to newest first: Use
created_at:desc
for time-sensitive data like transactions. - Combine with filtering: Sort filtered results for more targeted analysis.
- Limit multi-field sorting: Use 2-3 fields maximum to avoid complexity.
Related topics
Filtering
Combine sorting with filters to narrow down and organize your results.
Pagination
Navigate through large sorted result sets efficiently.
Search overview
Return to the main Search API documentation for a complete overview.