> ## Documentation Index
> Fetch the complete documentation index at: https://docs.endorlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sorting

> Learn how to sort results from the Endor Labs REST API.

Sort allows you to sort objects in ascending (default) or descending order.
Similar to [filter keys](https://docs.endorlabs.com/developers-api/rest-api/using-the-rest-api/filters.md#keys), a sort-path key specifies the field to sort the objects by, using a dot-delimited path.

The following example shows how to sort findings based on create time, in descending order:

> [tab] endorctl
>
> ```bash theme={null}
> endorctl api list --resource Finding \
>   --sort-path "meta.create_time" \
>   --sort-order descending
> ```

> [tab] curl
>
> ```bash theme={null}
> curl --get \
>   --header "Authorization: Bearer $ENDOR_TOKEN" \
>   --url "https://api.endorlabs.com/v1/namespaces/$ENDOR_NAMESPACE/findings?list_parameters.sort.path=meta.create_time&list_parameters.sort.order=SORT_ENTRY_ORDER_DESC"
> ```

> [tab] HTTP
>
> ```bash theme={null}
> @baseUrl = https://api.endorlabs.com
> @token = `<insert-access-token>`
> @namespace = `<insert-namespace>`
>
> ###
> GET {{baseUrl}}/v1/namespaces/{{namespace}}/findings?list_parameters.sort.path=meta.create_time&list_parameters.sort.order=SORT_ENTRY_ORDER_DESC HTTP/1.1
> Authorization: Bearer {{token}}
> ```

### Sort order

The following sort orders are supported:

> [tab] endorctl
>
> &#x20;     \- Option: \`sort-path\`
> &#x20;     Description: Specify the field to sort the objects by.
> &#x20;     \- Option: \`sort-order\`
> &#x20;     Description: Specify the sort order.
>
> &#x20;    &#x20;

> [tab] curl / HTTP
>
> &#x20;     \- Value: \`SORT\_ENTRY\_ORDER\_ASC\`
> &#x20;     Description: Ascending order (default)
> &#x20;     \- Value: \`SORT\_ENTRY\_ORDER\_DESC\`
> &#x20;     Description: Descending order
>
> &#x20;    &#x20;


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.