Each endpoint that supports sorting has a default. Please visit the API reference to get this information for a specific endpoint under default sorting. When the default sorting is not specified explicitly for an endpoint, it means it uses an internal order based on IDs.

The default sorting can be changed using a sort query param:

curl --request GET \
--url 'https://api.northpass.com/v2/courses?sort=name' \
--header 'Accept: application/json' \
--header 'X-Api-Key: <INSERT_API_KEY_HERE>'

Sorting can be performed using every attribute returned for a specific resource. In the example above, the returned list will be sorted ascending using the name attribute. To sort it descending, a - sign has to be prepended to the attribute's name:

curl --request GET \
--url 'https://api.northpass.com/v2/courses?sort=-name' \
--header 'Accept: application/json' \
--header 'X-Api-Key: <INSERT_API_KEY_HERE>'

The API allows specifying multiple sort attributes, separated by a comma:

curl --request GET \
--url 'https://api.northpass.com/v2/courses?sort=-enrollments_count,name' \
--header 'Accept: application/json' \
--header 'X-Api-Key: <INSERT_API_KEY_HERE>'

In the example above, the list will be sorted descending by the enrollments_count attribute and then ascending by the name attribute.