Sorting
Many mail2many API endpoints support sorting. Sorting is done via the sorting query parameter. The parameter must be passed as URL-encoded JSON.
Sorting logic
- Sorting rules are applied in the order they are provided
- You can combine multiple sorting rules
- For each field, you must specify
asc(ascending) ordesc(descending)
Simple sorting
To sort by one field:
sorting=[{"createdAt":"desc"}]
This sorts by createdAt in descending order (newest first).
Multiple sorting
You can combine multiple sorting criteria:
sorting=[{"createdAt":"desc"},{"email":"asc"}]
This sorts first by createdAt descending, then by email ascending.
Available sort directions
| Value | Description |
|---|---|
asc | Ascending (A–Z, 0–9, oldest first) |
desc | Descending (Z–A, 9–0, newest first) |
Sorting with filtering
You can combine sorting and filtering:
search=[{"languageIso":"de"}]&sorting=[{"createdAt":"desc"}]