Introducing sorting for the List Enrollments API
You can now control how enrollment records are ordered in List Enrollments API responses using the sortBy query parameter.
Previously, List Enrollments API results were always ordered by createdAt in descending order. That remains the default.
With the new sortBy query parameter, you can now also sort by other fields and set a stable fallback when values are the same. For example, you can sort by statusLastUpdatedAt and fall back to id to ensure consistent, deterministic ordering:
https://enrollments.us.stedi.com/2024-09-01/enrollments?sortBy=statusLastUpdatedAt:desc&sortBy=id:asc
How the sorting works
Each sortBy value uses the property:direction format. If you provide multiple sortBy values, results are sorted in the order they appear.
When you provide a single sortBy value, Stedi automatically adds id as a secondary sort in the same direction. For example, if you provide ?sortBy=updatedAt:desc, Stedi automatically adds id:desc to the query to ensure deterministic results.
To see available sortBy properties, check out our API reference documentation.