# Selecting and sorting fields

Choose which fields come back, and in which order.

## Choosing fields

Search endpoints return only the fields you list in `fields`, and `fields` is required:

```json
{ "fields": ["id", "fullName", "stage"], "limit": 25 }
```

The API reference lists the fields you can ask for on each endpoint. Asking for a field that doesn't exist returns a `500` error.

## Sorting

Use `orderBy` with a field and a direction, `ASC` or `DESC`:

```json
{
  "fields": ["id", "createdAt"],
  "orderBy": { "createdAt": "DESC" },
  "limit": 25
}
```

> [!WARNING]
> The field you sort by must also be in `fields`. Otherwise the request fails with a `500` error.

## Sensitive fields

Client `email` and `phone` depend on the visibility set on your API key:

| Key setting | What you get |
|---|---|
| Visible | The full value. |
| Masked | A partly hidden value, such as `977**235`. |
| Not set | The field is left out of the response. |
