# 📄 Pagination & Sorting

All list endpoints (e.g., `/listProjects`, `/project/{projectId}/tasks`) support pagination and sorting to efficiently handle large datasets.

#### Query Parameters

| Parameter | Type    | Default      | Description                                            |
| --------- | ------- | ------------ | ------------------------------------------------------ |
| `page`    | integer | `1`          | Page number to retrieve (1-indexed)                    |
| `limit`   | integer | `10`         | Number of items per page (max: 100)                    |
| `sort`    | string  | `-createdAt` | Field to sort by. Prefix with `-` for descending order |

#### Sorting Examples

```bash
# Get newest projects first (default)
GET /listProjects?sort=-createdAt

# Get oldest projects first
GET /listProjects?sort=createdAt

# Sort alphabetically by name
GET /listProjects?sort=name

# Sort by name descending (Z to A)
GET /listProjects?sort=-name
```

#### Pagination Examples

```bash
# Get first page with 10 items
GET /listProjects?page=1&limit=10

# Get second page with 50 items
GET /listProjects?page=2&limit=50

# Get all projects (up to 100 per page)
GET /listProjects?limit=100
```

***
