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

# Sorting

> The PlanD API supports sorting on list endpoints using the `sort` parameter. You can sort by multiple fields and specify sort direction.

## Sort Parameter Format

```
field:direction,field2:direction2
```

* `field`: The field name to sort by
* `direction`: `1` for ascending, `-1` for descending

## Examples

### Single Field Sort

```bash theme={null}
# Sort by name ascending
curl -X GET "https://cloud-api.pland.app/v2/users?sort=name:1" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

# Sort by created date descending
curl -X GET "https://cloud-api.pland.app/v2/users?sort=status.createdAt:-1" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

### Multiple Field Sort

```bash theme={null}
# Sort by name ascending, then by created date descending
curl -X GET "https://cloud-api.pland.app/v2/users?sort=name:1,status.createdAt:-1" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

## Common Sort Fields

| Entity    | Common Fields                            |
| --------- | ---------------------------------------- |
| Users     | `name`, `email`, `status.createdAt`      |
| Objects   | `name`, `number`, `status.createdAt`     |
| Customers | `name`, `number`, `status.createdAt`     |
| Jobs      | `title`, `startDate`, `status.createdAt` |

## Nested Field Sorting

For nested objects, use dot notation:

```bash theme={null}
# Sort by status creation date
sort=status.createdAt:-1

# Sort by object name
sort=object.name:1
```
